summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2007-02-05 13:22:02 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2007-02-05 13:22:02 -0500
commit4bf136ffc66837c58d8003b23428c61e8edff951 (patch)
tree1ed292593ad4ae738f23b1a4869e8a6a60191088
parent86d7c4d786e7c6a13a1c4fa61428d53068017d62 (diff)
downloadcmake-4bf136ffc66837c58d8003b23428c61e8edff951.tar.gz
ENH: merge in changes from branch
-rw-r--r--CMakeLists.txt39
-rw-r--r--ChangeLog.manual20
-rw-r--r--Modules/CPack.cmake4
-rw-r--r--Modules/FindKDE4.cmake4
-rw-r--r--Modules/FindPkgConfig.cmake360
-rw-r--r--Modules/FindXMLRPC.cmake1
-rw-r--r--Source/CMakeLists.txt16
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx103
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.h45
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx183
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.h46
-rw-r--r--Source/CPack/cmCPackGenerators.cxx23
-rw-r--r--Source/CPack/cmCPackGenericGenerator.cxx23
-rw-r--r--Source/CPack/cmCPackGenericGenerator.h6
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h2
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h2
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTGZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.cxx39
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.h4
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h2
-rw-r--r--Source/CPack/cmCPackZIPGenerator.h2
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx6
-rw-r--r--Source/cmInstallTargetGenerator.cxx7
-rw-r--r--Source/cmLocalKdevelopGenerator.cxx41
-rw-r--r--Source/cmLocalKdevelopGenerator.h40
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx951
-rw-r--r--Source/cmLocalVisualStudio7Generator.h13
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx7
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx18
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx17
-rw-r--r--Source/cmMakefileTargetGenerator.cxx35
-rw-r--r--Source/cmSystemTools.cxx90
-rw-r--r--Source/cmSystemTools.h9
-rw-r--r--Source/cmTarget.cxx41
-rw-r--r--Source/cmTarget.h12
-rw-r--r--Source/kwsys/System.h.in2
-rw-r--r--Source/kwsys/SystemTools.cxx24
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt6
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt6
-rw-r--r--Tests/ComplexRelativePaths/Executable/CMakeLists.txt6
-rw-r--r--Utilities/Release/Cygwin/CMakeLists.txt25
-rw-r--r--Utilities/Release/Cygwin/README.cygwin.in42
-rwxr-xr-xUtilities/Release/Cygwin/cygwin-package.sh.in90
-rw-r--r--Utilities/Release/Cygwin/cygwin-patch.diff.in0
-rw-r--r--Utilities/Release/Cygwin/cygwin-setup.hint.in5
-rw-r--r--cmake_uninstall.cmake.in14
48 files changed, 1942 insertions, 496 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92f13fccd4..fa1732a930 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,9 +5,9 @@ MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
# The CMake version number.
SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 4)
-SET(CMake_VERSION_PATCH 6)
+SET(CMake_VERSION_PATCH 7)
# for an actual release this should not be defined
-#SET(CMake_VERSION_RC 2)
+SET(CMake_VERSION_RC 1)
SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
@@ -390,9 +390,44 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
ENDIF(WIN32 AND NOT UNIX)
+# cygwin specific packaging stuff
+ IF(CYGWIN)
+ SET(CPACK_PACKAGE_NAME cmake)
+ # setup the name of the package for cygwin cmake-2.4.3
+ SET(CPACK_PACKAGE_FILE_NAME
+ "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
+ # the source has the same name as the binary
+ SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
+ # Create a cygwin version number in case there are changes for cygwin
+ # that are not reflected upstream in CMake
+ SET(CPACK_CYGWIN_PATCH_NUMBER 1)
+ # if we are on cygwin and have cpack, then force the
+ # doc, data and man dirs to conform to cygwin style directories
+ SET(CMAKE_DOC_DIR "/share/doc/${CPACK_PACKAGE_FILE_NAME}")
+ SET(CMAKE_DATA_DIR "/share/${CPACK_PACKAGE_FILE_NAME}")
+ SET(CMAKE_MAN_DIR "/share/man")
+ # let the user know we just forced these values
+ MESSAGE(STATUS "Setup for Cygwin packaging")
+ MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}")
+ MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}")
+ MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}")
+ # These files are required by the cmCPackCygwinSourceGenerator and the files
+ # put into the release tar files.
+ SET(CPACK_CYGWIN_BUILD_SCRIPT
+ "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh")
+ SET(CPACK_CYGWIN_PATCH_FILE
+ "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch")
+ # include the sub directory for cygwin releases
+ SUBDIRS(Utilities/Release/Cygwin)
+ # when packaging source make sure the .build directory is not included
+ SET(CPACK_SOURCE_IGNORE_FILES
+ "/CVS/" "/\\\\.build/" "/\\\\.svn/" "\\\\.swp$" "\\\\.#" "/#" "~$")
+ ENDIF(CYGWIN)
+ # include CPack model once all variables are set
INCLUDE(CPack)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+# configure the CTestScript.cmake file into the binary directory
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
@ONLY IMMEDIATE)
diff --git a/ChangeLog.manual b/ChangeLog.manual
index 4c54a2de98..03dc8d3eac 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,23 @@
+Changes in CMake 2.4.7
+
+* Add support for cygwin setup packages to setup
+
+* Fix uninstall with DESTDIR
+
+* If COMPILE_FLAGS is changed on a target the object files will now recompile
+
+* Fix Bug 3512 - precompiled header flag mapping on VS.
+
+* Do not run custom commands with relative paths if the working directory is set.
+
+* Fix bugs 3277, 4341, 4341 make pdb files match the target name correctly
+
+* handle user set NODEFAULTLIB correctly in VS projects
+
+* Fix external project for VS 2005 service pack 1 GUID not set correctly
+
+* Fix Kdevelop problem where files could end up duplicated
+
Changes in CMake 2.4.6
* Remove svn test in ctestctest3
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 913d8740de..50c55a7cf3 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -99,6 +99,10 @@ IF(NOT CPACK_GENERATOR)
SET(CPACK_GENERATOR "STGZ;TGZ;TZ")
ENDIF(APPLE)
SET(CPACK_SOURCE_GENERATOR "TGZ;TZ")
+ IF(CYGWIN)
+ SET(CPACK_SOURCE_GENERATOR "CygwinSource")
+ SET(CPACK_GENERATOR "CygwinBinary")
+ ENDIF(CYGWIN)
ELSE(UNIX)
SET(CPACK_GENERATOR "NSIS;ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
index 615771cc75..bbf2017e29 100644
--- a/Modules/FindKDE4.cmake
+++ b/Modules/FindKDE4.cmake
@@ -1,12 +1,12 @@
# Find KDE4 and provide all necessary variables and macros to compile software for it.
# It looks for KDE 4 in the following directories in the given order:
# - CMAKE_INSTALL_PREFIX
-# - KDEDIR
+# - KDEDIRS
# - /opt/kde4
# - /opt/kde
#
# Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more information.
-# They are installed with the KDE 4 libraries in $KDEDIR/share/apps/cmake/modules/.
+# They are installed with the KDE 4 libraries in $KDEDIRS/share/apps/cmake/modules/.
#
# Author: Alexander Neundorf <neundorf@kde.org>
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
new file mode 100644
index 0000000000..afae15cb02
--- /dev/null
+++ b/Modules/FindPkgConfig.cmake
@@ -0,0 +1,360 @@
+# - a pkg-config module for CMake
+#
+# Usage:
+# pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
+# checks for all the given modules
+#
+# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
+# checks for given modules and uses the first working one
+#
+# When the 'REQUIRED' argument was set, macros will fail with an error
+# when module(s) could not be found
+#
+# It sets the following variables:
+# PKG_CONFIG_FOUND ... true iff pkg-config works on the system
+# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+# <PREFIX>_FOUND ... set to 1 iff module(s) exist
+#
+# For the following variables two sets of values exist; first one is the
+# common one and has the given PREFIX. The second set contains flags
+# which are given out when pkgconfig was called with the '--static'
+# option.
+# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
+# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
+# <XPREFIX>_LDFLAGS ... all required linker flags
+# <XPREFIX>_LDFLAGS_OTHERS ... all other linker flags
+# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
+# <XPREFIX>_CFLAGS ... all required cflags
+# <XPREFIX>_CFLAGS_OTHERS ... the other compiler flags
+#
+# <XPREFIX> = <PREFIX> for common case
+# <XPREFIX> = <PREFIX>_STATIC for static linking
+#
+# There are some special variables whose prefix depends on the count
+# of given modules. When there is only one module, <PREFIX> stays
+# unchanged. When there are multiple modules, the prefix will be
+# changed to <PREFIX>_<MODNAME>:
+# <XPREFIX>_VERSION ... version of the module
+# <XPREFIX>_PREFIX ... prefix-directory of the module
+# <XPREFIX>_INCLUDEDIR ... include-dir of the module
+# <XPREFIX>_LIBDIR ... lib-dir of the module
+#
+# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
+# <XPREFIX> = <PREFIX>_<MODNAME>
+#
+# A <MODULE> parameter can have the following formats:
+# {MODNAME} ... matches any version
+# {MODNAME}>={VERSION} ... at least version <VERSION> is required
+# {MODNAME}={VERSION} ... exactly version <VERSION> is required
+# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
+#
+# Examples
+# pkg_check_modules (GLIB2 glib-2.0)
+#
+# pkg_check_modules (GLIB2 glib-2.0>=2.10)
+# requires at least version 2.10 of glib2 and defines e.g.
+# GLIB2_VERSION=2.10.3
+#
+# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
+# requires both glib2 and gtk2, and defines e.g.
+# FOO_glib-2.0_VERSION=2.10.3
+# FOO_gtk+-2.0_VERSION=2.8.20
+#
+# pkg_check_modules (XRENDER REQUIRED xrender)
+# defines e.g.:
+# XRENDER_LIBRARIES=Xrender;X11
+# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
+#
+# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
+
+
+# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# Redistribution and use, with or without modification, are permitted
+# provided that the following conditions are met:
+#
+# 1. Redistributions must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior
+# written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+### Common stuff ####
+set(PKG_CONFIG_VERSION 1)
+set(PKG_CONFIG_FOUND 0)
+
+find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
+mark_as_advanced(PKG_CONFIG_EXECUTABLE)
+
+if(PKG_CONFIG_EXECUTABLE)
+ set(PKG_CONFIG_FOUND 1)
+endif(PKG_CONFIG_EXECUTABLE)
+
+
+# Unsets the given variables
+macro(_pkgconfig_unset var)
+ set(${var} "" CACHE INTERNAL "")
+endmacro(_pkgconfig_unset)
+
+macro(_pkgconfig_set var value)
+ set(${var} ${value} CACHE INTERNAL "")
+endmacro(_pkgconfig_set)
+
+# Invokes pkgconfig, cleans up the result and sets variables
+macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
+ set(_pkgconfig_invoke_result)
+
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
+ OUTPUT_VARIABLE _pkgconfig_invoke_result
+ RESULT_VARIABLE _pkgconfig_failed)
+
+ if (_pkgconfig_failed)
+ set(_pkgconfig_${_varname} "")
+ _pkgconfig_unset(${_prefix}_${_varname})
+ else(_pkgconfig_failed)
+ string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+ string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+
+ if (NOT ${_regexp} STREQUAL "")
+ string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
+ endif(NOT ${_regexp} STREQUAL "")
+
+ separate_arguments(_pkgconfig_invoke_result)
+
+ #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}")
+ set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})
+ _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
+ endif(_pkgconfig_failed)
+endmacro(_pkgconfig_invoke)
+
+# Invokes pkgconfig two times; once without '--static' and once with
+# '--static'
+macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
+ _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN})
+ _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN})
+endmacro(_pkgconfig_invoke_dyn)
+
+# Splits given arguments into options and a package list
+macro(_pkgconfig_parse_options _result _is_req)
+ set(${_is_req} 0)
+
+ foreach(_pkg ${ARGN})
+ if (_pkg STREQUAL "REQUIRED")
+ set(${_is_req} 1)
+ endif (_pkg STREQUAL "REQUIRED")
+ endforeach(_pkg ${ARGN})
+
+ set(${_result} ${ARGN})
+ list(REMOVE_ITEM ${_result} "REQUIRED")
+endmacro(_pkgconfig_parse_options)
+
+###
+macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+ _pkgconfig_unset(${_prefix}_FOUND)
+ _pkgconfig_unset(${_prefix}_VERSION)
+ _pkgconfig_unset(${_prefix}_PREFIX)
+ _pkgconfig_unset(${_prefix}_INCLUDEDIR)
+ _pkgconfig_unset(${_prefix}_LIBDIR)
+ _pkgconfig_unset(${_prefix}_LIBS)
+ _pkgconfig_unset(${_prefix}_LIBS_L)
+ _pkgconfig_unset(${_prefix}_LIBS_PATHS)
+ _pkgconfig_unset(${_prefix}_LIBS_OTHER)
+ _pkgconfig_unset(${_prefix}_CFLAGS)
+ _pkgconfig_unset(${_prefix}_CFLAGS_I)
+ _pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
+ _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
+ _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
+
+ # create a better addressable variable of the modules and calculate its size
+ set(_pkg_check_modules_list ${ARGN})
+ list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
+
+ if(PKG_CONFIG_EXECUTABLE)
+ # give out status message telling checked module
+ if (NOT ${_is_silent})
+ if (_pkg_check_modules_cnt EQUAL 1)
+ message(STATUS "checking for module '${_pkg_check_modules_list}'")
+ else(_pkg_check_modules_cnt EQUAL 1)
+ message(STATUS "checking for modules '${_pkg_check_modules_list}'")
+ endif(_pkg_check_modules_cnt EQUAL 1)
+ endif(NOT ${_is_silent})
+
+ set(_pkg_check_modules_packages)
+ set(_pkg_check_modules_failed)
+
+ # iterate through module list and check whether they exist and match the required version
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
+ set(_pkg_check_modules_exist_query)
+
+ # check whether version is given
+ if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+ string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
+ string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
+ string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
+ else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+ set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
+ set(_pkg_check_modules_pkg_op)
+ set(_pkg_check_modules_pkg_ver)
+ endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
+
+ # handle the operands
+ if (_pkg_check_modules_pkg_op STREQUAL ">=")
+ list(APPEND _pkg_check_modules_exist_query --atleast-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL ">=")
+
+ if (_pkg_check_modules_pkg_op STREQUAL "=")
+ list(APPEND _pkg_check_modules_exist_query --exact-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL "=")
+
+ if (_pkg_check_modules_pkg_op STREQUAL "<=")
+ list(APPEND _pkg_check_modules_exist_query --max-version)
+ endif(_pkg_check_modules_pkg_op STREQUAL "<=")
+
+ # create the final query which is of the format:
+ # * --atleast-version <version> <pkg-name>
+ # * --exact-version <version> <pkg-name>
+ # * --max-version <version> <pkg-name>
+ # * --exists <pkg-name>
+ if (_pkg_check_modules_pkg_op)
+ list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
+ else(_pkg_check_modules_pkg_op)
+ list(APPEND _pkg_check_modules_exist_query --exists)
+ endif(_pkg_check_modules_pkg_op)
+
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
+ _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
+
+ list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
+ list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}")
+
+ # execute the query
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
+ RESULT_VARIABLE _pkgconfig_retval)
+
+ # evaluate result and tell failures
+ if (_pkgconfig_retval)
+ if(NOT ${_is_silent})
+ message(STATUS " package '${_pkg_check_modules_pkg}' not found")
+ endif(NOT ${_is_silent})
+
+ set(_pkg_check_modules_failed 1)
+ endif(_pkgconfig_retval)
+ endforeach(_pkg_check_modules_pkg)
+
+ if(_pkg_check_modules_failed)
+ # fail when requested
+ if (${_is_required})
+ message(SEND_ERROR "A required package was not found")
+ endif (${_is_required})
+ else(_pkg_check_modules_failed)
+ # when we are here, we checked whether requested modules
+ # exist. Now, go through them and set variables
+
+ _pkgconfig_set(${_prefix}_FOUND 1)
+ list(LENGTH _pkg_check_modules_packages pkg_count)
+
+ # iterate through all modules again and set individual variables
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
+ # handle case when there is only one package required
+ if (pkg_count EQUAL 1)
+ set(_pkg_check_prefix "${_prefix}")
+ else(pkg_count EQUAL 1)
+ set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
+ endif(pkg_count EQUAL 1)
+
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
+ _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
+
+ message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ endforeach(_pkg_check_modules_pkg)
+
+ # set variables which are combined for multiple modules
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
+
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
+ endif(_pkg_check_modules_failed)
+ else(PKG_CONFIG_EXECUTABLE)
+ if (${_is_required})
+ message(SEND_ERROR "pkg-config tool not found")
+ endif (${_is_required})
+ endif(PKG_CONFIG_EXECUTABLE)
+endmacro(_pkg_check_modules_internal)
+
+###
+### User visible macros start here
+###
+
+###
+macro(pkg_check_modules _prefix _module0)
+ # check cached value
+ if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+ _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN})
+ _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules})
+
+ _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+endmacro(pkg_check_modules)
+
+###
+macro(pkg_search_module _prefix _module0)
+ # check cached value
+ if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+ set(_pkg_modules_found 0)
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN})
+
+ message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+
+ # iterate through all modules and stop at the first working one.
+ foreach(_pkg_alt ${_pkg_modules_alt})
+ if(NOT _pkg_modules_found)
+ _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
+ endif(NOT _pkg_modules_found)
+
+ if (${_prefix}_FOUND)
+ set(_pkg_modules_found 1)
+ endif(${_prefix}_FOUND)
+ endforeach(_pkg_alt)
+
+ if (NOT ${_prefix}_FOUND)
+ if(${_pkg_is_required})
+ message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
+ endif(${_pkg_is_required})
+ endif(NOT ${_prefix}_FOUND)
+
+ _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
+endmacro(pkg_search_module)
+
+### Local Variables:
+### mode: cmake
+### End:
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index 3d2599362f..2e8f1ad0f7 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -104,6 +104,7 @@ IF(XMLRPC_FOUND)
PATHS ${XMLRPC_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
+ FIND_LIBRARY(XMLRPC_${name}_LIBRARY NAMES ${name})
MARK_AS_ADVANCED(XMLRPC_${name}_LIBRARY)
# If any library is not found then the whole package is not found.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 19f56a8a0e..094b6c8858 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -167,8 +167,7 @@ SET(SRCS
# Kdevelop only works on UNIX and not windows
IF(UNIX)
SET(SRCS ${SRCS}
- cmGlobalKdevelopGenerator.cxx
- cmLocalKdevelopGenerator.cxx)
+ cmGlobalKdevelopGenerator.cxx)
ENDIF(UNIX)
# XCode only works on apple
IF(APPLE)
@@ -278,15 +277,17 @@ TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_L
#
SET(CPACK_SRCS
CPack/cmCPackGenerators.cxx
- CPack/cmCPackSTGZGenerator.cxx
- CPack/cmCPackTGZGenerator.cxx
+ CPack/cmCPackGenericGenerator.cxx
+ CPack/cmCPackLog.cxx
CPack/cmCPackNSISGenerator.cxx
CPack/cmCPackPackageMakerGenerator.cxx
- CPack/cmCPackZIPGenerator.cxx
+ CPack/cmCPackSTGZGenerator.cxx
+ CPack/cmCPackTGZGenerator.cxx
CPack/cmCPackTarBZip2Generator.cxx
CPack/cmCPackTarCompressGenerator.cxx
- CPack/cmCPackGenericGenerator.cxx
- CPack/cmCPackLog.cxx
+ CPack/cmCPackZIPGenerator.cxx
+ CPack/cmCPackCygwinBinaryGenerator.cxx
+ CPack/cmCPackCygwinSourceGenerator.cxx
)
# Build CPackLib
ADD_LIBRARY(CPackLib ${CPACK_SRCS})
@@ -308,6 +309,7 @@ IF(WIN32)
IF(NOT UNIX)
ADD_EXECUTABLE(cmw9xcom cmw9xcom.cxx)
TARGET_LINK_LIBRARIES(cmw9xcom CMakeLib)
+ INSTALL_TARGETS(/bin cmw9xcom)
ENDIF(NOT UNIX)
ENDIF(WIN32)
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
new file mode 100644
index 0000000000..7d2ffb8197
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -0,0 +1,103 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "cmCPackCygwinBinaryGenerator.h"
+
+#include "cmake.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmSystemTools.h"
+#include "cmMakefile.h"
+#include "cmGeneratedFileStream.h"
+#include "cmCPackLog.h"
+
+#include <cmsys/SystemTools.hxx>
+
+//----------------------------------------------------------------------
+cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
+{
+ this->Compress = false;
+}
+
+//----------------------------------------------------------------------
+cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator()
+{
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinBinaryGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
+ std::vector<std::string> path;
+ std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
+ if ( pkgPath.empty() )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
+ return 0;
+ }
+ this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
+ << pkgPath.c_str()
+ << std::endl);
+
+ return this->Superclass::InitializeInternal();
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
+ packageName += "-";
+ packageName += this->GetOption("CPACK_PACKAGE_VERSION");
+ packageName = cmsys::SystemTools::LowerCase(packageName);
+ std::string manifest = "/usr/share/doc/";
+ manifest += packageName;
+ manifest += "/MANIFEST";
+ std::string manifestFile
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ // Create a MANIFEST file that contains all of the files in
+ // the tar file
+ std::string tempdir = manifestFile;
+ manifestFile += manifest;
+ // create an extra scope to force the stream
+ // to create the file before the super class is called
+ {
+ cmGeneratedFileStream ofs(manifestFile.c_str());
+ for(std::vector<std::string>::const_iterator i = files.begin();
+ i != files.end(); ++i)
+ {
+ // remove the temp dir and replace with /usr
+ ofs << (*i).substr(tempdir.size()) << "\n";
+ }
+ ofs << manifest << "\n";
+ }
+ // add the manifest file to the list of all files
+ std::vector<std::string> filesWithManifest = files;
+ filesWithManifest.push_back(manifestFile);
+ // create the bzip2 tar file
+ return this->Superclass::CompressFiles(outFileName, toplevel,
+ filesWithManifest);
+}
+
+const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()
+{
+ this->OutputExtension = "-";
+ this->OutputExtension += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
+ this->OutputExtension += ".tar.bz2";
+ return this->OutputExtension.c_str();
+}
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h
new file mode 100644
index 0000000000..c415f3292c
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h
@@ -0,0 +1,45 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef cmCPackCygwinBinaryGenerator_h
+#define cmCPackCygwinBinaryGenerator_h
+
+#include "cmCPackTarBZip2Generator.h"
+
+/** \class cmCPackCygwinBinaryGenerator
+ * \brief A generator for TarBZip2 files
+ */
+class cmCPackCygwinBinaryGenerator : public cmCPackTarBZip2Generator
+{
+public:
+ cmCPackTypeMacro(cmCPackCygwinBinaryGenerator, cmCPackTarBZip2Generator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackCygwinBinaryGenerator();
+ virtual ~cmCPackCygwinBinaryGenerator();
+protected:
+ virtual const char* GetInstallPrefix() { return "/usr"; }
+ virtual int InitializeInternal();
+ int CompressFiles(const char* outFileName, const char* toplevel,
+ const std::vector<std::string>& files);
+ virtual const char* GetOutputExtension();
+ std::string OutputExtension;
+};
+
+#endif
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
new file mode 100644
index 0000000000..c9062550a5
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -0,0 +1,183 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "cmCPackCygwinSourceGenerator.h"
+
+#include "cmake.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmSystemTools.h"
+#include "cmMakefile.h"
+#include "cmGeneratedFileStream.h"
+#include "cmCPackLog.h"
+
+#include <cmsys/SystemTools.hxx>
+
+// Includes needed for implementation of RenameFile. This is not in
+// system tools because it is not implemented robustly enough to move
+// files across directories.
+#ifdef _WIN32
+# include <windows.h>
+# include <sys/stat.h>
+#endif
+
+//----------------------------------------------------------------------
+cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator()
+{
+ this->Compress = false;
+}
+
+//----------------------------------------------------------------------
+cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator()
+{
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinSourceGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
+ std::vector<std::string> path;
+ std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
+ if ( pkgPath.empty() )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
+ return 0;
+ }
+ this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
+ << pkgPath.c_str()
+ << std::endl);
+
+ return this->Superclass::InitializeInternal();
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ // Create a tar file of the sources
+ std::string packageDirFileName
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ packageDirFileName += ".tar";
+ std::string output;
+ // skip one parent up to the cmCPackTGZGenerator to create tar file
+ this->Compress = false; // just create tar not tar.gz
+ if ( !this->cmCPackTGZGenerator::CompressFiles(packageDirFileName.c_str(),
+ toplevel, files) )
+ {
+ return 0;
+ }
+ // Now bzip2 the source tar file
+ if(!this->BZip2File(packageDirFileName.c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 on file: "
+ << packageDirFileName.c_str());
+ return 0;
+ }
+ // Now create a tar file that contains the above .tar.bz2 file
+ // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
+ // files
+ std::string compressOutFile = packageDirFileName + ".bz2";
+ // at this point compressOutFile is the full path to
+ // _CPack_Package/.../package-2.5.0.tar.bz2
+ // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2
+ // with these
+ // _CPack_Package/.../package-2.5.0-1.patch
+ // _CPack_Package/.../package-2.5.0-1.sh
+ // _CPack_Package/.../package-2.5.0.tar.bz2
+ // the -1 is CPACK_CYGWIN_PATCH_NUMBER
+ // copy the patch file into place
+ if(!cmSystemTools::CopyFileAlways(
+ this->GetOption("CPACK_CYGWIN_PATCH_FILE"),
+ this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "problem copying: ["
+ << this->GetOption("CPACK_CYGWIN_PATCH_FILE") << "]\nto\n["
+ << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
+ return 0;
+ }
+ // copy the build script into place
+ if(!cmSystemTools::CopyFileAlways(
+ this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"),
+ this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "problem copying: "
+ << this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT") << "\nto\n"
+ << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
+ return 0;
+ }
+ // create the tar file
+ std::string outerTarFile
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ outerTarFile += "-";
+ outerTarFile += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
+ outerTarFile += "-src.tar";
+ std::string buildScript = cmSystemTools::GetFilenameName(
+ this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"));
+ std::string patchFile = cmSystemTools::GetFilenameName(
+ this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
+ std::vector<cmStdString> outerFiles;
+ std::string file = cmSystemTools::GetFilenameName(compressOutFile);
+ std::string path = cmSystemTools::GetFilenamePath(compressOutFile);
+ // a source release in cygwin should have the build script used
+ // to build the package, the patch file that is different from the
+ // regular upstream version of the sources, and a bziped tar file
+ // of the original sources
+ outerFiles.push_back(buildScript);
+ outerFiles.push_back(patchFile);
+ outerFiles.push_back(file);
+ std::string saveDir= cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(path.c_str());
+ cmSystemTools::CreateTar(outerTarFile.c_str(),
+ outerFiles, false, false);
+ cmSystemTools::ChangeDirectory(saveDir.c_str());
+ // now compress the outer tar file
+ if(!this->BZip2File(outerTarFile.c_str()))
+ {
+ return 0;
+ }
+ compressOutFile = outerTarFile;
+ compressOutFile += ".bz2";
+ // now rename the file to its final name
+ if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
+ {
+ if ( !this->RenameFile(compressOutFile.c_str(), outFileName) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \""
+ << compressOutFile.c_str() << "\" to \""
+ << (outFileName ? outFileName : "(NULL)") << std::endl);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+const char* cmCPackCygwinSourceGenerator::GetInstallPrefix()
+{
+ this->InstallPrefix = "/";
+ this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ return this->InstallPrefix.c_str();
+}
+
+const char* cmCPackCygwinSourceGenerator::GetOutputExtension()
+{
+ this->OutputExtension = "-";
+ this->OutputExtension += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
+ this->OutputExtension += "-src.tar.bz2";
+ return this->OutputExtension.c_str();
+}
+
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h
new file mode 100644
index 0000000000..a4e4656e38
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.h
@@ -0,0 +1,46 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef cmCPackCygwinSourceGenerator_h
+#define cmCPackCygwinSourceGenerator_h
+
+#include "cmCPackTarBZip2Generator.h"
+
+/** \class cmCPackCygwinSourceGenerator
+ * \brief A generator for cygwin source files
+ */
+class cmCPackCygwinSourceGenerator : public cmCPackTarBZip2Generator
+{
+public:
+ cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTarBZip2Generator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackCygwinSourceGenerator();
+ virtual ~cmCPackCygwinSourceGenerator();
+protected:
+ const char* GetInstallPrefix();
+ virtual int InitializeInternal();
+ int CompressFiles(const char* outFileName, const char* toplevel,
+ const std::vector<std::string>& files);
+ virtual const char* GetOutputExtension();
+ std::string InstallPrefix;
+ std::string OutputExtension;
+};
+
+#endif
diff --git a/Source/CPack/cmCPackGenerators.cxx b/Source/CPack/cmCPackGenerators.cxx
index 3515e0e58e..0cabe7cb0f 100644
--- a/Source/CPack/cmCPackGenerators.cxx
+++ b/Source/CPack/cmCPackGenerators.cxx
@@ -23,8 +23,18 @@
#include "cmCPackTarCompressGenerator.h"
#include "cmCPackZIPGenerator.h"
#include "cmCPackSTGZGenerator.h"
-#include "cmCPackNSISGenerator.h"
-#include "cmCPackPackageMakerGenerator.h"
+#ifdef _WIN32
+# include "cmCPackNSISGenerator.h"
+#endif
+#ifdef __APPLE__
+# include "cmCPackPackageMakerGenerator.h"
+# include "cmCPackOSXX11Generator.h"
+#endif
+
+#ifdef __CYGWIN__
+# include "cmCPackCygwinBinaryGenerator.h"
+# include "cmCPackCygwinSourceGenerator.h"
+#endif
#include "cmCPackLog.h"
@@ -39,6 +49,13 @@ cmCPackGenerators::cmCPackGenerators()
this->RegisterGenerator("NSIS", "Null Soft Installer",
cmCPackNSISGenerator::CreateGenerator);
#endif
+#ifdef __CYGWIN__
+ this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
+ cmCPackCygwinBinaryGenerator::CreateGenerator);
+ this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
+ cmCPackCygwinSourceGenerator::CreateGenerator);
+#endif
+
this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackZIPGenerator::CreateGenerator);
this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
@@ -46,7 +63,7 @@ cmCPackGenerators::cmCPackGenerators()
this->RegisterGenerator("TZ", "Tar Compress compression",
cmCPackTarCompressGenerator::CreateGenerator);
#ifdef __APPLE__
- this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker compression",
+ this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
cmCPackPackageMakerGenerator::CreateGenerator);
#endif
}
diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx
index 0102689708..213f1a26f4 100644
--- a/Source/CPack/cmCPackGenericGenerator.cxx
+++ b/Source/CPack/cmCPackGenericGenerator.cxx
@@ -74,7 +74,6 @@ int cmCPackGenericGenerator::PrepareNames()
std::string outName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
tempDirectory += "/" + outName;
- outName += ".";
outName += this->GetOutputExtension();
std::string destFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
@@ -82,7 +81,6 @@ int cmCPackGenericGenerator::PrepareNames()
std::string outFile = topDirectory + "/" + outName;
std::string installPrefix = tempDirectory + this->GetInstallPrefix();
-
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str());
@@ -106,7 +104,8 @@ int cmCPackGenericGenerator::PrepareNames()
if ( !cmSystemTools::FileExists(descFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find description file name: " << descFileName << std::endl);
+ "Cannot find description file name: ["
+ << descFileName << "]" << std::endl);
return 0;
}
std::ifstream ifs(descFileName);
@@ -152,8 +151,11 @@ int cmCPackGenericGenerator::InstallProject()
{
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl);
this->CleanTemporaryDirectory();
- const char* tempInstallDirectory
+ std::string tempInstallDirectoryWithPostfix
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+ tempInstallDirectoryWithPostfix
+ += this->GetTemporaryInstallDirectoryPostfix();
+ const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
int res = 1;
if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
{
@@ -232,6 +234,7 @@ int cmCPackGenericGenerator::InstallProject()
{
std::string fileName = tempInstallDirectory;
fileName += "/" + *it;
+ fileName += cmSystemTools::GetExecutableExtension();
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
" Strip file: " << fileName.c_str()
<< std::endl);
@@ -341,7 +344,8 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
std::vector<std::string>::iterator it;
- const char* tempDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ const char* tempDir = tempInstallDirectory;
+// this->GetOption("CPACK_TEMPORARY_DIRECTORY");
for ( it = installDirectoriesVector.begin();
it != installDirectoriesVector.end();
++it )
@@ -965,17 +969,20 @@ bool cmCPackGenericGenerator::ConfigureString(const std::string& inString,
//----------------------------------------------------------------------
bool cmCPackGenericGenerator::ConfigureFile(const char* inName,
- const char* outName)
+ const char* outName, bool copyOnly /* = false */)
{
return this->MakefileMap->ConfigureFile(inName, outName,
- false, true, false) == 1;
+ copyOnly, true, false) == 1;
}
//----------------------------------------------------------------------
int cmCPackGenericGenerator::CleanTemporaryDirectory()
{
- const char* tempInstallDirectory
+ std::string tempInstallDirectoryWithPostfix
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+ tempInstallDirectoryWithPostfix
+ += this->GetTemporaryInstallDirectoryPostfix();
+ const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
if(cmsys::SystemTools::FileExists(tempInstallDirectory))
{
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h
index afe79c0e2b..f01188bf8e 100644
--- a/Source/CPack/cmCPackGenericGenerator.h
+++ b/Source/CPack/cmCPackGenericGenerator.h
@@ -94,15 +94,17 @@ protected:
int PrepareNames();
int InstallProject();
int CleanTemporaryDirectory();
- virtual const char* GetOutputExtension() { return "cpack"; }
+ virtual const char* GetOutputExtension() { return ".cpack"; }
virtual const char* GetOutputPostfix() { return 0; }
virtual int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetInstallPath();
virtual const char* GetInstallPrefix() { return "/"; }
+ virtual const char* GetTemporaryInstallDirectoryPostfix() { return ""; }
virtual std::string FindTemplate(const char* name);
- virtual bool ConfigureFile(const char* inName, const char* outName);
+ virtual bool ConfigureFile(const char* inName, const char* outName,
+ bool copyOnly = false);
virtual bool ConfigureString(const std::string& input, std::string& output);
virtual int InitializeInternal();
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index db3fd672e6..ff075d6597 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -41,7 +41,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "exe"; }
+ virtual const char* GetOutputExtension() { return ".exe"; }
virtual const char* GetOutputPostfix() { return "win32"; }
bool GetListOfSubdirectories(const char* dir,
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index b7881de8a4..17adb148ab 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -42,7 +42,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "dmg"; }
+ virtual const char* GetOutputExtension() { return ".dmg"; }
virtual const char* GetOutputPostfix() { return "darwin"; }
virtual const char* GetInstallPrefix() { return "/usr"; }
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index 5d7ead8489..79ebf34d12 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -41,7 +41,7 @@ protected:
const std::vector<std::string>& files);
virtual int InitializeInternal();
int GenerateHeader(std::ostream* os);
- virtual const char* GetOutputExtension() { return "sh"; }
+ virtual const char* GetOutputExtension() { return ".sh"; }
};
#endif
diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h
index 4323a53c1d..67c9969088 100644
--- a/Source/CPack/cmCPackTGZGenerator.h
+++ b/Source/CPack/cmCPackTGZGenerator.h
@@ -44,7 +44,7 @@ protected:
virtual int GenerateHeader(std::ostream* os);
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "tar.gz"; }
+ virtual const char* GetOutputExtension() { return ".tar.gz"; }
bool Compress;
};
diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx
index 17efda5856..ea3035184a 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.cxx
+++ b/Source/CPack/cmCPackTarBZip2Generator.cxx
@@ -66,27 +66,17 @@ int cmCPackTarBZip2Generator::InitializeInternal()
}
//----------------------------------------------------------------------
-int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
- const char* toplevel, const std::vector<std::string>& files)
+int cmCPackTarBZip2Generator::BZip2File(const char* packageDirFileName)
{
- std::string packageDirFileName
- = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
- packageDirFileName += ".tar";
- std::string output;
- int retVal = -1;
- if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
- toplevel, files) )
- {
- return 0;
- }
-
+ int retVal = 0;
cmOStringStream dmgCmd1;
dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" \"" << packageDirFileName
<< "\"";
retVal = -1;
+ std::string output;
int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
- &retVal, toplevel, this->GeneratorVerbose, 0);
+ &retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
@@ -100,6 +90,27 @@ int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
+ return 1;
+}
+
+//----------------------------------------------------------------------
+int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ std::string packageDirFileName
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ packageDirFileName += ".tar";
+ std::string output;
+ if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
+ toplevel, files) )
+ {
+ return 0;
+ }
+
+ if(!this->BZip2File(packageDirFileName.c_str()))
+ {
+ return 0;
+ }
std::string compressOutFile = packageDirFileName + ".bz2";
if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h
index c5c404bb12..6f30131b83 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.h
+++ b/Source/CPack/cmCPackTarBZip2Generator.h
@@ -39,8 +39,8 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "tar.bz2"; }
-
+ virtual const char* GetOutputExtension() { return ".tar.bz2"; }
+ int BZip2File(const char* filename);
int RenameFile(const char* oldname, const char* newname);
};
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
index 75adb22d8a..bf2d8accbb 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ b/Source/CPack/cmCPackTarCompressGenerator.h
@@ -39,7 +39,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "tar.Z"; }
+ virtual const char* GetOutputExtension() { return ".tar.Z"; }
int RenameFile(const char* oldname, const char* newname);
int GenerateHeader(std::ostream* os);
diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h
index 640ef24949..87003607a4 100644
--- a/Source/CPack/cmCPackZIPGenerator.h
+++ b/Source/CPack/cmCPackZIPGenerator.h
@@ -48,7 +48,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "zip"; }
+ virtual const char* GetOutputExtension() { return ".zip"; }
int ZipStyle;
};
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index fc64034d27..f993bbe966 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -17,7 +17,7 @@
=========================================================================*/
#include "cmGlobalKdevelopGenerator.h"
-#include "cmLocalKdevelopGenerator.h"
+#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmake.h"
#include "cmSourceFile.h"
@@ -36,7 +36,8 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalKdevelopGenerator::CreateLocalGenerator()
{
- cmLocalGenerator *lg = new cmLocalKdevelopGenerator;
+ cmLocalUnixMakefileGenerator3 *lg = new cmLocalUnixMakefileGenerator3;
+ lg->SetForceVerboseMakefiles(true);
lg->SetGlobalGenerator(this);
return lg;
}
@@ -185,6 +186,7 @@ bool cmGlobalKdevelopGenerator
hname += *ext;
if(cmSystemTools::FileExists(hname.c_str()))
{
+ cmSystemTools::ReplaceString(hname, projectDir.c_str(), "");
files.insert(hname);
break;
}
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 1bb5beb820..97ec2dfe5b 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -208,8 +208,9 @@ cmInstallTargetGenerator
std::string targetNameSO;
std::string targetNameReal;
std::string targetNameImport;
+ std::string targetNamePDB;
target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, i->c_str());
+ targetNameImport, targetNamePDB, i->c_str());
if(this->ImportLibrary)
{
// Use the import library name.
@@ -245,8 +246,10 @@ std::string cmInstallTargetGenerator::GetScriptReference(cmTarget* target,
std::string targetNameSO;
std::string targetNameReal;
std::string targetNameImport;
+ std::string targetNamePDB;
target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
- targetNameImport, this->ConfigurationName);
+ targetNameImport, targetNamePDB,
+ this->ConfigurationName);
if(this->ImportLibrary)
{
// Use the import library name.
diff --git a/Source/cmLocalKdevelopGenerator.cxx b/Source/cmLocalKdevelopGenerator.cxx
deleted file mode 100644
index db3fb4177b..0000000000
--- a/Source/cmLocalKdevelopGenerator.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
- Program: CMake - Cross-Platform Makefile Generator
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
- Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
- Copyright (c) 2004 Alexander Neundorf, neundorf@kde.org. All rights reserved.
- See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-#include "cmGlobalGenerator.h"
-#include "cmLocalKdevelopGenerator.h"
-#include "cmMakefile.h"
-#include "cmSystemTools.h"
-#include "cmSourceFile.h"
-#include "cmCacheManager.h"
-#include "cmGeneratedFileStream.h"
-#include "cmake.h"
-#include <cmsys/RegularExpression.hxx>
-
-
-cmLocalKdevelopGenerator::cmLocalKdevelopGenerator()
- :cmLocalUnixMakefileGenerator3()
-{
- // KDevelop can itself shorten the output, so it should
- // always get the full output, otherwise the "full output"
- // option in kdevelop doesn't make much sense, Alex
- this->ForceVerboseMakefiles=true;
-}
-
-cmLocalKdevelopGenerator::~cmLocalKdevelopGenerator()
-{
-}
-
diff --git a/Source/cmLocalKdevelopGenerator.h b/Source/cmLocalKdevelopGenerator.h
deleted file mode 100644
index a47b435fb9..0000000000
--- a/Source/cmLocalKdevelopGenerator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*=========================================================================
-
- Program: CMake - Cross-Platform Makefile Generator
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
- Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
- Copyright (c) 2004 Alexander Neundorf, neundorf@kde.org. All rights reserved.
- See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-#ifndef cmLocalKdevelopGenerator_h
-#define cmLocalKdevelopGenerator_h
-
-#include "cmLocalUnixMakefileGenerator3.h"
-
-class cmDependInformation;
-class cmMakeDepend;
-class cmTarget;
-class cmSourceFile;
-
-/** \class cmLocalKdevelopGenerator
- */
-class cmLocalKdevelopGenerator : public cmLocalUnixMakefileGenerator3
-{
-public:
- ///! Set cache only and recurse to false by default.
- cmLocalKdevelopGenerator();
-
- virtual ~cmLocalKdevelopGenerator();
-
-};
-
-#endif
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8f2051f7ef..715f06daab 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1690,8 +1690,9 @@ cmLocalUnixMakefileGenerator3
objectName = cmSystemTools::GetFilenameName(objectName.c_str());
std::string targetName;
std::string targetNameReal;
+ std::string targetNamePDB;
target.GetExecutableNames(targetName, targetNameReal,
- this->ConfigurationName.c_str());
+ targetNamePDB, this->ConfigurationName.c_str());
if ( target.GetPropertyAsBool("MACOSX_BUNDLE") )
{
// Construct the full path version of the names.
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 5864669913..a2285bb776 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -16,14 +16,19 @@
=========================================================================*/
#include "cmGlobalVisualStudio7Generator.h"
#include "cmLocalVisualStudio7Generator.h"
+#include "cmXMLParser.h"
+#include <cm_expat.h>
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmSourceFile.h"
#include "cmCacheManager.h"
#include "cmake.h"
+#include <cmsys/System.h>
+
#include <ctype.h> // for isspace
+//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator()
{
this->Version = 7;
@@ -286,6 +291,17 @@ struct cmVS7FlagTable
const char* commandFlag; // command line flag
const char* comment; // comment
const char* value; // string value
+ unsigned int special; // flags for special handling requests
+ enum
+ {
+ UserValue = (1<<0), // flag contains a user-specified value
+ UserIgnored = (1<<1), // ignore any user value
+ UserRequired = (1<<2), // match only when user value is non-empty
+ Continue = (1<<3), // continue looking for matching entries
+
+ UserValueIgnored = UserValue | UserIgnored,
+ UserValueRequired = UserValue | UserRequired
+ };
};
// fill the table here currently the comment field is not used for
@@ -294,105 +310,171 @@ struct cmVS7FlagTable
cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
{
// option flags (some flags map to the same option)
- {"BasicRuntimeChecks", "GZ", "Stack frame checks", "1"},
- {"BasicRuntimeChecks", "RTCsu", "Both stack and uninitialized checks", "3"},
- {"BasicRuntimeChecks", "RTCs", "Stack frame checks", "1"},
- {"BasicRuntimeChecks", "RTCu", "Uninitialized Variables ", "2"},
- {"BasicRuntimeChecks", "RTC1", "Both stack and uninitialized checks ", "3"},
- {"DebugInformationFormat", "Z7", "debug format", "1"},
- {"DebugInformationFormat", "Zd", "debug format", "2"},
- {"DebugInformationFormat", "Zi", "debug format", "3"},
- {"DebugInformationFormat", "ZI", "debug format", "4"},
- {"EnableEnhancedInstructionSet", "arch:SSE2", "Use sse2 instructions", "2"},
- {"EnableEnhancedInstructionSet", "arch:SSE", "Use sse instructions", "1"},
- {"FavorSizeOrSpeed", "Ot", "Favor fast code", "1"},
- {"FavorSizeOrSpeed", "Os", "Favor small code", "2"},
- {"CompileAs", "TC", "Compile as c code", "1"},
- {"CompileAs", "TP", "Compile as c++ code", "2"},
- {"Optimization", "Od", "Non Debug", "0"},
- {"Optimization", "O1", "Min Size", "1"},
- {"Optimization", "O2", "Max Speed", "2"},
- {"Optimization", "Ox", "Max Optimization", "3"},
- {"OptimizeForProcessor", "GB", "Blended processor mode", "0"},
- {"OptimizeForProcessor", "G5", "Pentium", "1"},
- {"OptimizeForProcessor", "G6", "PPro PII PIII", "2"},
- {"OptimizeForProcessor", "G7", "Pentium 4 or Athlon", "3"},
- {"InlineFunctionExpansion", "Ob0", "no inlines", "0"},
- {"InlineFunctionExpansion", "Ob1", "when inline keyword", "1"},
- {"InlineFunctionExpansion", "Ob2", "any time you can inline", "2"},
- {"RuntimeLibrary", "MTd", "Multithreded debug", "1"},
- {"RuntimeLibrary", "MT", "Multithreded", "0"},
- {"RuntimeLibrary", "MDd", "Multithreded dll debug", "3"},
- {"RuntimeLibrary", "MD", "Multithreded dll", "2"},
- {"RuntimeLibrary", "MLd", "Sinble Thread debug", "5"},
- {"RuntimeLibrary", "ML", "Sinble Thread", "4"},
- {"StructMemberAlignment", "Zp16", "struct align 16 byte ", "5"},
- {"StructMemberAlignment", "Zp1", "struct align 1 byte ", "1"},
- {"StructMemberAlignment", "Zp2", "struct align 2 byte ", "2"},
- {"StructMemberAlignment", "Zp4", "struct align 4 byte ", "3"},
- {"StructMemberAlignment", "Zp8", "struct align 8 byte ", "4"},
- {"WarningLevel", "W1", "Warning level", "1"},
- {"WarningLevel", "W2", "Warning level", "2"},
- {"WarningLevel", "W3", "Warning level", "3"},
- {"WarningLevel", "W4", "Warning level", "4"},
+ {"BasicRuntimeChecks", "GZ", "Stack frame checks", "1", 0},
+ {"BasicRuntimeChecks", "RTCsu",
+ "Both stack and uninitialized checks", "3", 0},
+ {"BasicRuntimeChecks", "RTCs", "Stack frame checks", "1", 0},
+ {"BasicRuntimeChecks", "RTCu", "Uninitialized Variables ", "2", 0},
+ {"BasicRuntimeChecks", "RTC1",
+ "Both stack and uninitialized checks", "3", 0},
+ {"DebugInformationFormat", "Z7", "debug format", "1", 0},
+ {"DebugInformationFormat", "Zd", "debug format", "2", 0},
+ {"DebugInformationFormat", "Zi", "debug format", "3", 0},
+ {"DebugInformationFormat", "ZI", "debug format", "4", 0},
+ {"EnableEnhancedInstructionSet", "arch:SSE2",
+ "Use sse2 instructions", "2", 0},
+ {"EnableEnhancedInstructionSet", "arch:SSE",
+ "Use sse instructions", "1", 0},
+ {"FavorSizeOrSpeed", "Ot", "Favor fast code", "1", 0},
+ {"FavorSizeOrSpeed", "Os", "Favor small code", "2", 0},
+ {"CompileAs", "TC", "Compile as c code", "1", 0},
+ {"CompileAs", "TP", "Compile as c++ code", "2", 0},
+ {"Optimization", "Od", "Non Debug", "0", 0},
+ {"Optimization", "O1", "Min Size", "1", 0},
+ {"Optimization", "O2", "Max Speed", "2", 0},
+ {"Optimization", "Ox", "Max Optimization", "3", 0},
+ {"OptimizeForProcessor", "GB", "Blended processor mode", "0", 0},
+ {"OptimizeForProcessor", "G5", "Pentium", "1", 0},
+ {"OptimizeForProcessor", "G6", "PPro PII PIII", "2", 0},
+ {"OptimizeForProcessor", "G7", "Pentium 4 or Athlon", "3", 0},
+ {"InlineFunctionExpansion", "Ob0", "no inlines", "0", 0},
+ {"InlineFunctionExpansion", "Ob1", "when inline keyword", "1", 0},
+ {"InlineFunctionExpansion", "Ob2", "any time you can inline", "2", 0},
+ {"RuntimeLibrary", "MTd", "Multithreded debug", "1", 0},
+ {"RuntimeLibrary", "MT", "Multithreded", "0", 0},
+ {"RuntimeLibrary", "MDd", "Multithreded dll debug", "3", 0},
+ {"RuntimeLibrary", "MD", "Multithreded dll", "2", 0},
+ {"RuntimeLibrary", "MLd", "Sinble Thread debug", "5", 0},
+ {"RuntimeLibrary", "ML", "Sinble Thread", "4", 0},
+ {"StructMemberAlignment", "Zp16", "struct align 16 byte ", "5", 0},
+ {"StructMemberAlignment", "Zp1", "struct align 1 byte ", "1", 0},
+ {"StructMemberAlignment", "Zp2", "struct align 2 byte ", "2", 0},
+ {"StructMemberAlignment", "Zp4", "struct align 4 byte ", "3", 0},
+ {"StructMemberAlignment", "Zp8", "struct align 8 byte ", "4", 0},
+ {"WarningLevel", "W1", "Warning level", "1", 0},
+ {"WarningLevel", "W2", "Warning level", "2", 0},
+ {"WarningLevel", "W3", "Warning level", "3", 0},
+ {"WarningLevel", "W4", "Warning level", "4", 0},
+
+ // Precompiled header and related options. Note that the
+ // UsePrecompiledHeader entries are marked as "Continue" so that the
+ // corresponding PrecompiledHeaderThrough entry can be found.
+ {"UsePrecompiledHeader", "Yc", "Create Precompiled Header", "1",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+ {"PrecompiledHeaderThrough", "Yc", "Precompiled Header Name", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"UsePrecompiledHeader", "YX", "Automatically Generate", "2",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+ {"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+ {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
+ cmVS7FlagTable::UserValueRequired},
+ {"PrecompiledHeaderFile", "Fp", "Generated Precompiled Header", "",
+ cmVS7FlagTable::UserValue},
+ {"ForcedIncludeFiles", "FI", "Forced include files", "",
+ cmVS7FlagTable::UserValueRequired},
// boolean flags
- {"BufferSecurityCheck", "GS", "Buffer security check", "TRUE"},
- {"EnableFibreSafeOptimization", "GT", "OmitFramePointers", "TRUE"},
- {"EnableFunctionLevelLinking", "Gy", "EnableFunctionLevelLinking", "TRUE"},
- {"EnableIntrinsicFunctions", "Oi", "EnableIntrinsicFunctions", "TRUE"},
- {"ExceptionHandling", "EHsc", "enable c++ exceptions", "TRUE"},
- {"ExceptionHandling", "EHa", "enable c++ exceptions", "2"},
- {"ExceptionHandling", "GX", "enable c++ exceptions", "TRUE"},
- {"GlobalOptimizations", "Og", "Global Optimize", "TRUE"},
+ {"BufferSecurityCheck", "GS", "Buffer security check", "TRUE", 0},
+ {"EnableFibreSafeOptimization", "GT", "OmitFramePointers", "TRUE", 0},
+ {"EnableFunctionLevelLinking", "Gy",
+ "EnableFunctionLevelLinking", "TRUE", 0},
+ {"EnableIntrinsicFunctions", "Oi", "EnableIntrinsicFunctions", "TRUE", 0},
+ {"ExceptionHandling", "EHsc", "enable c++ exceptions", "TRUE", 0},
+ {"ExceptionHandling", "EHa", "enable c++ exceptions", "2", 0},
+ {"ExceptionHandling", "GX", "enable c++ exceptions", "TRUE", 0},
+ {"GlobalOptimizations", "Og", "Global Optimize", "TRUE", 0},
{"ImproveFloatingPointConsistency", "Op",
- "ImproveFloatingPointConsistency", "TRUE"},
- {"MinimalRebuild", "Gm", "minimal rebuild", "TRUE"},
- {"OmitFramePointers", "Oy", "OmitFramePointers", "TRUE"},
- {"OptimizeForWindowsApplication", "GA", "Optimize for windows", "TRUE"},
+ "ImproveFloatingPointConsistency", "TRUE", 0},
+ {"MinimalRebuild", "Gm", "minimal rebuild", "TRUE", 0},
+ {"OmitFramePointers", "Oy", "OmitFramePointers", "TRUE", 0},
+ {"OptimizeForWindowsApplication", "GA", "Optimize for windows", "TRUE", 0},
{"RuntimeTypeInfo", "GR",
- "Turn on Run time type information for c++", "TRUE"},
- {"SmallerTypeCheck", "RTCc", "smaller type check", "TRUE"},
- {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "TRUE"},
- {"WarnAsError", "WX", "Treat warnings as errors", "TRUE"},
- {0,0,0,0 }
+ "Turn on Run time type information for c++", "TRUE", 0},
+ {"SmallerTypeCheck", "RTCc", "smaller type check", "TRUE", 0},
+ {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "TRUE", 0},
+ {"WarnAsError", "WX", "Treat warnings as errors", "TRUE", 0},
+ {0,0,0,0,0}
};
-
cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{
// option flags (some flags map to the same option)
- {"GenerateManifest", "MANIFEST:NO", "disable manifest generation", "FALSE"},
- {"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE"},
- {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1"},
- {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2"},
- {0,0,0,0 }
+ {"GenerateManifest", "MANIFEST:NO",
+ "disable manifest generation", "FALSE", 0},
+ {"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE", 0},
+ {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1", 0},
+ {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2", 0},
+ {"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "default libs to ignore", "",
+ cmVS7FlagTable::UserValue},
+ {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs",
+ "TRUE", 0},
+ {0,0,0,0,0}
};
+//----------------------------------------------------------------------------
+class cmLocalVisualStudio7GeneratorOptions
+{
+public:
+ // Construct an options table for a given tool.
+ enum Tool
+ {
+ Compiler,
+ Linker
+ };
+ cmLocalVisualStudio7GeneratorOptions(Tool tool);
+
+ // Store options from command line flags.
+ void Parse(const char* flags);
+
+ // Store options for verbose builds.
+ void SetVerboseMakefile(bool verbose);
+
+ // Store definitions and flags.
+ void AddDefine(const std::string& define);
+ void AddFlag(const char* flag, const char* value);
+
+ // Check for specific options.
+ bool UsingUnicode();
+ bool UsingDebugPDB();
+
+ // Write options to output.
+ void OutputPreprocessorDefinitions(std::ostream& fout,
+ const char* prefix,
+ const char* suffix);
+ void OutputFlagMap(std::ostream& fout, const char* indent);
+ void OutputAdditionalOptions(std::ostream& fout,
+ const char* prefix,
+ const char* suffix);
+
+private:
+ // create a map of xml tags to the values they should have in the output
+ // for example, "BufferSecurityCheck" = "TRUE"
+ // first fill this table with the values for the configuration
+ // Debug, Release, etc,
+ // Then parse the command line flags specified in CMAKE_CXX_FLAGS
+ // and CMAKE_C_FLAGS
+ // and overwrite or add new values to this map
+ std::map<cmStdString, cmStdString> FlagMap;
+ // Preprocessor definitions.
+ std::vector<cmStdString> Defines;
+ // Unrecognized flags that get no special handling.
+ cmStdString FlagString;
-
-
-
+ bool DoingDefine;
+ cmVS7FlagTable const* FlagTable;
+ void HandleFlag(const char* flag);
+};
void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
const char* configName,
const char *libName,
cmTarget &target)
{
- // create a map of xml tags to the values they should have in the output
- // for example, "BufferSecurityCheck" = "TRUE"
- // first fill this table with the values for the configuration
- // Debug, Release, etc,
- // Then parse the command line flags specified in CMAKE_CXX_FLAGS
- // and CMAKE_C_FLAGS
- // and overwrite or add new values to this map
- std::map<cmStdString, cmStdString> flagMap;
- // since the default is on for this, but if /EHsc is found
- // in the flags it will be turned on and we have /EHSC on by
- // default in the CXX flags, then this is the only way to turn this off
- flagMap["ExceptionHandling"] = "FALSE";
const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if(!mfcFlag)
{
@@ -467,6 +549,51 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
flags += targetFlags;
}
+ // Get preprocessor definitions for this directory.
+ std::string defineFlags = this->Makefile->GetDefineFlags();
+
+ // Construct a set of build options for this target.
+ Options targetOptions(Options::Compiler);
+ targetOptions.Parse(flags.c_str());
+ targetOptions.Parse(defineFlags.c_str());
+ targetOptions.SetVerboseMakefile(
+ this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
+
+ // Add a definition for the configuration name.
+ std::string configDefine = "CMAKE_INTDIR=\\\"";
+ configDefine += configName;
+ configDefine += "\\\"";
+ targetOptions.AddDefine(configDefine);
+
+ // Add a definition for the export macro.
+ if(target.GetType() == cmTarget::SHARED_LIBRARY ||
+ target.GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ std::string exportSymbol;
+ if(const char* custom_export_name = target.GetProperty("DEFINE_SYMBOL"))
+ {
+ exportSymbol = custom_export_name;
+ }
+ else
+ {
+ std::string id = libName;
+ id += "_EXPORTS";
+ exportSymbol = cmSystemTools::MakeCindentifier(id.c_str());
+ }
+ targetOptions.AddDefine(exportSymbol);
+ }
+
+ // Override the flag map with cmake-specific settings.
+ if(this->Makefile->IsOn("CMAKE_CXX_USE_RTTI"))
+ {
+ targetOptions.AddFlag("RuntimeTypeInfo", "TRUE");
+ }
+ if(const char* warningLevel =
+ this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL"))
+ {
+ targetOptions.AddFlag("WarningLevel", warningLevel);
+ }
+
// The intermediate directory name consists of a directory for the
// target and a subdirectory for the configuration name.
std::string intermediateDir = this->GetTargetDirectory(target);
@@ -478,12 +605,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
<< "\t\t\tConfigurationType=\"" << configType << "\"\n"
<< "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n"
<< "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n";
- // if -D_UNICODE or /D_UNICODE is found in the flags
- // change the character set to unicode, if not then
- // default to MBCS
- std::string defs = this->Makefile->GetDefineFlags();
- if(flags.find("D_UNICODE") != flags.npos ||
- defs.find("D_UNICODE") != flags.npos)
+
+ // If unicode is enabled change the character set to unicode, if not
+ // then default to MBCS.
+ if(targetOptions.UsingUnicode())
{
fout << "\t\t\tCharacterSet=\"1\">\n";
}
@@ -493,25 +618,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
}
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCCLCompilerTool\"\n"
- << "\t\t\t\tAdditionalOptions=\"";
- // now fill the flagMap from the command line flags, and
- // if a flag is used, it will be removed from the flags string by
- // this function call
- this->FillFlagMapFromCommandFlags
- (flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], flags);
- std::string defineFlags = this->Makefile->GetDefineFlags();
-
- // now check the define flags for flags other than -D and
- // put them in the map, the -D flags will be left in the defineFlags
- // variable as -D is not in the flagMap
- this->FillFlagMapFromCommandFlags
- (flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], defineFlags);
-
- // output remaining flags that were not mapped to anything
- fout << this->EscapeForXML(flags.c_str()).c_str();
- fout << " -DCMAKE_INTDIR=\\&quot;" << configName << "\\&quot;"
- << "\"\n";
+ << "\t\t\t\tName=\"VCCLCompilerTool\"\n";
+ targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
std::vector<std::string> includes;
this->GetIncludeDirectories(includes);
@@ -522,52 +630,26 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
fout << ipath << ";";
}
fout << "\"\n";
- // set a few cmake specific flags
- if(this->Makefile->IsOn("CMAKE_CXX_USE_RTTI"))
- {
- flagMap["RuntimeTypeInfo"] = "TRUE";
- }
- if ( this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") )
- {
- flagMap["WarningLevel"] =
- this->Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL");
- }
-
- // Now copy the flag map into the xml for the file
- for(std::map<cmStdString, cmStdString>::iterator m = flagMap.begin();
- m != flagMap.end(); ++m)
- {
- fout << "\t\t\t\t" << m->first << "=\"" << m->second << "\"\n";
- }
- fout << "\t\t\t\tPreprocessorDefinitions=\"";
- if(target.GetType() == cmTarget::SHARED_LIBRARY
- || target.GetType() == cmTarget::MODULE_LIBRARY)
+ targetOptions.OutputFlagMap(fout, "\t\t\t\t");
+ targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n");
+ fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
+ fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
+ if(targetOptions.UsingDebugPDB())
{
- std::string exportSymbol;
- if (const char* custom_export_name =
- target.GetProperty("DEFINE_SYMBOL"))
+ if(target.GetType() == cmTarget::EXECUTABLE)
{
- exportSymbol = custom_export_name;
+ fout << "\t\t\t\tProgramDataBaseFileName=\""
+ << this->ExecutableOutputPath
+ << "$(OutDir)/" << target.GetPDBName(configName) << "\"\n";
}
- else
+ else if(target.GetType() == cmTarget::STATIC_LIBRARY ||
+ target.GetType() == cmTarget::SHARED_LIBRARY ||
+ target.GetType() == cmTarget::MODULE_LIBRARY)
{
- std::string id = libName;
- id += "_EXPORTS";
- exportSymbol = cmSystemTools::MakeCindentifier(id.c_str());
- }
- fout << "," << exportSymbol;
- }
- this->OutputDefineFlags(defineFlags.c_str(), fout);
- fout << "\"\n";
- fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
- fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
- std::map<cmStdString, cmStdString>::iterator mi =
- flagMap.find("DebugInformationFormat");
- if(mi != flagMap.end() && mi->second != "1")
- {
fout << "\t\t\t\tProgramDataBaseFileName=\""
<< this->LibraryOutputPath
- << "$(OutDir)/" << libName << ".pdb\"\n";
+ << "$(OutDir)/" << target.GetPDBName(configName) << "\"\n";
+ }
}
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"/>\n";
@@ -579,15 +661,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
fout << ipath << ";";
}
// add the -D flags to the RC tool
- fout << "\"\n"
- << "\t\t\t\tPreprocessorDefinitions=\"";
- this->OutputDefineFlags(defineFlags.c_str(), fout);
- fout << "\" />\n";
+ fout << "\"";
+ targetOptions.OutputPreprocessorDefinitions(fout, "\n\t\t\t\t", "");
+ fout << "/>\n";
fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n";
- fout << "\t\t\t\tPreprocessorDefinitions=\"";
- this->OutputDefineFlags(defineFlags.c_str(), fout);
- fout << "\"\n";
+ targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n";
if( this->PlatformName == "x64" )
{
@@ -622,56 +701,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
}
this->OutputTargetRules(fout, target, libName);
- this->OutputBuildTool(fout, configName, libName, target);
+ this->OutputBuildTool(fout, configName, target);
fout << "\t\t</Configuration>\n";
}
-void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags(
- std::map<cmStdString, cmStdString>& flagMap,
- cmVS7FlagTable* flagTable,
- std::string& flags)
-{
- std::string replace;
- std::string option;
- while(flagTable->IDEName)
- {
- option.reserve(strlen(flagTable->commandFlag)+2);
- // first do the - version
- option = "-";
- option += flagTable->commandFlag;
- while(flags.find(option) != flags.npos)
- {
- // replace the flag
- cmSystemTools::ReplaceString(flags, option.c_str(), "");
- // now put value into flag map
- flagMap[flagTable->IDEName] = flagTable->value;
- }
- // now do the / version
- option[0] = '/';
- while(flags.find(option) != flags.npos)
- {
- // replace the flag
- cmSystemTools::ReplaceString(flags, option.c_str(), "");
- // now put value into flag map
- flagMap[flagTable->IDEName] = flagTable->value;
- }
- // move to next flag
- flagTable++;
- }
-
- // If verbose makefiles have been requested and the /nologo option
- // was not given explicitly in the flags we want to add an attribute
- // to the generated project to disable logo suppression. Otherwise
- // the GUI default is to enable suppression.
- if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
- {
- if(flagMap.find("SuppressStartupBanner") == flagMap.end())
- {
- flagMap["SuppressStartupBanner"] = "FALSE";
- }
- }
-}
-
//----------------------------------------------------------------------------
std::string
cmLocalVisualStudio7Generator
@@ -690,10 +723,8 @@ cmLocalVisualStudio7Generator
void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
const char* configName,
- const char *libName,
cmTarget &target)
{
- std::string targetFullName = target.GetFullName(configName);
std::string temp;
std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE)
@@ -733,17 +764,15 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
extraLinkOptions += " ";
extraLinkOptions += targetLinkFlags;
}
- std::map<cmStdString, cmStdString> flagMap;
- this->FillFlagMapFromCommandFlags
- (flagMap, &cmLocalVisualStudio7GeneratorLinkFlagTable[0],
- extraLinkOptions);
-
+ Options linkOptions(Options::Linker);
+ linkOptions.Parse(extraLinkOptions.c_str());
switch(target.GetType())
{
case cmTarget::STATIC_LIBRARY:
{
+ std::string targetNameFull = target.GetFullName(configName);
std::string libpath = this->LibraryOutputPath +
- "$(OutDir)/" + targetFullName;
+ "$(OutDir)/" + targetNameFull;
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLibrarianTool\"\n";
if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
@@ -757,6 +786,25 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
{
+ std::string targetName;
+ std::string targetNameSO;
+ std::string targetNameFull;
+ std::string targetNameImport;
+ std::string targetNamePDB;
+ target.GetLibraryNames(targetName, targetNameSO, targetNameFull,
+ targetNameImport, targetNamePDB, configName);
+
+ // VS does not distinguish between shared libraries and module
+ // libraries so it still wants to be given the name of an import
+ // library for modules.
+ if(targetNameImport.empty() &&
+ target.GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ targetNameImport =
+ cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
+ targetNameImport += ".lib";
+ }
+
// Compute the link library and directory information.
std::vector<cmStdString> linkLibs;
std::vector<cmStdString> linkDirs;
@@ -780,17 +828,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
standardLibsVar += "_STANDARD_LIBRARIES";
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCLinkerTool\"\n"
- << "\t\t\t\tAdditionalOptions=\"/MACHINE:I386";
- if(extraLinkOptions.size())
- {
- fout << " " << cmLocalVisualStudio7Generator::EscapeForXML(
- extraLinkOptions.c_str()).c_str();
- }
+ << "\t\t\t\tName=\"VCLinkerTool\"\n";
+ linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
- fout << "\"\n"
- << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) "
+ fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) "
<< this->Makefile->GetSafeDefinition(standardLibsVar.c_str())
<< " ";
this->OutputLibraries(fout, linkLibs);
@@ -798,23 +840,18 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp = this->LibraryOutputPath;
temp += configName;
temp += "/";
- temp += targetFullName;
+ temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
- for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin();
- i != flagMap.end(); ++i)
- {
- fout << "\t\t\t\t" << i->first << "=\"" << i->second << "\"\n";
- }
+ linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, linkDirs);
fout << "\"\n";
this->OutputModuleDefinitionFile(fout, target);
temp = this->LibraryOutputPath;
temp += "$(OutDir)/";
- temp += libName;
- temp += ".pdb";
+ temp += targetNamePDB;
fout << "\t\t\t\tProgramDataBaseFile=\"" <<
this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
if(strcmp(configName, "Debug") == 0
@@ -833,15 +870,19 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp = this->LibraryOutputPath;
temp += configName;
temp += "/";
- temp +=
- cmSystemTools::GetFilenameWithoutLastExtension(targetFullName.c_str());
- temp += ".lib";
+ temp += targetNameImport;
fout << "\t\t\t\tImportLibrary=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
}
break;
case cmTarget::EXECUTABLE:
{
+ std::string targetName;
+ std::string targetNameFull;
+ std::string targetNamePDB;
+ target.GetExecutableNames(targetName, targetNameFull,
+ targetNamePDB, configName);
+
// Compute the link library and directory information.
std::vector<cmStdString> linkLibs;
std::vector<cmStdString> linkDirs;
@@ -865,17 +906,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
standardLibsVar += "_STANDARD_LIBRARIES";
fout << "\t\t\t<Tool\n"
- << "\t\t\t\tName=\"VCLinkerTool\"\n"
- << "\t\t\t\tAdditionalOptions=\"";
- if(extraLinkOptions.size())
- {
- fout << " " << cmLocalVisualStudio7Generator::EscapeForXML(
- extraLinkOptions.c_str()).c_str();
- }
+ << "\t\t\t\tName=\"VCLinkerTool\"\n";
+ linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
- fout << "\"\n"
- << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) "
+ fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) "
<< this->Makefile->GetSafeDefinition(standardLibsVar.c_str())
<< " ";
this->OutputLibraries(fout, linkLibs);
@@ -883,20 +918,16 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp = this->ExecutableOutputPath;
temp += configName;
temp += "/";
- temp += targetFullName;
+ temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, target);
- for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin();
- i != flagMap.end(); ++i)
- {
- fout << "\t\t\t\t" << i->first << "=\"" << i->second << "\"\n";
- }
+ linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, linkDirs);
fout << "\"\n";
- fout << "\t\t\t\tProgramDataBaseFile=\"" << this->LibraryOutputPath
- << "$(OutDir)\\" << libName << ".pdb\"\n";
+ fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ExecutableOutputPath
+ << "$(OutDir)\\" << targetNamePDB << "\"\n";
if(strcmp(configName, "Debug") == 0
|| strcmp(configName, "RelWithDebInfo") == 0)
{
@@ -1009,63 +1040,6 @@ cmLocalVisualStudio7Generator
}
}
-//----------------------------------------------------------------------------
-void cmLocalVisualStudio7Generator::OutputDefineFlags(const char* flags,
- std::ostream& fout)
-{
- std::string defs = flags;
- cmSystemTools::ReplaceString(defs, "/D","-D");
- std::string::size_type pos = defs.find("-D");
- bool done = pos == std::string::npos;
- if(!done)
- {
- fout << ",";
- }
- while(!done)
- {
- std::string::size_type nextpos = defs.find("-D", pos+2);
- std::string define;
- if(nextpos != std::string::npos)
- {
- define = defs.substr(pos+2, nextpos - pos -3);
- }
- else
- {
- define = defs.substr(pos+2);
- done = true;
- }
-
- // Remove trailing whitespace from the definition.
- while(!define.empty() && isspace(define[define.size()-1]))
- {
- define = define.substr(0, define.size()-1);
- }
-
- // Double-quotes in the value of the definition must be escaped
- // with a backslash. The entire definition should be quoted in
- // the generated xml attribute to avoid confusing the VS parser.
- define = this->EscapeForXML(define.c_str());
- // if the define has something in it that is not a letter or a number
- // then quote it
- if(define.
- find_first_not_of(
- "-_abcdefghigklmnopqrstuvwxyz1234567890ABCDEFGHIGKLMNOPQRSTUVWXYZ")
- != define.npos)
- {
- fout << "&quot;" << define << "&quot;,";
- }
- else
- {
- fout << define << ",";
- }
- if(!done)
- {
- pos = defs.find("-D", nextpos);
- }
- }
-}
-
-
void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
const char *libName,
cmTarget &target)
@@ -1264,28 +1238,14 @@ void cmLocalVisualStudio7Generator
fout << ">\n";
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n";
- if(compileFlags.size())
+ if(!compileFlags.empty())
{
- std::string compileFlagsCopy = compileFlags;
- std::map<cmStdString, cmStdString> fileFlagMap;
- this->FillFlagMapFromCommandFlags
- (fileFlagMap,
- &cmLocalVisualStudio7GeneratorFlagTable[0],
- compileFlagsCopy);
- if(compileFlagsCopy.size() &&
- compileFlagsCopy.find_first_not_of(" ")
- != compileFlagsCopy.npos)
- {
- fout << "\t\t\t\t\tAdditionalOptions=\""
- << this->EscapeForXML(compileFlagsCopy.c_str()) << "\"\n";
- }
- for(std::map<cmStdString,
- cmStdString>::iterator m = fileFlagMap.begin();
- m != fileFlagMap.end(); ++m)
- {
- fout << "\t\t\t\t\t" << m->first << "=\""
- << m->second << "\"\n";
- }
+ Options fileOptions(Options::Compiler);
+ fileOptions.Parse(compileFlags.c_str());
+ fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n");
+ fileOptions.OutputFlagMap(fout, "\t\t\t\t\t");
+ fileOptions.OutputPreprocessorDefinitions(fout,
+ "\t\t\t\t\t", "\n");
}
if(additionalDeps.length())
{
@@ -1571,8 +1531,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout)
<< "</VisualStudioProject>\n";
}
-
-std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
+std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s)
{
std::string ret = s;
cmSystemTools::ReplaceString(ret, "&", "&amp;");
@@ -1583,6 +1542,11 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
return ret;
}
+std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
+{
+ return cmLocalVisualStudio7GeneratorEscapeForXML(s);
+}
+
std::string cmLocalVisualStudio7Generator
::ConvertToXMLOutputPath(const char* path)
{
@@ -1605,6 +1569,84 @@ std::string cmLocalVisualStudio7Generator
return ret;
}
+
+// This class is used to parse an existing vs 7 project
+// and extract the GUID
+class cmVS7XMLParser : public cmXMLParser
+{
+public:
+ virtual void EndElement(const char* name)
+ {
+ }
+ virtual void StartElement(const char* name, const char** atts)
+ {
+ // once the GUID is found do nothing
+ if(this->GUID.size())
+ {
+ return;
+ }
+ int i =0;
+ if(strcmp("VisualStudioProject", name) == 0)
+ {
+ while(atts[i])
+ {
+ if(strcmp(atts[i], "ProjectGUID") == 0)
+ {
+ if(atts[i+1])
+ {
+ this->GUID = atts[i+1];
+ this->GUID = this->GUID.substr(1, this->GUID.size()-2);
+ }
+ else
+ {
+ this->GUID = "";
+ }
+ return;
+ }
+ ++i;
+ }
+ }
+ }
+ int InitializeParser()
+ {
+ int ret = cmXMLParser::InitializeParser();
+ if(ret == 0)
+ {
+ return ret;
+ }
+ // visual studio projects have a strange encoding, but it is
+ // really utf-8
+ XML_SetEncoding(static_cast<XML_Parser>(this->Parser), "utf-8");
+ return 1;
+ }
+ std::string GUID;
+};
+
+void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
+ const char* name,
+ const char* path)
+{
+ cmVS7XMLParser parser;
+ parser.ParseFile(path);
+ // if we can not find a GUID then create one
+ if(parser.GUID.size() == 0)
+ {
+ cmGlobalVisualStudio7Generator* gg =
+ static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
+ gg->CreateGUID(name);
+ return;
+ }
+ std::string guidStoreName = name;
+ guidStoreName += "_GUID_CMAKE";
+ // save the GUID in the cache
+ this->GlobalGenerator->GetCMakeInstance()->
+ AddCacheEntry(guidStoreName.c_str(),
+ parser.GUID.c_str(),
+ "Stored GUID",
+ cmCacheManager::INTERNAL);
+}
+
+
void cmLocalVisualStudio7Generator::ConfigureFinalPass()
{
cmLocalGenerator::ConfigureFinalPass();
@@ -1619,7 +1661,8 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass()
cmCustomCommand cc = l->second.GetPostBuildCommands()[0];
const cmCustomCommandLines& cmds = cc.GetCommandLines();
std::string project_name = cmds[0][0];
- gg->CreateGUID(project_name.c_str());
+ this->ReadAndStoreExternalGUID(project_name.c_str(),
+ cmds[0][1].c_str());
}
else
{
@@ -1638,3 +1681,263 @@ std::string cmLocalVisualStudio7Generator
dir += ".dir";
return dir;
}
+
+//----------------------------------------------------------------------------
+cmLocalVisualStudio7GeneratorOptions
+::cmLocalVisualStudio7GeneratorOptions(Tool tool):
+ DoingDefine(false), FlagTable(0)
+{
+ // Choose the flag table for the requested tool.
+ switch(tool)
+ {
+ case Compiler:
+ this->FlagTable = cmLocalVisualStudio7GeneratorFlagTable; break;
+ case Linker:
+ this->FlagTable = cmLocalVisualStudio7GeneratorLinkFlagTable; break;
+ default: break;
+ }
+
+ // Exception handling is on by default because the platform file has
+ // "/EHsc" in the flags. Normally, that will override this
+ // initialization to off, but the user has the option of removing
+ // the flag to disable exception handling. When the user does
+ // remove the flag we need to override the IDE default of on.
+ this->FlagMap["ExceptionHandling"] = "FALSE";
+}
+
+//----------------------------------------------------------------------------
+void cmLocalVisualStudio7GeneratorOptions::SetVerboseMakefile(bool verbose)
+{
+ // If verbose makefiles have been requested and the /nologo option
+ // was not given explicitly in the flags we want to add an attribute
+ // to the generated project to disable logo suppression. Otherwise
+ // the GUI default is to enable suppression.
+ if(verbose &&
+ this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end())
+ {
+ this->FlagMap["SuppressStartupBanner"] = "FALSE";
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalVisualStudio7GeneratorOptions::AddDefine(const std::string& def)
+{
+ this->Defines.push_back(def);
+}
+
+//----------------------------------------------------------------------------
+void cmLocalVisualStudio7GeneratorOptions::AddFlag(const char* flag,
+ const char* value)
+{
+ this->FlagMap[flag] = value;
+}
+
+//----------------------------------------------------------------------------
+bool cmLocalVisualStudio7GeneratorOptions::UsingUnicode()
+{
+ // Look for the a _UNICODE definition.
+ for(std::vector<cmStdString>::const_iterator di = this->Defines.begin();
+ di != this->Defines.end(); ++di)
+ {
+ if(*di == "_UNICODE")
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool cmLocalVisualStudio7GeneratorOptions::UsingDebugPDB()
+{
+ std::map<cmStdString, cmStdString>::iterator mi =
+ this->FlagMap.find("DebugInformationFormat");
+ if(mi != this->FlagMap.end() && mi->second != "1")
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalVisualStudio7GeneratorOptions::Parse(const char* flags)
+{
+ // Parse the input string as a windows command line since the string
+ // is intended for writing directly into the build files.
+ std::vector<std::string> args;
+ cmSystemTools::ParseWindowsCommandLine(flags, args);
+
+ // Process flags that need to be represented specially in the IDE
+ // project file.
+ for(std::vector<std::string>::iterator ai = args.begin();
+ ai != args.end(); ++ai)
+ {
+ this->HandleFlag(ai->c_str());
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalVisualStudio7GeneratorOptions::HandleFlag(const char* flag)
+{
+ // If the last option was -D then this option is the definition.
+ if(this->DoingDefine)
+ {
+ this->DoingDefine = false;
+ this->Defines.push_back(flag);
+ return;
+ }
+
+ // Look for known arguments.
+ if(flag[0] == '-' || flag[0] == '/')
+ {
+ if(flag[1] == 'D')
+ {
+ if(flag[2] == '\0')
+ {
+ // The next argument will have the definition.
+ this->DoingDefine = true;
+ }
+ else
+ {
+ // Store this definition.
+ this->Defines.push_back(flag+2);
+ }
+ return;
+ }
+ else if(this->FlagTable)
+ {
+ // Look for an entry in the flag table matching this flag.
+ bool flag_handled = false;
+ for(cmVS7FlagTable const* entry = this->FlagTable;
+ entry->IDEName; ++entry)
+ {
+ bool entry_found = false;
+ if(entry->special & cmVS7FlagTable::UserValue)
+ {
+ // This flag table entry accepts a user-specified value. If
+ // the entry specifies UserRequired we must match only if a
+ // non-empty value is given.
+ int n = static_cast<int>(strlen(entry->commandFlag));
+ if(strncmp(flag+1, entry->commandFlag, n) == 0 &&
+ (!(entry->special & cmVS7FlagTable::UserRequired) ||
+ static_cast<int>(strlen(flag+1)) > n))
+ {
+ if(entry->special & cmVS7FlagTable::UserIgnored)
+ {
+ // Ignore the user-specified value.
+ this->FlagMap[entry->IDEName] = entry->value;
+ }
+ else
+ {
+ // Use the user-specified value.
+ this->FlagMap[entry->IDEName] = flag+1+n;
+ }
+ entry_found = true;
+ }
+ }
+ else if(strcmp(flag+1, entry->commandFlag) == 0)
+ {
+ // This flag table entry provides a fixed value.
+ this->FlagMap[entry->IDEName] = entry->value;
+ entry_found = true;
+ }
+
+ // If the flag has been handled by an entry not requesting a
+ // search continuation we are done.
+ if(entry_found && !(entry->special & cmVS7FlagTable::Continue))
+ {
+ return;
+ }
+
+ // If the entry was found the flag has been handled.
+ flag_handled = flag_handled || entry_found;
+ }
+
+ // If any map entry handled the flag we are done.
+ if(flag_handled)
+ {
+ return;
+ }
+ }
+ }
+
+ // This option is not known. Store it in the output flags.
+ this->FlagString += " ";
+ this->FlagString +=
+ cmSystemTools::EscapeWindowsShellArgument(flag,
+ cmsysSystem_Shell_Flag_VSIDE);
+}
+
+//----------------------------------------------------------------------------
+void
+cmLocalVisualStudio7GeneratorOptions
+::OutputPreprocessorDefinitions(std::ostream& fout,
+ const char* prefix,
+ const char* suffix)
+{
+ if(this->Defines.empty())
+ {
+ return;
+ }
+
+ fout << prefix << "PreprocessorDefinitions=\"";
+ const char* comma = "";
+ for(std::vector<cmStdString>::const_iterator di = this->Defines.begin();
+ di != this->Defines.end(); ++di)
+ {
+ // Escape this flag for the IDE.
+ std::string define =
+ cmLocalVisualStudio7GeneratorEscapeForXML(di->c_str());
+
+ // Old comment:
+ // Double-quotes in the value of the definition must be escaped
+ // with a backslash. The entire definition should be quoted in
+ // the generated xml attribute to avoid confusing the VS parser.
+
+ // Write this flag. Quote it if the definition is not
+ // alphanumeric.
+ if(define.find_first_not_of(
+ "-_abcdefghigklmnopqrstuvwxyz1234567890ABCDEFGHIGKLMNOPQRSTUVWXYZ")
+ != define.npos)
+ {
+ fout << comma << "&quot;" << define << "&quot;";
+ }
+ else
+ {
+ fout << comma << define;
+ }
+ comma = ",";
+ }
+ fout << "\"" << suffix;
+}
+
+//----------------------------------------------------------------------------
+void
+cmLocalVisualStudio7GeneratorOptions
+::OutputFlagMap(std::ostream& fout, const char* indent)
+{
+ for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin();
+ m != this->FlagMap.end(); ++m)
+ {
+ fout << indent << m->first << "=\"" << m->second << "\"\n";
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+cmLocalVisualStudio7GeneratorOptions
+::OutputAdditionalOptions(std::ostream& fout,
+ const char* prefix,
+ const char* suffix)
+{
+ if(!this->FlagString.empty())
+ {
+ fout << prefix << "AdditionalOptions=\"";
+ fout <<
+ cmLocalVisualStudio7GeneratorEscapeForXML(this->FlagString.c_str());
+ fout << "\"" << suffix;
+ }
+}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 48dce0c275..1357727c19 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -26,6 +26,8 @@ class cmCustomCommand;
class cmSourceGroup;
struct cmVS7FlagTable;
+class cmLocalVisualStudio7GeneratorOptions;
+
/** \class cmLocalVisualStudio7Generator
* \brief Write Visual Studio .NET project files.
*
@@ -65,10 +67,9 @@ public:
void SetPlatformName(const char* n) { this->PlatformName = n;}
virtual void ConfigureFinalPass();
private:
- void FillFlagMapFromCommandFlags(std::map<cmStdString,
- cmStdString>& flagMap,
- cmVS7FlagTable* flagTable,
- std::string& flags);
+ typedef cmLocalVisualStudio7GeneratorOptions Options;
+ void ReadAndStoreExternalGUID(const char* name,
+ const char* path);
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
void FixGlobalTargets();
@@ -88,12 +89,10 @@ private:
std::string EscapeForXML(const char* s);
std::string ConvertToXMLOutputPath(const char* path);
std::string ConvertToXMLOutputPathSingle(const char* path);
- void OutputDefineFlags(const char* flags,
- std::ostream& fout);
void OutputTargetRules(std::ostream& fout, cmTarget &target,
const char *libName);
void OutputBuildTool(std::ostream& fout, const char* configName,
- const char* libname, cmTarget& t);
+ cmTarget& t);
void OutputLibraries(std::ostream& fout,
std::vector<cmStdString> const& libs);
void OutputLibraryDirectories(std::ostream& fout,
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index c4b1e994ab..9b273e8c76 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -152,7 +152,14 @@ cmLocalVisualStudioGenerator
// Start with the command name.
const cmCustomCommandLine& commandLine = *cl;
+ if(!workingDirectory)
+ {
script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
+ }
+ else
+ {
+ script += this->Convert(commandLine[0].c_str(),NONE,SHELL);
+ }
// Add the arguments.
for(unsigned int j=1;j < commandLine.size(); ++j)
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 7096dbf1a4..9f4c2db480 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -110,8 +110,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Get the name of the executable to generate.
std::string targetName;
std::string targetNameReal;
+ std::string targetNamePDB;
this->Target->GetExecutableNames
- (targetName, targetNameReal,
+ (targetName, targetNameReal, targetNamePDB,
this->LocalGenerator->ConfigurationName.c_str());
// Construct the full path version of the names.
@@ -187,8 +188,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
std::string targetFullPath = outpath + targetName;
std::string targetFullPathReal = outpath + targetNameReal;
- std::string targetFullPathPDB = outpath + this->Target->GetName();
- targetFullPathPDB += ".pdb";
+ std::string targetFullPathPDB = outpath + targetNamePDB;
std::string targetOutPathPDB =
this->Convert(targetFullPathPDB.c_str(),
cmLocalGenerator::FULL,
@@ -269,12 +269,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{
std::string cleanName;
std::string cleanRealName;
+ std::string cleanPDBName;
this->Target->GetExecutableCleanNames
- (cleanName, cleanRealName,
+ (cleanName, cleanRealName, cleanPDBName,
this->LocalGenerator->ConfigurationName.c_str());
std::string cleanFullName = outpath + cleanName;
std::string cleanFullRealName = outpath + cleanRealName;
+ std::string cleanFullPDBName = outpath + cleanPDBName;
exeCleanFiles.push_back(this->Convert(cleanFullName.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
@@ -291,6 +293,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
}
+
+ // List the PDB for cleaning only when the whole target is
+ // cleaned. We do not want to delete the .pdb file just before
+ // linking the target.
+ this->CleanFiles.push_back
+ (this->Convert(cleanFullPDBName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
}
// Add a command to remove any existing files for this executable.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 5bc030abca..0e6fce49d4 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -239,8 +239,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string targetNameSO;
std::string targetNameReal;
std::string targetNameImport;
+ std::string targetNamePDB;
this->Target->GetLibraryNames(
- targetName, targetNameSO, targetNameReal, targetNameImport,
+ targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
this->LocalGenerator->ConfigurationName.c_str());
// Construct the full path version of the names.
@@ -259,8 +260,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
outpath += "/";
}
std::string targetFullPath = outpath + targetName;
- std::string targetFullPathPDB =
- outpath + this->Target->GetName() + std::string(".pdb");
+ std::string targetFullPathPDB = outpath + targetNamePDB;
std::string targetFullPathSO = outpath + targetNameSO;
std::string targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathImport = outpath + targetNameImport;
@@ -351,18 +351,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string cleanSharedSOName;
std::string cleanSharedRealName;
std::string cleanImportName;
+ std::string cleanPDBName;
this->Target->GetLibraryCleanNames(
cleanStaticName,
cleanSharedName,
cleanSharedSOName,
cleanSharedRealName,
cleanImportName,
+ cleanPDBName,
this->LocalGenerator->ConfigurationName.c_str());
std::string cleanFullStaticName = outpath + cleanStaticName;
std::string cleanFullSharedName = outpath + cleanSharedName;
std::string cleanFullSharedSOName = outpath + cleanSharedSOName;
std::string cleanFullSharedRealName = outpath + cleanSharedRealName;
std::string cleanFullImportName = outpath + cleanImportName;
+ std::string cleanFullPDBName = outpath + cleanPDBName;
libCleanFiles.push_back
(this->Convert(cleanFullStaticName.c_str(),
cmLocalGenerator::START_OUTPUT,
@@ -398,6 +401,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
}
+
+ // List the PDB for cleaning only when the whole target is
+ // cleaned. We do not want to delete the .pdb file just before
+ // linking the target.
+ this->CleanFiles.push_back
+ (this->Convert(cleanFullPDBName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
}
#ifdef _WIN32
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 30824950ff..7d47fe2089 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -279,6 +279,15 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
*this->FlagFileStream << lang << "_FLAGS = " << flags << "\n\n";
}
+
+ // Add target-specific flags.
+ if(this->Target->GetProperty("COMPILE_FLAGS"))
+ {
+ std::string flags;
+ this->LocalGenerator->AppendFlags
+ (flags, this->Target->GetProperty("COMPILE_FLAGS"));
+ *this->FlagFileStream << "# TARGET_FLAGS = " << flags << "\n\n";
+ }
}
//----------------------------------------------------------------------------
@@ -457,15 +466,29 @@ cmMakefileTargetGenerator
this->Makefile->GetRequiredDefinition(compileRuleVar.c_str());
cmSystemTools::ExpandListArgument(compileRule, commands);
- std::string outpath = this->Makefile->GetStartOutputDirectory();
- outpath += "/";
- outpath += this->Target->GetName();
- outpath += ".pdb";
- outpath = this->Convert(outpath.c_str(), cmLocalGenerator::FULL,
+ std::string targetOutPathPDB;
+ {
+ std::string targetFullPathPDB;
+ const char* configName = this->LocalGenerator->ConfigurationName.c_str();
+ if(this->Target->GetType() == cmTarget::EXECUTABLE)
+ {
+ targetFullPathPDB = this->LocalGenerator->ExecutableOutputPath;
+ targetFullPathPDB += this->Target->GetPDBName(configName);
+ }
+ else if(this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
+ this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ targetFullPathPDB = this->LocalGenerator->LibraryOutputPath;
+ targetFullPathPDB += this->Target->GetPDBName(configName);
+ }
+ targetOutPathPDB =
+ this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::FULL,
cmLocalGenerator::MAKEFILE);
+ }
cmLocalGenerator::RuleVariables vars;
vars.Language = lang;
- vars.TargetPDB = outpath.c_str();
+ vars.TargetPDB = targetOutPathPDB.c_str();
vars.Source = sourceFile.c_str();
vars.Object = relativeObj.c_str();
std::string objdir = this->LocalGenerator->GetHomeRelativeOutputPath();
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 8746c7aa6e..beacba4e20 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -21,6 +21,7 @@
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Directory.hxx>
+#include <cmsys/System.h>
// support for realpath call
#ifndef _WIN32
@@ -370,6 +371,95 @@ bool cmSystemTools::IsOff(const char* val)
v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE");
}
+//----------------------------------------------------------------------------
+void cmSystemTools::ParseWindowsCommandLine(const char* command,
+ std::vector<std::string>& args)
+{
+ // See the MSDN document "Parsing C Command-Line Arguments" at
+ // http://msdn2.microsoft.com/en-us/library/a1y7w461.aspx for rules
+ // of parsing the windows command line.
+
+ bool in_argument = false;
+ bool in_quotes = false;
+ int backslashes = 0;
+ std::string arg;
+ for(const char* c = command;*c; ++c)
+ {
+ if(*c == '\\')
+ {
+ ++backslashes;
+ in_argument = true;
+ }
+ else if(*c == '"')
+ {
+ int backslash_pairs = backslashes >> 1;
+ int backslash_escaped = backslashes & 1;
+ arg.append(backslash_pairs, '\\');
+ backslashes = 0;
+ if(backslash_escaped)
+ {
+ /* An odd number of backslashes precede this quote.
+ It is escaped. */
+ arg.append(1, '"');
+ }
+ else
+ {
+ /* An even number of backslashes precede this quote.
+ It is not escaped. */
+ in_quotes = !in_quotes;
+ }
+ in_argument = true;
+ }
+ else
+ {
+ arg.append(backslashes, '\\');
+ backslashes = 0;
+ if(isspace(*c))
+ {
+ if(in_quotes)
+ {
+ arg.append(1, *c);
+ }
+ else if(in_argument)
+ {
+ args.push_back(arg);
+ arg = "";
+ in_argument = false;
+ }
+ }
+ else
+ {
+ in_argument = true;
+ arg.append(1, *c);
+ }
+ }
+ }
+ arg.append(backslashes, '\\');
+ if(in_argument)
+ {
+ args.push_back(arg);
+ }
+}
+
+std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg,
+ int shell_flags)
+{
+ char local_buffer[1024];
+ char* buffer = local_buffer;
+ int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags);
+ if(size > 1024)
+ {
+ buffer = new char[size];
+ }
+ cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags);
+ std::string result(buffer);
+ if(buffer != local_buffer)
+ {
+ delete [] buffer;
+ }
+ return result;
+}
+
std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command)
{
std::vector<cmStdString> args;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 4997bc3389..fc549b0aa0 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -212,6 +212,15 @@ public:
*/
static std::vector<cmStdString> ParseArguments(const char* command);
+ /** Parse arguments out of a windows command line string. */
+ static void ParseWindowsCommandLine(const char* command,
+ std::vector<std::string>& args);
+
+ /** Compute an escaped version of the given argument for use in a
+ windows shell. See kwsys/System.h.in for details. */
+ static std::string EscapeWindowsShellArgument(const char* arg,
+ int shell_flags);
+
static void EnableMessages() { s_DisableMessages = false; }
static void DisableMessages() { s_DisableMessages = true; }
static void DisableRunCommandOutput() {s_DisableRunCommandOutput = true; }
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1509c14727..39c540312e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1172,6 +1172,17 @@ const char* cmTarget::GetPrefixVariableInternal(TargetType type,
}
//----------------------------------------------------------------------------
+std::string cmTarget::GetPDBName(const char* config)
+{
+ std::string prefix;
+ std::string base;
+ std::string suffix;
+ this->GetFullNameInternal(this->GetType(), config, false,
+ prefix, base, suffix);
+ return prefix+base+".pdb";
+}
+
+//----------------------------------------------------------------------------
std::string cmTarget::GetFullName(const char* config, bool implib)
{
return this->GetFullNameInternal(this->GetType(), config, implib);
@@ -1337,10 +1348,11 @@ void cmTarget::GetLibraryNames(std::string& name,
std::string& soName,
std::string& realName,
std::string& impName,
+ std::string& pdbName,
const char* config)
{
// Get the names based on the real type of the library.
- this->GetLibraryNamesInternal(name, soName, realName, impName,
+ this->GetLibraryNamesInternal(name, soName, realName, impName, pdbName,
this->GetType(), config);
}
@@ -1349,6 +1361,7 @@ void cmTarget::GetLibraryCleanNames(std::string& staticName,
std::string& sharedSOName,
std::string& sharedRealName,
std::string& importName,
+ std::string& pdbName,
const char* config)
{
// Get the name as if this were a static library.
@@ -1356,7 +1369,7 @@ void cmTarget::GetLibraryCleanNames(std::string& staticName,
std::string realName;
std::string impName;
this->GetLibraryNamesInternal(staticName, soName, realName, impName,
- cmTarget::STATIC_LIBRARY, config);
+ pdbName, cmTarget::STATIC_LIBRARY, config);
// Get the names as if this were a shared library.
if(this->GetType() == cmTarget::STATIC_LIBRARY)
@@ -1367,14 +1380,15 @@ void cmTarget::GetLibraryCleanNames(std::string& staticName,
// type will never be MODULE. Either way the only names that
// might have to be cleaned are the shared library names.
this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
- importName, cmTarget::SHARED_LIBRARY,
- config);
+ importName, pdbName,
+ cmTarget::SHARED_LIBRARY, config);
}
else
{
// Use the name of the real type of the library (shared or module).
this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
- importName, this->GetType(), config);
+ importName, pdbName, this->GetType(),
+ config);
}
}
@@ -1382,6 +1396,7 @@ void cmTarget::GetLibraryNamesInternal(std::string& name,
std::string& soName,
std::string& realName,
std::string& impName,
+ std::string& pdbName,
TargetType type,
const char* config)
{
@@ -1468,27 +1483,34 @@ void cmTarget::GetLibraryNamesInternal(std::string& name,
{
impName = "";
}
+
+ // The program database file name.
+ pdbName = prefix+base+".pdb";
}
void cmTarget::GetExecutableNames(std::string& name,
std::string& realName,
+ std::string& pdbName,
const char* config)
{
// Get the names based on the real type of the executable.
- this->GetExecutableNamesInternal(name, realName, this->GetType(), config);
+ this->GetExecutableNamesInternal(name, realName, pdbName,
+ this->GetType(), config);
}
void cmTarget::GetExecutableCleanNames(std::string& name,
std::string& realName,
+ std::string& pdbName,
const char* config)
{
// Get the name and versioned name of this executable.
- this->GetExecutableNamesInternal(name, realName, cmTarget::EXECUTABLE,
- config);
+ this->GetExecutableNamesInternal(name, realName, pdbName,
+ cmTarget::EXECUTABLE, config);
}
void cmTarget::GetExecutableNamesInternal(std::string& name,
std::string& realName,
+ std::string& pdbName,
TargetType type,
const char* config)
{
@@ -1528,6 +1550,9 @@ void cmTarget::GetExecutableNamesInternal(std::string& name,
#if defined(__CYGWIN__)
realName += suffix;
#endif
+
+ // The program database file name.
+ pdbName = prefix+base+".pdb";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0dd645d802..63fbecf9cb 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -201,6 +201,9 @@ public:
std::string& base, std::string& suffix,
const char* config=0, bool implib = false);
+ /** Get the name of the pdb file for the target. */
+ std::string GetPDBName(const char* config=0);
+
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
std::string GetFullPath(const char* config=0, bool implib = false);
@@ -210,7 +213,7 @@ public:
should be called only on a library target. */
void GetLibraryNames(std::string& name, std::string& soName,
std::string& realName, std::string& impName,
- const char* config);
+ std::string& pdbName, const char* config);
/** Get the names of the library used to remove existing copies of
the library from the build tree either before linking or during
@@ -221,20 +224,21 @@ public:
std::string& sharedSOName,
std::string& sharedRealName,
std::string& importName,
+ std::string& pdbName,
const char* config);
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
void GetExecutableNames(std::string& name, std::string& realName,
- const char* config);
+ std::string& pdbName, const char* config);
/** Get the names of the executable used to remove existing copies
of the executable from the build tree either before linking or
during a clean step. This should be called only on an
executable target. */
void GetExecutableCleanNames(std::string& name, std::string& realName,
- const char* config);
+ std::string& pdbName, const char* config);
/**
* Compute whether this target must be relinked before installing.
@@ -313,10 +317,12 @@ private:
std::string& soName,
std::string& realName,
std::string& impName,
+ std::string& pdbName,
TargetType type,
const char* config);
void GetExecutableNamesInternal(std::string& name,
std::string& realName,
+ std::string& pdbName,
TargetType type,
const char* config);
diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in
index 731bec91bf..95a454cca5 100644
--- a/Source/kwsys/System.h.in
+++ b/Source/kwsys/System.h.in
@@ -80,7 +80,7 @@ enum kwsysSystem_Shell_Flag_e
Shell_Flag_Make. */
kwsysSystem_Shell_Flag_VSIDE = (1<<1),
- /** In a windows whell the argument is being passed to "echo". */
+ /** In a windows shell the argument is being passed to "echo". */
kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
/** The target shell is in a Watcom WMake makefile. */
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 3f4eee3e71..b9854019c6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1464,10 +1464,33 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
bool SystemTools::CopyFileIfDifferent(const char* source,
const char* destination)
{
+ // special check for a destination that is a directory
+ // FilesDiffer does not handle file to directory compare
+ if(SystemTools::FileIsDirectory(destination))
+ {
+ kwsys_stl::string new_destination = destination;
+ SystemTools::ConvertToUnixSlashes(new_destination);
+ new_destination += '/';
+ kwsys_stl::string source_name = source;
+ new_destination += SystemTools::GetFilenameName(source_name);
+ if(SystemTools::FilesDiffer(source, new_destination.c_str()))
+ {
+ return SystemTools::CopyFileAlways(source, destination);
+ }
+ else
+ {
+ // the files are the same so the copy is done return
+ // true
+ return true;
+ }
+ }
+ // source and destination are files so do a copy if they
+ // are different
if(SystemTools::FilesDiffer(source, destination))
{
return SystemTools::CopyFileAlways(source, destination);
}
+ // at this point the files must be the same so return true
return true;
}
@@ -1556,7 +1579,6 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
{
return true;
}
-
mode_t perm = 0;
bool perms = SystemTools::GetPermissions(source, perm);
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index f61963a2ff..0c8a51de7f 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -105,6 +105,12 @@ ADD_CUSTOM_COMMAND(
ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+# Test user-value flag mapping for the VS IDE.
+IF(MSVC)
+ SET_TARGET_PROPERTIES(notInAllExe PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:LIBC;LIBCMT;MSVCRT")
+ENDIF(MSVC)
+
# Test creating a custom target that builds not-in-all targets.
ADD_CUSTOM_TARGET(notInAllCustom)
ADD_DEPENDENCIES(notInAllCustom notInAllExe)
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index f61963a2ff..0c8a51de7f 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -105,6 +105,12 @@ ADD_CUSTOM_COMMAND(
ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+# Test user-value flag mapping for the VS IDE.
+IF(MSVC)
+ SET_TARGET_PROPERTIES(notInAllExe PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:LIBC;LIBCMT;MSVCRT")
+ENDIF(MSVC)
+
# Test creating a custom target that builds not-in-all targets.
ADD_CUSTOM_TARGET(notInAllCustom)
ADD_DEPENDENCIES(notInAllCustom notInAllExe)
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
index f61963a2ff..0c8a51de7f 100644
--- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
@@ -105,6 +105,12 @@ ADD_CUSTOM_COMMAND(
ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+# Test user-value flag mapping for the VS IDE.
+IF(MSVC)
+ SET_TARGET_PROPERTIES(notInAllExe PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:LIBC;LIBCMT;MSVCRT")
+ENDIF(MSVC)
+
# Test creating a custom target that builds not-in-all targets.
ADD_CUSTOM_TARGET(notInAllCustom)
ADD_DEPENDENCIES(notInAllCustom notInAllExe)
diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt
new file mode 100644
index 0000000000..0c274f3b0b
--- /dev/null
+++ b/Utilities/Release/Cygwin/CMakeLists.txt
@@ -0,0 +1,25 @@
+FILE(GLOB INSTALLED_CURSES /usr/bin/cygncurses*.dll)
+SET(MAX 0)
+FOREACH(f ${INSTALLED_CURSES})
+ IF(NOT "${f}" MATCHES "\\+")
+ STRING(REGEX REPLACE ".*([0-9]).dll" "\\1" NUMBER "${f}")
+ IF(NUMBER GREATER MAX)
+ SET(MAX ${NUMBER})
+ ENDIF(NUMBER GREATER MAX)
+ ENDIF(NOT "${f}" MATCHES "\\+")
+ENDFOREACH(f)
+STRING(REGEX REPLACE "/usr/bin/" "\\1" NUMBER "${f}")
+SET(CMAKE_NCURSES_VERSION "libncurses${MAX}")
+MESSAGE(STATUS "Using curses version: libncurses${MAX}")
+CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-setup.hint.in"
+ "${CMake_BINARY_DIR}/setup.hint")
+CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/README.cygwin.in"
+ "${CMake_BINARY_DIR}/Docs/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README")
+INSTALL_FILES(/share/doc/Cygwin FILES
+ ${CMake_BINARY_DIR}/Docs/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README
+ )
+CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-package.sh.in"
+ ${CPACK_CYGWIN_BUILD_SCRIPT})
+CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-patch.diff.in"
+ ${CPACK_CYGWIN_PATCH_FILE})
+
diff --git a/Utilities/Release/Cygwin/README.cygwin.in b/Utilities/Release/Cygwin/README.cygwin.in
new file mode 100644
index 0000000000..6c42a4c20e
--- /dev/null
+++ b/Utilities/Release/Cygwin/README.cygwin.in
@@ -0,0 +1,42 @@
+cmake
+--------------------------------------
+Runtime requirements:
+ cygwin-1.5.21(0.156/4/2) or newer
+
+Build requirements
+ cygwin-1.5.21(0.156/4/2) or newer
+ make
+
+Canonical homepage:
+ http://www.cmake.org
+
+Canonical download:
+ ftp://www.cmake.org/pub/cmake/
+
+------------------------------------
+
+Build instructions:
+ unpack @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2
+ if you use setup to install this src package, it will be
+ unpacked under /usr/src automatically
+ cd /usr/src
+ ./@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh all
+
+This will create:
+ /usr/src/@CPACK_PACKAGE_FILE_NAME@.tar.bz2
+ /usr/src/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2
+
+-------------------------------------------
+
+Port Notes:
+
+The directory /usr/share/@CPACK_PACKAGE_FILE_NAME@/include is purposely not
+located at /usr/include/@CPACK_PACKAGE_FILE_NAME@ or /usr/include/cmake. The
+files it contains are not meant for inclusion in any C or C++ program.
+They are used for compiling dynamically loadable CMake commands inside
+projects that provide them. CMake will automatically provide the
+proper include path when the files are needed.
+
+------------------
+
+Cygwin port maintained by: CMake Developers <cmake@www.cmake.org>
diff --git a/Utilities/Release/Cygwin/cygwin-package.sh.in b/Utilities/Release/Cygwin/cygwin-package.sh.in
new file mode 100755
index 0000000000..9730b33324
--- /dev/null
+++ b/Utilities/Release/Cygwin/cygwin-package.sh.in
@@ -0,0 +1,90 @@
+TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd`
+
+# create build directory
+mkdirs()
+{
+ (
+ mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build"
+ )
+}
+
+# cd into
+# untar source tree and apply patch
+prep()
+{
+ (
+ cd "$TOP_DIR" &&
+ tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2
+ patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" &&
+ mkdirs
+ )
+}
+
+conf()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ ../bootstrap --parallel=2
+ )
+}
+
+build()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ make -j2 &&
+ make test
+ )
+}
+
+clean()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ make clean
+ )
+}
+
+pkg()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ ./bin/cpack &&
+ mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR"
+ )
+}
+
+spkg()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ ./bin/cpack --config CPackSourceConfig.cmake &&
+ mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR"
+ )
+}
+
+finish()
+{
+ (
+ rm -rf "@CPACK_PACKAGE_FILE_NAME@"
+ )
+}
+
+case $1 in
+ prep) prep ; STATUS=$? ;;
+ mkdirs) mkdirs ; STATUS=$? ;;
+ conf) conf ; STATUS=$? ;;
+ build) build ; STATUS=$? ;;
+ clean) clean ; STATUS=$? ;;
+ package) pkg ; STATUS=$? ;;
+ pkg) pkg ; STATUS=$? ;;
+ src-package) spkg ; STATUS=$? ;;
+ spkg) spkg ; STATUS=$? ;;
+ finish) finish ; STATUS=$? ;;
+ all) (
+ prep && conf && build && pkg && spkg && finish ;
+ STATUS=$?
+ ) ;;
+ *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;;
+esac
+exit ${STATUS}
diff --git a/Utilities/Release/Cygwin/cygwin-patch.diff.in b/Utilities/Release/Cygwin/cygwin-patch.diff.in
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Utilities/Release/Cygwin/cygwin-patch.diff.in
diff --git a/Utilities/Release/Cygwin/cygwin-setup.hint.in b/Utilities/Release/Cygwin/cygwin-setup.hint.in
new file mode 100644
index 0000000000..9706c0d8db
--- /dev/null
+++ b/Utilities/Release/Cygwin/cygwin-setup.hint.in
@@ -0,0 +1,5 @@
+# CMake setup.hint file for cygwin setup.exe program
+category: Devel
+requires: @CMAKE_NCURSES_VERSION@ cygwin
+sdesc: "A cross platform build manager"
+ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files."
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
index b57552ec04..0b1949cceb 100644
--- a/cmake_uninstall.cmake.in
+++ b/cmake_uninstall.cmake.in
@@ -5,18 +5,18 @@ ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
- MESSAGE(STATUS "Uninstalling \"${file}\"")
- IF(EXISTS "${file}")
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
- "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF("${rm_retval}" STREQUAL 0)
ELSE("${rm_retval}" STREQUAL 0)
- MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF("${rm_retval}" STREQUAL 0)
- ELSE(EXISTS "${file}")
- MESSAGE(STATUS "File \"${file}\" does not exist.")
- ENDIF(EXISTS "${file}")
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)