From 00230147fa314745cf3a928166a7454b3688116f Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 27 Oct 2006 16:01:56 -0400 Subject: ENH: move changes from main tree --- CMakeLists.txt | 155 +++++- CTestCustom.ctest.in | 12 +- ChangeLog.manual | 46 ++ Modules/CMakeDependentOption.cmake | 37 ++ Modules/CMakeGenericSystem.cmake | 8 + Modules/CPack.cmake | 2 + Modules/CTestTargets.cmake | 12 +- Modules/FindCURL.cmake | 38 ++ Modules/FindDoxygen.cmake | 54 +- Modules/FindEXPAT.cmake | 38 ++ Modules/FindJNI.cmake | 23 +- Modules/FindJava.cmake | 1 + Modules/FindKDE3.cmake | 14 +- Modules/FindPerl.cmake | 4 + Modules/FindQt4.cmake | 9 + Modules/FindTclsh.cmake | 6 +- Modules/FindWish.cmake | 6 +- Modules/FindXMLRPC.cmake | 134 +++++ Modules/FindwxWidgets.cmake | 76 ++- Modules/NSIS.template.in | 17 +- Modules/Platform/CYGWIN.cmake | 16 +- Modules/Platform/Windows-cl.cmake | 6 +- Modules/Platform/Windows-gcc.cmake | 16 +- Modules/UsewxWidgets.cmake | 6 +- Source/CMakeLists.txt | 9 + Source/CPack/cmCPackGenericGenerator.cxx | 56 ++- Source/CPack/cmCPackGenericGenerator.h | 2 + Source/CPack/cmCPackNSISGenerator.cxx | 1 + Source/CPack/cmCPackTGZGenerator.cxx | 7 +- Source/CPack/cpack.cxx | 6 + Source/CTest/cmCTestBuildHandler.cxx | 8 + Source/CTest/cmCTestCoverageHandler.cxx | 12 +- Source/CTest/cmCTestMemCheckHandler.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 24 +- Source/CTest/cmCTestScriptHandler.h | 7 + Source/CTest/cmCTestSubmitHandler.cxx | 17 +- Source/CTest/cmCTestTestHandler.cxx | 37 ++ Source/CTest/cmCTestTestHandler.h | 29 +- Source/CTest/cmCTestUpdateHandler.cxx | 6 +- Source/cmCTest.cxx | 545 ++++++++++++--------- Source/cmCTest.h | 24 +- Source/cmDocumentation.cxx | 83 +++- Source/cmExecuteProcessCommand.cxx | 50 +- Source/cmExecuteProcessCommand.h | 4 +- Source/cmFindBase.cxx | 9 +- Source/cmFindPackageCommand.cxx | 48 +- Source/cmFindPackageCommand.h | 12 +- Source/cmGeneratedFileStream.cxx | 10 +- Source/cmGetDirectoryPropertyCommand.cxx | 4 + Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalMinGWMakefileGenerator.cxx | 10 +- Source/cmGlobalWatcomWMakeGenerator.cxx | 1 + Source/cmGlobalXCodeGenerator.cxx | 26 +- Source/cmIfCommand.cxx | 61 ++- Source/cmIfCommand.h | 2 +- Source/cmLocalGenerator.cxx | 31 +- Source/cmLocalGenerator.h | 3 + Source/cmLocalUnixMakefileGenerator3.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.h | 10 +- Source/cmLocalVisualStudio6Generator.cxx | 36 +- Source/cmLocalVisualStudio7Generator.cxx | 43 +- Source/cmLocalVisualStudio7Generator.h | 1 + Source/cmLocalVisualStudioGenerator.cxx | 18 +- Source/cmMakefileExecutableTargetGenerator.cxx | 18 + Source/cmMakefileLibraryTargetGenerator.cxx | 32 ++ Source/cmSetTargetPropertiesCommand.h | 6 +- Source/cmSystemTools.cxx | 10 +- Source/cmTarget.cxx | 38 +- Source/cmTarget.h | 5 + Source/cmXMLParser.cxx | 2 +- Source/cmake.cxx | 31 +- Source/kwsys/CMakeLists.txt | 1 + Source/kwsys/System.c | 37 +- Source/kwsys/System.h.in | 7 +- Source/kwsys/SystemTools.cxx | 10 +- Source/kwsys/SystemTools.cxx.bak | 120 +++-- Source/kwsys/kwsysPlatformCxxTests.cmake | 45 -- Source/kwsys/kwsysPlatformCxxTests.cxx | 363 -------------- Templates/DLLHeader.dsptemplate | 8 +- Templates/EXEHeader.dsptemplate | 8 +- Tests/CTestTest2/test.cmake.in | 2 +- Tests/CTestTest3/test.cmake.in | 4 +- Tests/Complex/CMakeLists.txt | 9 + Tests/Complex/Executable/CMakeLists.txt | 8 +- Tests/Complex/Executable/complex.cxx | 10 +- Tests/Complex/cmTestConfigure.h.in | 3 +- Tests/ComplexOneConfig/CMakeLists.txt | 9 + Tests/ComplexOneConfig/Executable/CMakeLists.txt | 8 +- Tests/ComplexOneConfig/Executable/complex.cxx | 10 +- Tests/ComplexOneConfig/cmTestConfigure.h.in | 3 +- Tests/ComplexRelativePaths/CMakeLists.txt | 9 + .../ComplexRelativePaths/Executable/CMakeLists.txt | 8 +- Tests/ComplexRelativePaths/Executable/complex.cxx | 10 +- Tests/ComplexRelativePaths/cmTestConfigure.h.in | 3 +- Tests/CustomCommand/CMakeLists.txt | 4 + Tests/MacroTest/CMakeLists.txt | 6 +- Tests/OutOfSource/CMakeLists.txt | 4 + Tests/SimpleInstall/CMakeLists.txt | 3 +- Tests/SimpleInstallS2/CMakeLists.txt | 3 +- Tests/StringFileTest/CMakeLists.txt | 4 +- Utilities/cmThirdParty.h.in | 26 + Utilities/cm_curl.h | 28 ++ Utilities/cm_expat.h | 28 ++ Utilities/cm_xmlrpc.h | 30 ++ Utilities/cm_zlib.h | 28 ++ Utilities/cmtar/CMakeLists.txt | 12 +- Utilities/cmtar/config.h.in | 5 +- Utilities/cmtar/libtar.c | 21 +- Utilities/cmxmlrpc/xmlrpc.h | 4 +- Utilities/cmxmlrpc/xmlrpc_expat.c | 2 +- Utilities/cmxmlrpc/xmlrpc_server.h | 2 +- bootstrap | 13 +- doxygen.config | 2 +- 113 files changed, 1996 insertions(+), 1062 deletions(-) create mode 100644 Modules/CMakeDependentOption.cmake create mode 100644 Modules/FindCURL.cmake create mode 100644 Modules/FindEXPAT.cmake create mode 100644 Modules/FindXMLRPC.cmake delete mode 100644 Source/kwsys/kwsysPlatformCxxTests.cmake delete mode 100644 Source/kwsys/kwsysPlatformCxxTests.cxx create mode 100644 Utilities/cmThirdParty.h.in create mode 100644 Utilities/cm_curl.h create mode 100644 Utilities/cm_expat.h create mode 100644 Utilities/cm_xmlrpc.h create mode 100644 Utilities/cm_zlib.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e913ed..2a697dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,27 +71,116 @@ SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) SUBDIRS(Source/kwsys) #----------------------------------------------------------------------------- -# Build zlib library for Curl, CMake, and CTest. -SUBDIRS(Utilities/cmzlib) -SET(CMAKE_ZLIB_INCLUDES - "${CMAKE_CURRENT_BINARY_DIR}/Utilities" +# Setup third-party libraries. + +# Everything in the tree should be able to include files from the +# Utilities directory. +INCLUDE_DIRECTORIES( + ${CMake_SOURCE_DIR}/Utilities + ${CMake_BINARY_DIR}/Utilities ) -SET(CMAKE_ZLIB_LIBRARIES "cmzlib") -SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES}) -SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES}) -SET(CURL_SPECIAL_ZLIB_H "cmzlib/zlib.h") + +# Third party libraries must be something that can be found. +IF(EXISTS ${CMAKE_ROOT}/Modules/FindXMLRPC.cmake) + SET(CMAKE_ALLOW_SYSTEM_LIBRARIES 1) +ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindXMLRPC.cmake) + SET(CMAKE_ALLOW_SYSTEM_LIBRARIES 0) +ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindXMLRPC.cmake) + +IF(CMAKE_ALLOW_SYSTEM_LIBRARIES) + # Options have dependencies. + INCLUDE(CMakeDependentOption) + + # Allow the user to enable/disable all system utility library options + # by setting CMAKE_USE_SYSTEM_LIBRARIES on the command line. + IF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES) + SET(CMAKE_USE_SYSTEM_LIBRARIES_USER 1) + ENDIF(DEFINED CMAKE_USE_SYSTEM_LIBRARIES) + IF(CMAKE_USE_SYSTEM_LIBRARIES) + SET(CMAKE_USE_SYSTEM_LIBRARIES ON) + ELSE(CMAKE_USE_SYSTEM_LIBRARIES) + SET(CMAKE_USE_SYSTEM_LIBRARIES OFF) + ENDIF(CMAKE_USE_SYSTEM_LIBRARIES) + IF(CMAKE_USE_SYSTEM_LIBRARIES_USER) + SET(CMAKE_USE_SYSTEM_CURL "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed curl" FORCE) + SET(CMAKE_USE_SYSTEM_EXPAT "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed expat" FORCE) + SET(CMAKE_USE_SYSTEM_XMLRPC "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed xmlrpc" FORCE) + SET(CMAKE_USE_SYSTEM_ZLIB "${CMAKE_USE_SYSTEM_LIBRARIES}" CACHE BOOL "Use system-installed zlib" FORCE) + ENDIF(CMAKE_USE_SYSTEM_LIBRARIES_USER) + + # Optionally use system utility libraries. + OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" ${CMAKE_USE_SYSTEM_LIBRARIES}) + OPTION(CMAKE_USE_SYSTEM_XMLRPC "Use system-installed xmlrpc" ${CMAKE_USE_SYSTEM_LIBRARIES}) + CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" + ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_XMLRPC" ON) + CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" + ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON) + + # There is currently no option for system tar because the upstream + # libtar does not have our modifications to allow reentrant + # object-oriented use of the library. + # OPTION(CMAKE_USE_SYSTEM_TAR "Use system-installed tar" OFF) +ELSE(CMAKE_ALLOW_SYSTEM_LIBRARIES) + SET(CMAKE_USE_SYSTEM_CURL 0) + SET(CMAKE_USE_SYSTEM_EXPAT 0) + SET(CMAKE_USE_SYSTEM_XMLRPC 0) + SET(CMAKE_USE_SYSTEM_ZLIB 0) +ENDIF(CMAKE_ALLOW_SYSTEM_LIBRARIES) + +# Inform utility library header wrappers whether to use system versions. +CONFIGURE_FILE(${CMake_SOURCE_DIR}/Utilities/cmThirdParty.h.in + ${CMake_BINARY_DIR}/Utilities/cmThirdParty.h + @ONLY IMMEDIATE) + +# Mention to the user what system libraries are being used. +FOREACH(util CURL EXPAT XMLRPC ZLIB) + IF(CMAKE_USE_SYSTEM_${util}) + MESSAGE(STATUS "Using system-installed ${util}") + ENDIF(CMAKE_USE_SYSTEM_${util}) +ENDFOREACH(util) + +#----------------------------------------------------------------------------- +# Build zlib library for Curl, CMake, and CTest. +SET(CMAKE_ZLIB_HEADER "cm_zlib.h") +IF(CMAKE_USE_SYSTEM_ZLIB) + FIND_PACKAGE(ZLIB) + IF(NOT ZLIB_FOUND) + MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!") + ENDIF(NOT ZLIB_FOUND) + SET(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR}) + SET(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) +ELSE(CMAKE_USE_SYSTEM_ZLIB) + SUBDIRS(Utilities/cmzlib) + SET(CMAKE_ZLIB_INCLUDES) + SET(CMAKE_ZLIB_LIBRARIES cmzlib) +ENDIF(CMAKE_USE_SYSTEM_ZLIB) #----------------------------------------------------------------------------- # Build Curl library for CTest. -SUBDIRS(Utilities/cmcurl) -SET(CMAKE_CURL_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/Utilities") -SET(CMAKE_CURL_LIBRARIES "cmcurl") +IF(CMAKE_USE_SYSTEM_CURL) + FIND_PACKAGE(CURL) + IF(NOT CURL_FOUND) + MESSAGE(FATAL_ERROR "CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!") + ENDIF(NOT CURL_FOUND) + SET(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS}) + SET(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES}) +ELSE(CMAKE_USE_SYSTEM_CURL) + SET(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER}) + SET(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES}) + SET(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES}) + SUBDIRS(Utilities/cmcurl) + SET(CMAKE_CURL_INCLUDES) + SET(CMAKE_CURL_LIBRARIES cmcurl) +ENDIF(CMAKE_USE_SYSTEM_CURL) #----------------------------------------------------------------------------- # Build Tar library for CTest. +SET(CMTAR_ZLIB_HEADER ${CMAKE_ZLIB_HEADER}) +SET(CMTAR_ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES}) +SET(CMTAR_ZLIB_INCLUDE_DIRS ${CMAKE_ZLIB_INCLUDES}) SUBDIRS(Utilities/cmtar) -SET(CMAKE_TAR_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar") -SET(CMAKE_TAR_LIBRARIES "cmtar") +SET(CMAKE_TAR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar) +SET(CMAKE_TAR_LIBRARIES cmtar) #----------------------------------------------------------------------------- # Build Compress library for CTest. @@ -101,19 +190,33 @@ SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") #----------------------------------------------------------------------------- # Build expat library for CMake and CTest. -SUBDIRS(Utilities/cmexpat) -SET(CMAKE_EXPAT_INCLUDES - "${CMAKE_CURRENT_BINARY_DIR}/Utilities" - "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmexpat" - ) -SET(CMAKE_EXPAT_LIBRARIES "cmexpat") - -SUBDIRS(Utilities/cmxmlrpc) -SET(CMAKE_XMLRPC_INCLUDES - "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmxmlrpc" - "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmxmlrpc" - ) -SET(CMAKE_XMLRPC_LIBRARIES "cmXMLRPC") +IF(CMAKE_USE_SYSTEM_EXPAT) + FIND_PACKAGE(EXPAT) + IF(NOT EXPAT_FOUND) + MESSAGE(FATAL_ERROR + "CMAKE_USE_SYSTEM_EXPAT is ON but a expat is not found!") + ENDIF(NOT EXPAT_FOUND) + SET(CMAKE_EXPAT_INCLUDES ${EXPAT_INCLUDE_DIRS}) + SET(CMAKE_EXPAT_LIBRARIES ${EXPAT_LIBRARIES}) +ELSE(CMAKE_USE_SYSTEM_EXPAT) + SUBDIRS(Utilities/cmexpat) + SET(CMAKE_EXPAT_INCLUDES) + SET(CMAKE_EXPAT_LIBRARIES cmexpat) +ENDIF(CMAKE_USE_SYSTEM_EXPAT) + +IF(CMAKE_USE_SYSTEM_XMLRPC) + FIND_PACKAGE(XMLRPC QUIET REQUIRED libwww-client) + IF(NOT XMLRPC_FOUND) + MESSAGE(FATAL_ERROR + "CMAKE_USE_SYSTEM_XMLRPC is ON but a xmlrpc is not found!") + ENDIF(NOT XMLRPC_FOUND) + SET(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS}) + SET(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES}) +ELSE(CMAKE_USE_SYSTEM_XMLRPC) + SUBDIRS(Utilities/cmxmlrpc) + SET(CMAKE_XMLRPC_INCLUDES) + SET(CMAKE_XMLRPC_LIBRARIES cmXMLRPC) +ENDIF(CMAKE_USE_SYSTEM_XMLRPC) IF (UNIX) FIND_PACKAGE(Curses QUIET) diff --git a/CTestCustom.ctest.in b/CTestCustom.ctest.in index a61cf2c..f6640f3 100644 --- a/CTestCustom.ctest.in +++ b/CTestCustom.ctest.in @@ -10,14 +10,14 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "libcmcurl.*has no symbols" "not sorted slower link editing will result" "stl_deque.h:479" - "Utilities/cmzlib/" - "Utilities/cmxmlrpc/" - "Source/CTest/Curl" - "Utilities/cmcurl" - "Source/CursesDialog/form" + "Utilities.cmzlib." + "Utilities.cmxmlrpc." + "Source.CTest.Curl" + "Utilities.cmcurl" + "Source.CursesDialog.form" "/usr/bin/ld.*warning.*-..*directory.name.*bin.*does not exist" "Redeclaration of .send..... with a different storage class specifier" - "Utilities/cmexpat/" + "Utilities.cmexpat." "is not used for resolving any symbol" "Clock skew detected" "remark\\(1209" diff --git a/ChangeLog.manual b/ChangeLog.manual index 3c5217f..ddacb60 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -107,6 +107,52 @@ Changes in CMake 2.4.4 * better message if bogus generator is specified. +* Better FindJava and FindJNI + +* Fix doxygen.config for CMake + +* add CPACK_MODULE_PATH + +* Fix configuration for ctest dashboard targets Experimental, Nightly, etc + +* Fix FindDoxygen for mac and app-bundles + +* Fix CPack simple install test with NSIS + +* Allow EXECUTE_PROCESS to strip trailing white space + +* Fix mingw echo in makefiles + +* Fix Xcode to not mess up -gdwarf-2 + +* Fix crash when "linking" to custom targets. + +* Allow HEADER_FILE_ONLY to not compile the file in VS 7 and 8 + +* Fix mingw out of binary with spaces in the path. + +* Fix for sudo make install (partial) + +* Allow installed zlib, curl, expat, xmlrpc to be used. + +* Add CMakeDependentOption.cmake module + +* Allow projects to set install prefix default + +* improved Find/Use wxWidgets + +* add support for windows dll version numbers + +* Fix message for -G when generator does not exist + +* Fix html references in help + +* Fix version on .exe cygwin + +* allow global timeout in ctest + +* Fix some odd cases with custom commands in VS 6 + Changes in CMake 2.4.3 * fix for 3557 - Under MSVC8 hardcoded TargetEnvironment for MIDL Compiler diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake new file mode 100644 index 0000000..2183191 --- /dev/null +++ b/Modules/CMakeDependentOption.cmake @@ -0,0 +1,37 @@ +# - Macro to provide an option dependent on other options. +# This macro presents an option to the user only if a set of other +# conditions are true. When the option is not presented a default +# value is used, but any value set by the user is preserved for when +# the option is presented again. +# Example invocation: +# CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON +# "USE_BAR;NOT USE_ZOT" OFF) +# If USE_BAR is true and USE_ZOT is false, this provides an option called +# USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to OFF. If +# the status of USE_BAR or USE_ZOT ever changes, any value for the +# USE_FOO option is saved so that when the option is re-enabled it +# retains its old value. +MACRO(CMAKE_DEPENDENT_OPTION option doc default depends force) + IF(${option}_ISSET MATCHES "^${option}_ISSET$") + SET(${option}_AVAILABLE 1) + FOREACH(d ${depends}) + STRING(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}") + IF(${CMAKE_DEPENDENT_OPTION_DEP}) + ELSE(${CMAKE_DEPENDENT_OPTION_DEP}) + SET(${option}_AVAILABLE 0) + ENDIF(${CMAKE_DEPENDENT_OPTION_DEP}) + ENDFOREACH(d) + IF(${option}_AVAILABLE) + OPTION(${option} "${doc}" "${default}") + SET(${option} "${${option}}" CACHE BOOL "${doc}" FORCE) + ELSE(${option}_AVAILABLE) + IF(${option} MATCHES "^${option}$") + ELSE(${option} MATCHES "^${option}$") + SET(${option} "${${option}}" CACHE INTERNAL "${doc}") + ENDIF(${option} MATCHES "^${option}$") + SET(${option} ${force}) + ENDIF(${option}_AVAILABLE) + ELSE(${option}_ISSET MATCHES "^${option}_ISSET$") + SET(${option} "${${option}_ISSET}") + ENDIF(${option}_ISSET MATCHES "^${option}_ISSET$") +ENDMACRO(CMAKE_DEPENDENT_OPTION) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index efa6f2b..47c84fc 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -41,6 +41,14 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") MARK_AS_ADVANCED(CMAKE_COLOR_MAKEFILE) ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") +# Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX +# was initialized by the block below. This is useful for user +# projects to change the default prefix while still allowing the +# command line to override it. +IF(NOT DEFINED CMAKE_INSTALL_PREFIX) + SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1) +ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) + # Choose a default install prefix for this platform. IF(UNIX) SET(CMAKE_INSTALL_PREFIX "/usr/local" diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 4af1169..913d874 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -56,6 +56,8 @@ cpack_set_if_not_set(CPACK_RESOURCE_FILE_README cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt") +cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}") + IF(CPACK_NSIS_MODIFY_PATH) SET(CPACK_NSIS_MODIFY_PATH ON) ENDIF(CPACK_NSIS_MODIFY_PATH) diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index a90294d2..bb4cdee 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -29,16 +29,22 @@ ENDIF(CTEST_NEW_FORMAT) # These should NOT need to be modified from project to project. # +SET(__conf_types "") +IF(CMAKE_CONFIGURATION_TYPES) + # We need to pass the configuration type on the test command line. + SET(__conf_types -C "${CMAKE_CFG_INTDIR}") +ENDIF(CMAKE_CONFIGURATION_TYPES) + # add testing targets IF(${CMAKE_MAKE_PROGRAM} MATCHES make) FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck) - ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} -D ${mode}) + ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}) ENDFOREACH(mode) ELSE(${CMAKE_MAKE_PROGRAM} MATCHES make) # for IDE only add them once for nested projects IF (NOT DART_COMMON_TARGETS_ADDED) FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck) - ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} -D ${mode}) + ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}) ENDFOREACH(mode) SET (DART_COMMON_TARGETS_ADDED 1) ENDIF (NOT DART_COMMON_TARGETS_ADDED) @@ -53,7 +59,7 @@ IF(${CMAKE_MAKE_PROGRAM} MATCHES make) FOREACH(testtype Start Update Configure Build Test Coverage MemCheck Submit) # missing purify ADD_CUSTOM_TARGET(${mode}${testtype} - ${CMAKE_CTEST_COMMAND} -D ${mode}${testtype}) + ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}) ENDFOREACH(testtype) ENDFOREACH(mode) ENDIF (${CMAKE_MAKE_PROGRAM} MATCHES make) diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake new file mode 100644 index 0000000..57c1bbc --- /dev/null +++ b/Modules/FindCURL.cmake @@ -0,0 +1,38 @@ +# - Find curl +# Find the native CURL headers and libraries. +# +# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc. +# CURL_LIBRARIES - List of libraries when using curl. +# CURL_FOUND - True if curl found. + +# Look for the header file. +FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h) +MARK_AS_ADVANCED(CURL_INCLUDE_DIR) + +# Look for the library. +FIND_LIBRARY(CURL_LIBRARY NAMES curl) +MARK_AS_ADVANCED(CURL_LIBRARY) + +# Copy the results to the output variables. +IF(CURL_INCLUDE_DIR AND CURL_LIBRARY) + SET(CURL_FOUND 1) + SET(CURL_LIBRARIES ${CURL_LIBRARY}) + SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) +ELSE(CURL_INCLUDE_DIR AND CURL_LIBRARY) + SET(CURL_FOUND 0) + SET(CURL_LIBRARIES) + SET(CURL_INCLUDE_DIRS) +ENDIF(CURL_INCLUDE_DIR AND CURL_LIBRARY) + +# Report the results. +IF(NOT CURL_FOUND) + SET(CURL_DIR_MESSAGE + "CURL was not found. Make sure CURL_LIBRARY and CURL_INCLUDE_DIR are set.") + IF(NOT CURL_FIND_QUIETLY) + MESSAGE(STATUS "${CURL_DIR_MESSAGE}") + ELSE(NOT CURL_FIND_QUIETLY) + IF(CURL_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${CURL_DIR_MESSAGE}") + ENDIF(CURL_FIND_REQUIRED) + ENDIF(NOT CURL_FIND_QUIETLY) +ENDIF(NOT CURL_FOUND) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index fff6e4d..5d4554b 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -1,9 +1,28 @@ -# - This module looks for Doxygen and the path to Graphiz's dot +# - This module looks for Doxygen and the path to Graphviz's dot # Doxygen is a documentation generation tool see http://www.doxygen.org # With the OS X GUI version, it likes to be installed to /Applications and # it contains the doxygen executable in the bundle. In the versions I've # seen, it is located in Resources, but in general, more often binaries are -# located in MacOS. +# located in MacOS. This code sets the following variables: +# DOXYGEN_EXECUTABLE = The path to the doxygen command. +# DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen. +# DOXYGEN_DOT_PATH = The path to dot not including the executable +# DOXYGEN = same as DOXYGEN_EXECUTABLE for backwards compatibility +# DOT = same as DOXYGEN_DOT_EXECUTABLE for backwards compatibility + +# The official Doxygen.app that is distributed for OS X uses non-standard +# conventions. Instead of the command-line "doxygen" tool being placed in +# Doxygen.app/Contents/MacOS, "Doxywizard" is placed there instead and +# "doxygen" is actually placed in Contents/Resources. This is most likely +# to accomodate people who double-click on the Doxygen.app package and expect +# to see something happen. However, the CMake backend gets horribly confused +# by this. Once CMake sees the bundle, it indiscrimately uses Doxywizard +# as the executable to use. The only work-around I have found is to disable +# the app-bundle feature for only this command. +# Save the old setting +SET(TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE}) +# Disable the App-bundle detection feature +SET(CMAKE_FIND_APPBUNDLE "NEVER") IF (NOT DOXYGEN_FIND_QUIETLY) MESSAGE(STATUS "Looking for doxygen...") ENDIF (NOT DOXYGEN_FIND_QUIETLY) @@ -46,34 +65,31 @@ FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE /Applications/Graphviz.app/Contents/MacOS /Applications/Doxygen.app/Contents/Resources /Applications/Doxygen.app/Contents/MacOS - DOC "Graphiz Dot tool for using Doxygen" + DOC "Graphviz Dot tool for using Doxygen" ) IF (NOT DOXYGEN_FIND_QUIETLY) IF (DOXYGEN_DOT_EXECUTABLE) MESSAGE(STATUS "Looking for dot tool... - found ${DOXYGEN_DOT_EXECUTABLE}") + # The Doxyfile wants the path to Dot, not the entire path and executable + GET_FILENAME_COMPONENT(DOXYGEN_DOT_PATH "${DOXYGEN_DOT_EXECUTABLE}" PATH CACHE) ELSE (DOXYGEN_DOT_EXECUTABLE) MESSAGE(STATUS "Looking for dot tool... - NOT found") ENDIF (DOXYGEN_DOT_EXECUTABLE) ENDIF (NOT DOXYGEN_FIND_QUIETLY) -# The Doxyfile wants the path to Dot, not the entire path and executable -# so for convenience, I'll add another search for DOXYGEN_DOT_PATH. -FIND_PATH(DOXYGEN_DOT_PATH - dot - "C:/Program Files/ATT/Graphviz/bin" - [HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin - /Applications/Graphviz.app/Contents/MacOS - /Applications/Doxygen.app/Contents/Resources - /Applications/Doxygen.app/Contents/MacOS - DOC "Path to the Graphviz Dot tool" -) +# Restore the old app-bundle setting setting +SET(CMAKE_FIND_APPBUNDLE ${TEMP_DOXYGEN_SAVE_CMAKE_FIND_APPBUNDLE}) + +# Backwards compatibility for CMake4.3 and less +SET (DOXYGEN ${DOXYGEN_EXECUTABLE} ) +SET (DOT ${DOXYGEN_DOT_EXECUTABLE} ) MARK_AS_ADVANCED( - DOXYGEN_FOUND, - DOXYGEN_EXECUTABLE, - DOXYGEN_DOT_FOUND, - DOXYGEN_DOT_EXECUTABLE, - DOXYGEN_DOT_PATH, + DOXYGEN_FOUND + DOXYGEN_EXECUTABLE + DOXYGEN_DOT_FOUND + DOXYGEN_DOT_EXECUTABLE + DOXYGEN_DOT_PATH ) diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake new file mode 100644 index 0000000..d48eef3 --- /dev/null +++ b/Modules/FindEXPAT.cmake @@ -0,0 +1,38 @@ +# - Find expat +# Find the native EXPAT headers and libraries. +# +# EXPAT_INCLUDE_DIRS - where to find expat.h, etc. +# EXPAT_LIBRARIES - List of libraries when using expat. +# EXPAT_FOUND - True if expat found. + +# Look for the header file. +FIND_PATH(EXPAT_INCLUDE_DIR NAMES expat.h) +MARK_AS_ADVANCED(EXPAT_INCLUDE_DIR) + +# Look for the library. +FIND_LIBRARY(EXPAT_LIBRARY NAMES expat) +MARK_AS_ADVANCED(EXPAT_LIBRARY) + +# Copy the results to the output variables. +IF(EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY) + SET(EXPAT_FOUND 1) + SET(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) + SET(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) +ELSE(EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY) + SET(EXPAT_FOUND 0) + SET(EXPAT_LIBRARIES) + SET(EXPAT_INCLUDE_DIRS) +ENDIF(EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY) + +# Report the results. +IF(NOT EXPAT_FOUND) + SET(EXPAT_DIR_MESSAGE + "EXPAT was not found. Make sure EXPAT_LIBRARY and EXPAT_INCLUDE_DIR are set.") + IF(NOT EXPAT_FIND_QUIETLY) + MESSAGE(STATUS "${EXPAT_DIR_MESSAGE}") + ELSE(NOT EXPAT_FIND_QUIETLY) + IF(EXPAT_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${EXPAT_DIR_MESSAGE}") + ENDIF(EXPAT_FIND_REQUIRED) + ENDIF(NOT EXPAT_FIND_QUIETLY) +ENDIF(NOT EXPAT_FOUND) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 4fdbb28..781fecd 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -17,9 +17,15 @@ SET(JAVA_AWT_LIBRARY_DIRECTORIES /usr/local/lib /usr/lib/java/jre/lib/i386 /usr/local/lib/java/jre/lib/i386 + /usr/local/share/java/jre/lib/i386 /usr/lib/j2sdk1.4-sun/jre/lib/i386 /usr/lib/j2sdk1.5-sun/jre/lib/i386 /opt/sun-jdk-1.5.0.04/jre/lib/amd64 + /usr/lib/java/jre/lib/amd64 + /usr/local/lib/java/jre/lib/amd64 + /usr/local/share/java/jre/lib/amd64 + /usr/lib/j2sdk1.4-sun/jre/lib/amd64 + /usr/lib/j2sdk1.5-sun/jre/lib/amd64 ) SET(JAVA_AWT_INCLUDE_DIRECTORIES @@ -30,6 +36,7 @@ SET(JAVA_AWT_INCLUDE_DIRECTORIES /usr/local/include /usr/lib/java/include /usr/local/lib/java/include + /usr/local/share/java/include /usr/lib/j2sdk1.4-sun/include /usr/lib/j2sdk1.5-sun/include /opt/sun-jdk-1.5.0.04/include @@ -53,26 +60,20 @@ FOREACH(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") ENDFOREACH(JAVA_PROG) IF(APPLE) - IF(EXISTS ~/Library/Frameworks/JavaEmbedding.framework) + IF(EXISTS ~/Library/Frameworks/JavaVM.framework) SET(JAVA_HAVE_FRAMEWORK 1) - ENDIF(EXISTS ~/Library/Frameworks/JavaEmbedding.framework) - IF(EXISTS /Library/Frameworks/JavaEmbedding.framework) + ENDIF(EXISTS ~/Library/Frameworks/JavaVM.framework) + IF(EXISTS /Library/Frameworks/JavaVM.framework) SET(JAVA_HAVE_FRAMEWORK 1) - ENDIF(EXISTS /Library/Frameworks/JavaEmbedding.framework) - IF(EXISTS /System/Library/Frameworks/JavaEmbedding.framework) - SET(JAVA_HAVE_FRAMEWORK 1) - ENDIF(EXISTS /System/Library/Frameworks/JavaEmbedding.framework) + ENDIF(EXISTS /Library/Frameworks/JavaVM.framework) IF(JAVA_HAVE_FRAMEWORK) IF(NOT JAVA_AWT_LIBRARY) - SET (JAVA_AWT_LIBRARY "-framework JavaVM -framework JavaEmbedding" CACHE FILEPATH "Java Frameworks" FORCE) + SET (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) ENDIF(NOT JAVA_AWT_LIBRARY) SET(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} ~/Library/Frameworks/JavaVM.framework/Headers /Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers - ~/Library/Frameworks/JavaEmbedding.framework/Headers - /Library/Frameworks/JavaEmbedding.framework/Headers - /System/Library/Frameworks/JavaEmbedding.framework/Headers ) ENDIF(JAVA_HAVE_FRAMEWORK) ELSE(APPLE) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 5f7f6ff..a594450 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -22,6 +22,7 @@ SET(JAVA_BIN_PATH /usr/share/java/bin /usr/local/bin /usr/local/java/bin + /usr/local/java/share/bin /usr/java/j2sdk1.4.2_04 /usr/lib/j2sdk1.4-sun/bin /usr/java/j2sdk1.4.2_09/bin diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index f1545a0..12ab449 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -83,16 +83,22 @@ SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) #only on linux, but NOT e.g. on FreeBSD: IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-common") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -fno-exceptions -fno-check-new -fno-common") + SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") # works on FreeBSD, NOT tested on NetBSD and OpenBSD IF (CMAKE_SYSTEM_NAME MATCHES BSD) - SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-common") - SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") + SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD) +# if no special buildtype is selected, add -O2 as default optimization +IF (NOT CMAKE_BUILD_TYPE) + SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") + SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") +ENDIF (NOT CMAKE_BUILD_TYPE) + #SET(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") #SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index 65340b8..1af301d 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -27,3 +27,7 @@ ELSE (NOT PERL_EXECUTABLE) SET (PERL ${PERL_EXECUTABLE}) ENDIF (NOT PERL_EXECUTABLE) + +IF (NOT PERL_FOUND AND Perl_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Perl") +ENDIF (NOT PERL_FOUND AND Perl_FIND_REQUIRED) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d910747..4a401ed 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -76,6 +76,8 @@ # # QT_LIBRARY_DIR Path to "lib" of Qt4 # +# QT_PLUGINS_DIR Path to "plugins" for Qt4 +# # For every library of Qt there are three variables: # QT_QTFOO_LIBRARY_RELEASE, which contains the full path to the release version # QT_QTFOO_LIBRARY_DEBUG, which contains the full path to the debug version @@ -317,6 +319,13 @@ IF (QT4_QMAKE_FOUND) SET(QT_MKSPECS_DIR ${qt_mkspecs_dir} CACHE PATH "The location of the Qt mkspecs") ENDIF (NOT QT_MKSPECS_DIR) + # ask qmake for the plugins directory + IF (NOT QT_PLUGINS_DIR) + EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_INSTALL_PLUGINS" + OUTPUT_VARIABLE qt_plugins_dir ) + SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins") + ENDIF (NOT QT_PLUGINS_DIR) ######################################## # # Setting the INCLUDE-Variables diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index db86301..4bacc0f 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -32,8 +32,4 @@ FIND_PROGRAM(TCL_TCLSH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin ) -IF (WIN32) - MARK_AS_ADVANCED( - TCL_TCLSH - ) -ENDIF(WIN32) +MARK_AS_ADVANCED( TCL_TCLSH ) diff --git a/Modules/FindWish.cmake b/Modules/FindWish.cmake index ea48940..c8cd3f7 100644 --- a/Modules/FindWish.cmake +++ b/Modules/FindWish.cmake @@ -19,8 +19,4 @@ FIND_PROGRAM(TK_WISH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin ) -IF (WIN32) - MARK_AS_ADVANCED( - TK_WISH - ) -ENDIF(WIN32) +MARK_AS_ADVANCED(TK_WISH ) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake new file mode 100644 index 0000000..3d25993 --- /dev/null +++ b/Modules/FindXMLRPC.cmake @@ -0,0 +1,134 @@ +# - Find xmlrpc +# Find the native XMLRPC headers and libraries. +# XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc. +# XMLRPC_LIBRARIES - List of libraries when using xmlrpc. +# XMLRPC_FOUND - True if xmlrpc found. +# XMLRPC modules may be specified as components for this find module. +# Modules may be listed by running "xmlrpc-c-config". Modules include: +# c++ C++ wrapper code +# libwww-client libwww-based client +# cgi-server CGI-based server +# abyss-server ABYSS-based server +# Typical usage: +# FIND_PACKAGE(XMLRPC REQUIRED libwww-client) + +# First find the config script from which to obtain other values. +FIND_PROGRAM(XMLRPC_C_CONFIG NAMES xmlrpc-c-config) + +# Check whether we found anything. +IF(XMLRPC_C_CONFIG) + SET(XMLRPC_FOUND 1) +ELSE(XMLRPC_C_CONFIG) + SET(XMLRPC_FOUND 0) +ENDIF(XMLRPC_C_CONFIG) + +# Lookup the include directories needed for the components requested. +IF(XMLRPC_FOUND) + # Use the newer EXECUTE_PROCESS command if it is available. + IF(COMMAND EXECUTE_PROCESS) + EXECUTE_PROCESS( + COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags + OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT + ) + ELSE(COMMAND EXECUTE_PROCESS) + EXEC_PROGRAM(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags" + OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS + RETURN_VALUE XMLRPC_C_CONFIG_RESULT + ) + ENDIF(COMMAND EXECUTE_PROCESS) + + # Parse the include flags. + IF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + # Convert the compile flags to a CMake list. + STRING(REGEX REPLACE " +" ";" + XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}") + + # Look for -I options. + SET(XMLRPC_INCLUDE_DIRS) + FOREACH(flag ${XMLRPC_C_CONFIG_CFLAGS}) + IF("${flag}" MATCHES "^-I") + STRING(REGEX REPLACE "^-I" "" DIR "${flag}") + FILE(TO_CMAKE_PATH "${DIR}" DIR) + SET(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}") + ENDIF("${flag}" MATCHES "^-I") + ENDFOREACH(flag) + ELSE("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + MESSAGE("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]") + SET(XMLRPC_FOUND 0) + ENDIF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") +ENDIF(XMLRPC_FOUND) + +# Lookup the libraries needed for the components requested. +IF(XMLRPC_FOUND) + # Use the newer EXECUTE_PROCESS command if it is available. + IF(COMMAND EXECUTE_PROCESS) + EXECUTE_PROCESS( + COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs + OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT + ) + ELSE(COMMAND EXECUTE_PROCESS) + EXEC_PROGRAM(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs" + OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS + RETURN_VALUE XMLRPC_C_CONFIG_RESULT + ) + ENDIF(COMMAND EXECUTE_PROCESS) + + # Parse the library names and directories. + IF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + STRING(REGEX REPLACE " +" ";" + XMLRPC_C_CONFIG_LIBS "${XMLRPC_C_CONFIG_LIBS}") + + # Look for -L flags for directories and -l flags for library names. + SET(XMLRPC_LIBRARY_DIRS) + SET(XMLRPC_LIBRARY_NAMES) + FOREACH(flag ${XMLRPC_C_CONFIG_LIBS}) + IF("${flag}" MATCHES "^-L") + STRING(REGEX REPLACE "^-L" "" DIR "${flag}") + FILE(TO_CMAKE_PATH "${DIR}" DIR) + SET(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}") + ELSEIF("${flag}" MATCHES "^-l") + STRING(REGEX REPLACE "^-l" "" NAME "${flag}") + SET(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}") + ENDIF("${flag}" MATCHES "^-L") + ENDFOREACH(flag) + + # Search for each library needed using the directories given. + FOREACH(name ${XMLRPC_LIBRARY_NAMES}) + # Look for this library. + FIND_LIBRARY(XMLRPC_${name}_LIBRARY + NAMES ${name} + PATHS ${XMLRPC_LIBRARY_DIRS} + NO_DEFAULT_PATH + ) + MARK_AS_ADVANCED(XMLRPC_${name}_LIBRARY) + + # If any library is not found then the whole package is not found. + IF(NOT XMLRPC_${name}_LIBRARY) + SET(XMLRPC_FOUND 0) + ENDIF(NOT XMLRPC_${name}_LIBRARY) + + # Build an ordered list of all the libraries needed. + SET(XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES} "${XMLRPC_${name}_LIBRARY}") + ENDFOREACH(name) + ELSE("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") + MESSAGE("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]") + SET(XMLRPC_FOUND 0) + ENDIF("${XMLRPC_C_CONFIG_RESULT}" MATCHES "^0$") +ENDIF(XMLRPC_FOUND) + +# Report the results. +IF(NOT XMLRPC_FOUND) + SET(XMLRPC_DIR_MESSAGE + "XMLRPC was not found. Make sure the entries XMLRPC_* are set.") + IF(NOT XMLRPC_FIND_QUIETLY) + MESSAGE(STATUS "${XMLRPC_DIR_MESSAGE}") + ELSE(NOT XMLRPC_FIND_QUIETLY) + IF(XMLRPC_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${XMLRPC_DIR_MESSAGE}") + ENDIF(XMLRPC_FIND_REQUIRED) + ENDIF(NOT XMLRPC_FIND_QUIETLY) +ENDIF(NOT XMLRPC_FOUND) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index fc0bbb5..739b804 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -17,9 +17,6 @@ # FIND_PACKAGE(wxWidgets REQUIRED # ) # -# HAVE_ISYSTEM - if true wx warnings are suppressed on g++ -# by replacing -I with -isystem -# # The following are set after configuration is done: # # wxWidgets_FOUND - Set to TRUE if wxWidgets was found. @@ -117,7 +114,7 @@ IF (NOT wxWidgets_FIND_COMPONENTS) jpeg html media - msw msw26 msw27 msw28 + msw msw28 msw27 msw26 mono net odbc @@ -215,6 +212,8 @@ IF(WIN32_STYLE_FIND) # Find wxWidgets multilib base libraries FIND_LIBRARY(WX_base${_DBG} NAMES + wxbase28${_UCD}${_DBG} + wxbase27${_UCD}${_DBG} wxbase26${_UCD}${_DBG} wxbase25${_UCD}${_DBG} PATHS ${WX_LIB_DIR} @@ -224,6 +223,8 @@ IF(WIN32_STYLE_FIND) FOREACH(LIB net odbc xml) FIND_LIBRARY(WX_${LIB}${_DBG} NAMES + wxbase28${_UCD}${_DBG}_${LIB} + wxbase27${_UCD}${_DBG}_${LIB} wxbase26${_UCD}${_DBG}_${LIB} wxbase25${_UCD}${_DBG}_${LIB} PATHS ${WX_LIB_DIR} @@ -235,6 +236,8 @@ IF(WIN32_STYLE_FIND) # Find wxWidgets monolithic library FIND_LIBRARY(WX_mono${_DBG} NAMES + wxmsw${_UNV}28${_UCD}${_DBG} + wxmsw${_UNV}27${_UCD}${_DBG} wxmsw${_UNV}26${_UCD}${_DBG} wxmsw${_UNV}25${_UCD}${_DBG} PATHS ${WX_LIB_DIR} @@ -246,6 +249,8 @@ IF(WIN32_STYLE_FIND) FOREACH(LIB core adv html media xrc dbgrid gl qa) FIND_LIBRARY(WX_${LIB}${_DBG} NAMES + wxmsw${_UNV}28${_UCD}${_DBG}_${LIB} + wxmsw${_UNV}27${_UCD}${_DBG}_${LIB} wxmsw${_UNV}26${_UCD}${_DBG}_${LIB} wxmsw${_UNV}25${_UCD}${_DBG}_${LIB} PATHS ${WX_LIB_DIR} @@ -357,27 +362,35 @@ IF(WIN32_STYLE_FIND) # # Look for an installation tree. # - FIND_PATH(wxWidgets_ROOT_DIR include/wx/wx.h + FIND_PATH(wxWidgets_ROOT_DIR + NAMES include/wx/wx.h + PATHS + $ENV{wxWidgets_ROOT_DIR} $ENV{WXWIN} - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x - C:/wxWidgets-2.6.3 - D:/wxWidgets-2.6.3 - C:/wxWidgets-2.6.2 - D:/wxWidgets-2.6.2 - C:/wxWidgets-2.6.1 - D:/wxWidgets-2.6.1 - C:/wxWidgets-2.6.0 - D:/wxWidgets-2.6.0 - C:/wxWidgets-2.5.5 - D:/wxWidgets-2.5.5 - C:/wxWidgets-2.5.4 - D:/wxWidgets-2.5.4 - C:/wxWidgets-2.5.3 - D:/wxWidgets-2.5.3 - C:/wxWidgets-2.5.2 - D:/wxWidgets-2.5.2 - C:/wxWidgets-2.5.1 - D:/wxWidgets-2.5.1 + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" # WX 2.6.x + C:/ + D:/ + $ENV{ProgramFiles} + PATH_SUFFIXES + wxWidgets-2.8.4 + wxWidgets-2.8.3 + wxWidgets-2.8.2 + wxWidgets-2.8.1 + wxWidgets-2.8.0 + wxWidgets-2.7.4 + wxWidgets-2.7.3 + wxWidgets-2.7.2 + wxWidgest-2.7.1 + wxWidgets-2.7.0 + wxWidgets-2.7.0-1 + wxWidgets-2.6.3 + wxWidgets-2.6.2 + wxWidgets-2.6.1 + wxWidgets-2.5.4 + wxWidgets-2.5.3 + wxWidgets-2.5.2 + wxWidgets-2.5.1 + wxWidgets DOC "wxWidgets base/installation directory?" ) @@ -556,21 +569,6 @@ ELSE(WIN32_STYLE_FIND) # convert space to semicolons for list STRING(REGEX REPLACE " " ";" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") - # drop -I* from CXXFLAGS - postponed until -isystem is available to INCLUDE_DIRECTORIES to avoid pedantic warnings - #STRING(REGEX REPLACE "-I[^ ;]*" "" wxWidgets_CXX_FLAGS ${wxWidgets_CXX_FLAGS}) - - IF (HAVE_ISYSTEM) # does the compiler support -isystem ? - IF (NOT APPLE) # -isystem seem unsuppored on Mac - IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) - IF (CMAKE_CXX_COMPILER MATCHES g\\+\\+) # just to be sure - # handle WX include dirs as system directories - ignores pedantic warnings with gcc - # replace -I by -isystem - STRING(REGEX REPLACE "-I" "-isystem" wxWidgets_CXX_FLAGS ${wxWidgets_CXX_FLAGS}) - ENDIF(CMAKE_CXX_COMPILER MATCHES g\\+\\+) - ENDIF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) - ENDIF(NOT APPLE) - ENDIF(HAVE_ISYSTEM) - ELSE(RET EQUAL 0) DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}") SET(wxWidgets_FOUND FALSE) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 9595126..4ee74fe 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -27,6 +27,16 @@ InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" ;-------------------------------- +;General + + ;Name and file + Name "@CPACK_PACKAGE_INSTALL_DIRECTORY@" + OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" + + ;Set compression + SetCompressor @CPACK_NSIS_COMPRESSOR@ + +;-------------------------------- ; determine admin versus local install ; Is install for "AllUsers" or "JustMe"? ; Default to "JustMe" - set to "AllUsers" if admin or on Win9x @@ -72,13 +82,6 @@ Function .onInit FunctionEnd ;-------------------------------- -;General - - ;Name and file - Name "@CPACK_PACKAGE_INSTALL_DIRECTORY@" - OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" - -;-------------------------------- ;Interface Settings !define MUI_HEADERIMAGE diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index fe34bfc..386acf2 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -18,15 +18,23 @@ SET(CMAKE_MODULE_EXISTS 1) SET(CMAKE_FIND_LIBRARY_PREFIXES "cyg" "lib") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a") +SET(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,,--minor-image-version,") + SET(CMAKE_C_CREATE_SHARED_MODULE - " -o ") + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -o ") + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ") + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ") + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + +SET(CMAKE_C_LINK_EXECUTABLE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") +SET(CMAKE_CXX_LINK_EXECUTABLE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") # Shared libraries on cygwin can be named with their version number. SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 0005aa4..6f094a8 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -14,7 +14,7 @@ ELSE(CMAKE_VERBOSE_MAKEFILE) ENDIF(CMAKE_VERBOSE_MAKEFILE) # create a shared C++ library SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /PDB: /dll ${CMAKE_END_TEMP_FILE}") + "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /PDB: /dll /version:. ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared library @@ -39,10 +39,10 @@ SET(CMAKE_C_COMPILE_OBJECT SET(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /version:. ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /version:. ${CMAKE_END_TEMP_FILE}") SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-gcc.cmake b/Modules/Platform/Windows-gcc.cmake index a5152b3..8a2cf98 100644 --- a/Modules/Platform/Windows-gcc.cmake +++ b/Modules/Platform/Windows-gcc.cmake @@ -25,15 +25,23 @@ IF(MINGW) SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") ENDIF(MINGW) +SET(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,,--minor-image-version,") + SET(CMAKE_C_CREATE_SHARED_MODULE - " -o ") + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -o ") + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ") + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ") + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + +SET(CMAKE_C_LINK_EXECUTABLE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") +SET(CMAKE_CXX_LINK_EXECUTABLE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index a6440ae..cdd7a49 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -32,7 +32,11 @@ ENDMACRO(MSG) MSG("wxWidgets_FOUND=${wxWidgets_FOUND}") IF (wxWidgets_FOUND) IF (wxWidgets_INCLUDE_DIRS) - INCLUDE_DIRECTORIES( ${wxWidgets_INCLUDE_DIRS} ) + IF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) + INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS}) + ELSE(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) + INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS}) + ENDIF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM) MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}") ENDIF(wxWidgets_INCLUDE_DIRS) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 483ac82..955fd15 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -352,6 +352,13 @@ IF(BUILD_TESTING) SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE) ENDIF(NOT CMAKE_TEST_GENERATOR) + SET(CMAKE_TEST_SYSTEM_LIBRARIES 0) + FOREACH(util CURL EXPAT XMLRPC ZLIB) + IF(CMAKE_USE_SYSTEM_${util}) + SET(CMAKE_TEST_SYSTEM_LIBRARIES 1) + ENDIF(CMAKE_USE_SYSTEM_${util}) + ENDFOREACH(util) + # This variable is set by cmake, however to # test cmake we want to make sure that # the ctest from this cmake is used for testing @@ -602,6 +609,7 @@ IF(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" --build-options -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR} + -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES} --test-command complex ) @@ -615,6 +623,7 @@ IF(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" --build-options -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR} + -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES} --test-command complex) # ADD_TEST(complexRelativePaths ${CMAKE_CTEST_COMMAND} diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index fac48dc..e949aa6 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -184,6 +184,14 @@ int cmCPackGenericGenerator::InstallProject() return 0; } + // If the CPackConfig file sets CPACK_INSTALL_SCRIPT then run them + // as listed + if ( !this->InstallProjectViaInstallScript( + movable, tempInstallDirectory) ) + { + return 0; + } + // If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES // then glob it and copy it to CPACK_TEMPORARY_DIRECTORY // This is used in Source packageing @@ -258,6 +266,9 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCommands( const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS"); if ( installCommands && *installCommands ) { + std::string tempInstallDirectoryEnv = "CMAKE_INSTALL_PREFIX="; + tempInstallDirectoryEnv += tempInstallDirectory; + cmSystemTools::PutEnv(tempInstallDirectoryEnv.c_str()); std::vector installCommandsVector; cmSystemTools::ExpandListArgument(installCommands,installCommandsVector); std::vector::iterator it; @@ -391,6 +402,48 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories( } //---------------------------------------------------------------------- +int cmCPackGenericGenerator::InstallProjectViaInstallScript( + bool movable, const char* tempInstallDirectory) +{ + const char* cmakeScripts + = this->GetOption("CPACK_INSTALL_SCRIPT"); + std::string currentWorkingDirectory = + cmSystemTools::GetCurrentWorkingDirectory(); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install scripts: " << cmakeScripts << std::endl); + if ( cmakeScripts && *cmakeScripts ) + { + std::vector cmakeScriptsVector; + cmSystemTools::ExpandListArgument(cmakeScripts, + cmakeScriptsVector); + std::vector::iterator it; + for ( it = cmakeScriptsVector.begin(); + it != cmakeScriptsVector.end(); + ++it ) + { + std::string installScript = it->c_str(); + + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install script: " << installScript << std::endl); + if ( movable ) + { + this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory); + } + this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR", + tempInstallDirectory); + this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", + tempInstallDirectory); + int res = this->MakefileMap->ReadListFile(0, installScript.c_str()); + if ( cmSystemTools::GetErrorOccuredFlag() || !res ) + { + return 0; + } + } + } + return 1; +} + +//---------------------------------------------------------------------- int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects( bool movable, const char* tempInstallDirectory) { @@ -535,7 +588,8 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects( void cmCPackGenericGenerator::SetOptionIfNotSet(const char* op, const char* value) { - if ( this->MakefileMap->GetDefinition(op) ) + const char* def = this->MakefileMap->GetDefinition(op); + if ( def && *def ) { return; } diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h index a5a0ef7..afe79c0 100644 --- a/Source/CPack/cmCPackGenericGenerator.h +++ b/Source/CPack/cmCPackGenericGenerator.h @@ -110,6 +110,8 @@ protected: //! Run install commands if specified virtual int InstallProjectViaInstallCommands( bool movable, const char* tempInstallDirectory); + virtual int InstallProjectViaInstallScript( + bool movable, const char* tempInstallDirectory); virtual int InstallProjectViaInstalledDirectories( bool movable, const char* tempInstallDirectory); virtual int InstallProjectViaInstallCMakeProjects( diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 8b1c879..1b54701 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -232,6 +232,7 @@ int cmCPackNSISGenerator::InitializeInternal() this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS", deleteStr.str().c_str()); } + this->SetOptionIfNotSet("CPACK_NSIS_COMPRESSOR", "lzma"); return this->Superclass::InitializeInternal(); } diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index d4663db..133fe0a 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -26,7 +26,7 @@ #include "cmCPackLog.h" #include -#include +#include #include #include // auto_ptr #include @@ -94,7 +94,7 @@ int cmCPackTGZ_Data_Open(void *client_data, const char* pathname, mydata->ZLibStream.opaque = Z_NULL; int strategy = Z_DEFAULT_STRATEGY; if ( deflateInit2(&mydata->ZLibStream, mydata->CompressionLevel, - Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy) != Z_OK ) + Z_DEFLATED, -MAX_WBITS, 8, strategy) != Z_OK ) { return -1; } @@ -281,7 +281,8 @@ int cmCPackTGZGenerator::GenerateHeader(std::ostream* os) const int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ char header[11]; sprintf(header, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); + Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, + 3 /* zlib os code for UNIX, not really used anyway */); os->write(header, 10); } return 1; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d6d1cea..b056c0f 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -301,6 +301,12 @@ int main (int argc, char *argv[]) globalMF->AddDefinition(cdit->first.c_str(), cdit->second.c_str()); } + const char* cpackModulesPath = + globalMF->GetDefinition("CPACK_MODULE_PATH"); + if ( cpackModulesPath ) + { + globalMF->AddDefinition("CMAKE_MODULE_PATH", cpackModulesPath); + } const char* genList = globalMF->GetDefinition("CPACK_GENERATOR"); if ( !genList ) { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 81bc534..9bbb4a2 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -99,6 +99,7 @@ static const char* cmCTestErrorExceptions[] = { "candidates are:", ": warning", ": \\(Warning\\)", + ": note", "makefile:", "Makefile:", ":[ \\t]+Where:", @@ -109,6 +110,7 @@ static const char* cmCTestErrorExceptions[] = { static const char* cmCTestWarningMatches[] = { "([^ :]+):([0-9]+): warning:", + "([^ :]+):([0-9]+): note:", "^cc[^C]*CC: WARNING File = ([^,]+), Line = ([0-9]+)", "^ld([^:])*:([ \\t])*WARNING([^:])*:", "([^:]+): warning ([0-9]+):", @@ -248,6 +250,12 @@ int cmCTestBuildHandler::ProcessHandler() { cmCTestLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl); + // do we have time for this + if (this->CTest->GetRemainingTimeAllowed() < 120) + { + return 0; + } + int entry; for ( entry = 0; cmCTestWarningErrorFileLine[entry].RegularExpressionString; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 3e06656..b94bfab 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -180,6 +180,12 @@ int cmCTestCoverageHandler::ProcessHandler() { int error = 0; + // do we have time for this + if (this->CTest->GetRemainingTimeAllowed() < 120) + { + return error; + } + std::string sourceDir = this->CTest->GetCTestConfiguration("SourceDirectory"); std::string binaryDir @@ -251,7 +257,8 @@ int cmCTestCoverageHandler::ProcessHandler() if ( files.size() == 0 ) { - cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find any coverage files." + cmCTestLog(this->CTest, WARNING, + " Cannot find any coverage files. Ignoring Coverage request." << std::endl); // No coverage files is a valid thing, so the exit code is 0 cmSystemTools::ChangeDirectory(currentDirectory.c_str()); @@ -710,7 +717,8 @@ int cmCTestCoverageHandler::ProcessHandler() std::string line; for ( cc= 0; cc < fcov.size(); cc ++ ) { - if ( !cmSystemTools::GetLineFromStream(ifs, line) ) + if ( !cmSystemTools::GetLineFromStream(ifs, line) && + cc != fcov.size() -1 ) { cmOStringStream ostr; ostr << "Problem reading source file: " << fullFileName.c_str() diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index e9b6c09..1726071 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -334,7 +334,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } else { - cmCTestLog(this->CTest, ERROR_MESSAGE, + cmCTestLog(this->CTest, WARNING, "Memory checker (MemoryCheckCommand) " "not set, or cannot find the specified program." << std::endl); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0254214..ffc9f17 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -364,7 +364,8 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->Makefile->AddFunctionBlocker(f); // finally read in the script - if (!this->Makefile->ReadListFile(0, script.c_str())) + if (!this->Makefile->ReadListFile(0, script.c_str()) || + cmSystemTools::GetErrorOccuredFlag()) { return 2; } @@ -964,3 +965,24 @@ bool cmCTestScriptHandler::EmptyBinaryDirectory(const char *sname) } return true; } + +//------------------------------------------------------------------------- +double cmCTestScriptHandler::GetRemainingTimeAllowed() +{ + if (!this->Makefile) + { + return 1.0e7; + } + + const char *timelimitS + = this->Makefile->GetDefinition("CTEST_TIME_LIMIT"); + + if (!timelimitS) + { + return 1.0e7; + } + + double timelimit = atof(timelimitS); + + return timelimit - cmSystemTools::GetTime() + this->ScriptStartTime; +} diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 503ddcc..f82f3ea 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -96,6 +96,13 @@ public: static void SleepInSeconds(unsigned int secondsToWait); void UpdateElapsedTime(); + /** + * Return the time remaianing that the script is allowed to run in + * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has + * not been set it returns 1e7 seconds + */ + double GetRemainingTimeAllowed(); + cmCTestScriptHandler(); ~cmCTestScriptHandler(); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index b20388c..6fd24de 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -25,11 +25,10 @@ PURPOSE. See the above copyright notices for more information. #include // For XML-RPC submission -#include "xmlrpc.h" -#include "xmlrpc_client.h" +#include "cm_xmlrpc.h" // For curl submission -#include "cmcurl/curl/curl.h" +#include "cm_curl.h" #include @@ -644,12 +643,14 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, const cmStdString& url) { xmlrpc_env env; - std::string ctestVersion = cmVersion::GetCMakeVersion(); + char ctestString[] = "CTest"; + std::string ctestVersionString = cmVersion::GetCMakeVersion(); + char* ctestVersion = const_cast(ctestVersionString.c_str()); cmStdString realURL = url + "/" + remoteprefix + "/Command/"; /* Start up our XML-RPC client library. */ - xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, "CTest", ctestVersion.c_str()); + xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, ctestString, ctestVersion); /* Initialize our error-handling environment. */ xmlrpc_env_init(&env); @@ -697,9 +698,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, } fclose(fp); - std::string remoteCommand = "Submit.put"; - result = xmlrpc_client_call(&env, realURL.c_str(), - remoteCommand.c_str(), + char remoteCommand[] = "Submit.put"; + char* pRealURL = const_cast(realURL.c_str()); + result = xmlrpc_client_call(&env, pRealURL, remoteCommand, "(6)", fileBuffer, (xmlrpc_int32)fileSize ); delete [] fileBuffer; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f8be122..f88fa90 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -605,9 +605,18 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, { inREcnt++; } + + // if we are out of time then skip this test, we leave two minutes + // to submit results + if (this->CTest->GetRemainingTimeAllowed() - 120 <= 0) + { + continue; + } + const std::string& testname = it->Name; std::vector& args = it->Args; cmCTestTestResult cres; + cres.Properties = &*it; cres.ExecutionTime = 0; cres.ReturnValue = -1; cres.Status = cmCTestTestHandler::NOT_RUN; @@ -1001,6 +1010,20 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << result->CompletionStatus << "\n"; } os + << "\t\t\t" + << result->FullCommandLine << "\n"; + std::map::iterator measureIt; + for ( measureIt = result->Properties->Measurements.begin(); + measureIt != result->Properties->Measurements.end(); + ++ measureIt ) + { + os + << "\t\t\tfirst.c_str() << "\">" + << measureIt->second.c_str() << "\n"; + } + os << "\t\t\t\n" << "\t\t\t\t"; os << cmCTest::MakeXMLSafe(result->Output); @@ -1635,6 +1658,20 @@ bool cmCTestTestHandler::SetTestsProperties( cmsys::RegularExpression(crit->c_str())); } } + if ( key == "MEASUREMENT" ) + { + size_t pos = val.find_first_of("="); + if ( pos != val.npos ) + { + std::string mKey = val.substr(0, pos); + const char* mVal = val.c_str() + pos + 1; + rtit->Measurements[mKey] = mVal; + } + else + { + rtit->Measurements[val] = "1"; + } + } if ( key == "PASS_REGULAR_EXPRESSION" ) { std::vector lval; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index c1d3c8f..2fe1998 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -73,6 +73,20 @@ public: */ bool SetTestsProperties(const std::vector& args); + void Initialize(); + + struct cmCTestTestProperties + { + cmStdString Name; + cmStdString Directory; + std::vector Args; + std::vector ErrorRegularExpressions; + std::vector RequiredRegularExpressions; + std::map Measurements; + bool IsInBasedOnREOptions; + bool WillFail; + }; + struct cmCTestTestResult { std::string Name; @@ -85,23 +99,10 @@ public: std::string Output; std::string RegressionImages; int TestCount; + cmCTestTestProperties* Properties; }; - void Initialize(); - protected: - struct cmCTestTestProperties - { - cmStdString Name; - cmStdString Directory; - std::vector Args; - std::vector ErrorRegularExpressions; - std::vector RequiredRegularExpressions; - bool IsInBasedOnREOptions; - bool WillFail; - }; - - virtual int PreProcessHandler(); virtual int PostProcessHandler(); virtual void GenerateTestCommand(std::vector& args); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 7329a8d..fdf78af 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -278,7 +278,7 @@ int cmCTestUpdateHandler::ProcessHandler() if ( initialCheckoutCommand ) { cmCTestLog(this->CTest, HANDLER_OUTPUT, - " First perform the initil checkout: " << initialCheckoutCommand + " First perform the initial checkout: " << initialCheckoutCommand << std::endl); cmStdString parent = cmSystemTools::GetParentDirectory(sourceDirectory); if ( parent.empty() ) @@ -744,7 +744,7 @@ int cmCTestUpdateHandler::ProcessHandler() ofs << output << std::endl; } } - if ( res && retVal == 0) + if ( res ) { cmCTestLog(this->CTest, DEBUG, output << std::endl); std::string::size_type sline = 0; @@ -1090,7 +1090,7 @@ int cmCTestUpdateHandler::ProcessHandler() os << "" << std::endl; os << "" << std::endl; - if (! res || retVal ) + if (! res ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error(s) when updating the project" << std::endl); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b5e79a4..353af39 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -14,7 +14,7 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#include "cmcurl/curl/curl.h" +#include "cm_curl.h" #include "cmCTest.h" #include "cmake.h" @@ -568,6 +568,11 @@ bool cmCTest::UpdateCTestConfiguration() } fin.close(); } + if ( !this->GetCTestConfiguration("BuildDirectory").empty() ) + { + this->BinaryDir = this->GetCTestConfiguration("BuildDirectory"); + cmSystemTools::ChangeDirectory(this->BinaryDir.c_str()); + } this->TimeOut = atoi(this->GetCTestConfiguration("TimeOut").c_str()); if ( this->ProduceXML ) { @@ -787,7 +792,8 @@ int cmCTest::ProcessTests() break; } } - if ( this->Tests[UPDATE_TEST] || this->Tests[ALL_TEST] ) + if (( this->Tests[UPDATE_TEST] || this->Tests[ALL_TEST] ) && + (this->GetRemainingTimeAllowed() - 120 > 0)) { cmCTestGenericHandler* uphandler = this->GetHandler("update"); uphandler->SetPersistentOption("SourceDirectory", @@ -802,14 +808,16 @@ int cmCTest::ProcessTests() { return 0; } - if ( this->Tests[CONFIGURE_TEST] || this->Tests[ALL_TEST] ) + if (( this->Tests[CONFIGURE_TEST] || this->Tests[ALL_TEST] )&& + (this->GetRemainingTimeAllowed() - 120 > 0)) { if (this->GetHandler("configure")->ProcessHandler() < 0) { res |= cmCTest::CONFIGURE_ERRORS; } } - if ( this->Tests[BUILD_TEST] || this->Tests[ALL_TEST] ) + if (( this->Tests[BUILD_TEST] || this->Tests[ALL_TEST] )&& + (this->GetRemainingTimeAllowed() - 120 > 0)) { this->UpdateCTestConfiguration(); if (this->GetHandler("build")->ProcessHandler() < 0) @@ -817,7 +825,8 @@ int cmCTest::ProcessTests() res |= cmCTest::BUILD_ERRORS; } } - if ( this->Tests[TEST_TEST] || this->Tests[ALL_TEST] || notest ) + if (( this->Tests[TEST_TEST] || this->Tests[ALL_TEST] || notest ) && + (this->GetRemainingTimeAllowed() - 120 > 0)) { this->UpdateCTestConfiguration(); if (this->GetHandler("test")->ProcessHandler() < 0) @@ -825,7 +834,8 @@ int cmCTest::ProcessTests() res |= cmCTest::TEST_ERRORS; } } - if ( this->Tests[COVERAGE_TEST] || this->Tests[ALL_TEST] ) + if (( this->Tests[COVERAGE_TEST] || this->Tests[ALL_TEST] ) && + (this->GetRemainingTimeAllowed() - 120 > 0)) { this->UpdateCTestConfiguration(); if (this->GetHandler("coverage")->ProcessHandler() < 0) @@ -833,7 +843,8 @@ int cmCTest::ProcessTests() res |= cmCTest::COVERAGE_ERRORS; } } - if ( this->Tests[MEMCHECK_TEST] || this->Tests[ALL_TEST] ) + if (( this->Tests[MEMCHECK_TEST] || this->Tests[ALL_TEST] )&& + (this->GetRemainingTimeAllowed() - 120 > 0)) { this->UpdateCTestConfiguration(); if (this->GetHandler("memcheck")->ProcessHandler() < 0) @@ -1104,6 +1115,19 @@ int cmCTest::RunTest(std::vector argv, { cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } + + // do we have time for + double timeout = this->GetRemainingTimeAllowed() - 120; + if (this->TimeOut && this->TimeOut < timeout) + { + timeout = this->TimeOut; + } + // always have at least 1 second if we got to here + if (timeout <= 0) + { + timeout = 1; + } + cmsysProcess_SetTimeout(cp, this->TimeOut); cmsysProcess_Execute(cp); @@ -1300,159 +1324,12 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles) return this->SubmitExtraFiles(files); } -//---------------------------------------------------------------------- -bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, - const char* varg2) -{ - if ( varg1 && arg == varg1 || varg2 && arg == varg2 ) - { - return true; - } - return false; -} -//---------------------------------------------------------------------- -int cmCTest::Run(std::vectorconst& args, std::string* output) +//------------------------------------------------------- +// for a -D argument convert the next argument into +// the proper list of dashboard steps via SetTest +bool cmCTest::AddTestsForDashboardType(std::string &targ) { - this->FindRunningCMake(args[0].c_str()); - const char* ctestExec = "ctest"; - bool cmakeAndTest = false; - bool performSomeTest = true; - bool SRArgumentSpecified = false; - - // copy the command line - for(size_t i=0; i < args.size(); ++i) - { - this->InitialCommandLineArguments.push_back(args[i]); - } - for(size_t i=1; i < args.size(); ++i) - { - std::string arg = args[i]; - if(this->CheckArgument(arg, "--ctest-config") && i < args.size() - 1) - { - i++; - this->CTestConfigFile= args[i]; - } - - if(this->CheckArgument(arg, "-C", "--build-config") && - i < args.size() - 1) - { - i++; - this->ConfigType = args[i]; - cmSystemTools::ReplaceString(this->ConfigType, ".\\", ""); - if ( !this->ConfigType.empty() ) - { - std::string confTypeEnv - = "CMAKE_CONFIG_TYPE=" + this->ConfigType; - cmSystemTools::PutEnv(confTypeEnv.c_str()); - } - } - - if(this->CheckArgument(arg, "--debug")) - { - this->Debug = true; - this->ShowLineNumbers = true; - } - if(this->CheckArgument(arg, "--track") && i < args.size() - 1) - { - i++; - this->SpecificTrack = args[i]; - } - if(this->CheckArgument(arg, "--show-line-numbers")) - { - this->ShowLineNumbers = true; - } - if(this->CheckArgument(arg, "-Q", "--quiet")) - { - this->Quiet = true; - } - if(this->CheckArgument(arg, "-V", "--verbose")) - { - this->Verbose = true; - } - if(this->CheckArgument(arg, "-VV", "--extra-verbose")) - { - this->ExtraVerbose = true; - this->Verbose = true; - } - - if(this->CheckArgument(arg, "-N", "--show-only")) - { - this->ShowOnly = true; - } - - if(this->CheckArgument(arg, "-SP", "--script-new-process") && - i < args.size() - 1 ) - { - this->RunConfigurationScript = true; - i++; - cmCTestScriptHandler* ch - = static_cast(this->GetHandler("script")); - // -SR is an internal argument, -SP should be ignored when it is passed - if (!SRArgumentSpecified) - { - ch->AddConfigurationScript(args[i].c_str(),false); - } - } - - if(this->CheckArgument(arg, "-SR", "--script-run") && - i < args.size() - 1 ) - { - SRArgumentSpecified = true; - this->RunConfigurationScript = true; - i++; - cmCTestScriptHandler* ch - = static_cast(this->GetHandler("script")); - ch->AddConfigurationScript(args[i].c_str(),true); - } - - if(this->CheckArgument(arg, "-S", "--script") && i < args.size() - 1 ) - { - this->RunConfigurationScript = true; - i++; - cmCTestScriptHandler* ch - = static_cast(this->GetHandler("script")); - // -SR is an internal argument, -S should be ignored when it is passed - if (!SRArgumentSpecified) - { - ch->AddConfigurationScript(args[i].c_str(),true); - } - } - - if(this->CheckArgument(arg, "-O", "--output-log") && i < args.size() - 1 ) - { - i++; - this->SetOutputLogFileName(args[i].c_str()); - } - - if(this->CheckArgument(arg, "--tomorrow-tag")) - { - this->TomorrowTag = true; - } - if(this->CheckArgument(arg, "--force-new-ctest-process")) - { - this->ForceNewCTestProcess = true; - } - if(this->CheckArgument(arg, "--interactive-debug-mode") && - i < args.size() - 1 ) - { - i++; - this->InteractiveDebugMode = cmSystemTools::IsOn(args[i].c_str()); - } - if(this->CheckArgument(arg, "--submit-index") && i < args.size() - 1 ) - { - i++; - this->SubmitIndex = atoi(args[i].c_str()); - if ( this->SubmitIndex < 0 ) - { - this->SubmitIndex = 0; - } - } - if(this->CheckArgument(arg, "-D", "--dashboard") && i < args.size() - 1 ) - { - this->ProduceXML = true; - i++; - std::string targ = args[i]; if ( targ == "Experimental" ) { this->SetTestModel(cmCTest::EXPERIMENTAL); @@ -1631,84 +1508,144 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) } else { - performSomeTest = false; cmCTestLog(this, ERROR_MESSAGE, - "CTest -D called with incorrect option: " << targ << std::endl); + "CTest -D called with incorrect option: " + << targ << std::endl); cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl - << " " << ctestExec << " -D Continuous" << std::endl - << " " << ctestExec + << " " << "ctest" << " -D Continuous" << std::endl + << " " << "ctest" << " -D Continuous(Start|Update|Configure|Build)" << std::endl - << " " << ctestExec - << " -D Continuous(Test|Coverage|MemCheck|Submit)" << std::endl - << " " << ctestExec << " -D Experimental" << std::endl - << " " << ctestExec - << " -D Experimental(Start|Update|Configure|Build)" << std::endl - << " " << ctestExec - << " -D Experimental(Test|Coverage|MemCheck|Submit)" << std::endl - << " " << ctestExec << " -D Nightly" << std::endl - << " " << ctestExec + << " " << "ctest" + << " -D Continuous(Test|Coverage|MemCheck|Submit)" + << std::endl + << " " << "ctest" << " -D Experimental" << std::endl + << " " << "ctest" + << " -D Experimental(Start|Update|Configure|Build)" + << std::endl + << " " << "ctest" + << " -D Experimental(Test|Coverage|MemCheck|Submit)" + << std::endl + << " " << "ctest" << " -D Nightly" << std::endl + << " " << "ctest" << " -D Nightly(Start|Update|Configure|Build)" << std::endl - << " " << ctestExec + << " " << "ctest" << " -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl - << " " << ctestExec << " -D NightlyMemoryCheck" << std::endl); + << " " << "ctest" << " -D NightlyMemoryCheck" << std::endl); + return false; } + return true; +} + + +//---------------------------------------------------------------------- +bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, + const char* varg2) +{ + if ( varg1 && arg == varg1 || varg2 && arg == varg2 ) + { + return true; } + return false; +} - if(this->CheckArgument(arg, "-T", "--test-action") && - (i < args.size() -1) ) + +//---------------------------------------------------------------------- +// Processes one command line argument (and its arguments if any) +// for many simple options and then returns +void cmCTest::HandleCommandLineArguments(size_t &i, + std::vector &args) +{ + std::string arg = args[i]; + if(this->CheckArgument(arg, "--ctest-config") && i < args.size() - 1) { - this->ProduceXML = true; i++; - if ( !this->SetTest(args[i].c_str(), false) ) + this->CTestConfigFile= args[i]; + } + + if(this->CheckArgument(arg, "-C", "--build-config") && + i < args.size() - 1) { - performSomeTest = false; - cmCTestLog(this, ERROR_MESSAGE, - "CTest -T called with incorrect option: " - << args[i].c_str() << std::endl); - cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl - << " " << ctestExec << " -T all" << std::endl - << " " << ctestExec << " -T start" << std::endl - << " " << ctestExec << " -T update" << std::endl - << " " << ctestExec << " -T configure" << std::endl - << " " << ctestExec << " -T build" << std::endl - << " " << ctestExec << " -T test" << std::endl - << " " << ctestExec << " -T coverage" << std::endl - << " " << ctestExec << " -T memcheck" << std::endl - << " " << ctestExec << " -T notes" << std::endl - << " " << ctestExec << " -T submit" << std::endl); + i++; + this->SetConfigType(args[i].c_str()); + } + + if(this->CheckArgument(arg, "--debug")) + { + this->Debug = true; + this->ShowLineNumbers = true; + } + if(this->CheckArgument(arg, "--track") && i < args.size() - 1) + { + i++; + this->SpecificTrack = args[i]; + } + if(this->CheckArgument(arg, "--show-line-numbers")) + { + this->ShowLineNumbers = true; + } + if(this->CheckArgument(arg, "-Q", "--quiet")) + { + this->Quiet = true; } + if(this->CheckArgument(arg, "-V", "--verbose")) + { + this->Verbose = true; + } + if(this->CheckArgument(arg, "-VV", "--extra-verbose")) + { + this->ExtraVerbose = true; + this->Verbose = true; } - if(this->CheckArgument(arg, "-M", "--test-model") && - (i < args.size() -1) ) + if(this->CheckArgument(arg, "-N", "--show-only")) + { + this->ShowOnly = true; + } + + if(this->CheckArgument(arg, "-O", "--output-log") && i < args.size() - 1 ) { i++; - std::string const& str = args[i]; - if ( cmSystemTools::LowerCase(str) == "nightly" ) + this->SetOutputLogFileName(args[i].c_str()); + } + + if(this->CheckArgument(arg, "--tomorrow-tag")) { - this->SetTestModel(cmCTest::NIGHTLY); + this->TomorrowTag = true; } - else if ( cmSystemTools::LowerCase(str) == "continuous" ) + if(this->CheckArgument(arg, "--force-new-ctest-process")) { - this->SetTestModel(cmCTest::CONTINUOUS); + this->ForceNewCTestProcess = true; } - else if ( cmSystemTools::LowerCase(str) == "experimental" ) + if(this->CheckArgument(arg, "--interactive-debug-mode") && + i < args.size() - 1 ) { - this->SetTestModel(cmCTest::EXPERIMENTAL); + i++; + this->InteractiveDebugMode = cmSystemTools::IsOn(args[i].c_str()); } - else + if(this->CheckArgument(arg, "--submit-index") && i < args.size() - 1 ) { - performSomeTest = false; - cmCTestLog(this, ERROR_MESSAGE, - "CTest -M called with incorrect option: " << str.c_str() - << std::endl); - cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl - << " " << ctestExec << " -M Continuous" << std::endl - << " " << ctestExec << " -M Experimental" << std::endl - << " " << ctestExec << " -M Nightly" << std::endl); + i++; + this->SubmitIndex = atoi(args[i].c_str()); + if ( this->SubmitIndex < 0 ) + { + this->SubmitIndex = 0; + } + } + + if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1) + { + i++; + this->AddCTestConfigurationOverwrite(args[i].c_str()); } + if(this->CheckArgument(arg, "-A", "--add-notes") && i < args.size() - 1) + { + this->ProduceXML = true; + this->SetTest("Notes"); + i++; + this->SetNotesFiles(args[i].c_str()); } + // options that control what tests are run if(this->CheckArgument(arg, "-I", "--tests-information") && i < args.size() - 1) { @@ -1741,19 +1678,150 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) this->GetHandler("memcheck")-> SetPersistentOption("ExcludeRegularExpression", args[i].c_str()); } +} - if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1) +//---------------------------------------------------------------------- +// handle the -S -SR and -SP arguments +void cmCTest::HandleScriptArguments(size_t &i, + std::vector &args, + bool &SRArgumentSpecified) +{ + std::string arg = args[i]; + if(this->CheckArgument(arg, "-SP", "--script-new-process") && + i < args.size() - 1 ) { + this->RunConfigurationScript = true; i++; - this->AddCTestConfigurationOverwrite(args[i].c_str()); + cmCTestScriptHandler* ch + = static_cast(this->GetHandler("script")); + // -SR is an internal argument, -SP should be ignored when it is passed + if (!SRArgumentSpecified) + { + ch->AddConfigurationScript(args[i].c_str(),false); } - if(this->CheckArgument(arg, "-A", "--add-notes") && i < args.size() - 1) + } + + if(this->CheckArgument(arg, "-SR", "--script-run") && + i < args.size() - 1 ) + { + SRArgumentSpecified = true; + this->RunConfigurationScript = true; + i++; + cmCTestScriptHandler* ch + = static_cast(this->GetHandler("script")); + ch->AddConfigurationScript(args[i].c_str(),true); + } + + if(this->CheckArgument(arg, "-S", "--script") && i < args.size() - 1 ) + { + this->RunConfigurationScript = true; + i++; + cmCTestScriptHandler* ch + = static_cast(this->GetHandler("script")); + // -SR is an internal argument, -S should be ignored when it is passed + if (!SRArgumentSpecified) + { + ch->AddConfigurationScript(args[i].c_str(),true); + } + } +} + +//---------------------------------------------------------------------- +// the main entry point of ctest, called from main +int cmCTest::Run(std::vector &args, std::string* output) +{ + this->FindRunningCMake(args[0].c_str()); + const char* ctestExec = "ctest"; + bool cmakeAndTest = false; + bool performSomeTest = true; + bool SRArgumentSpecified = false; + + // copy the command line + for(size_t i=0; i < args.size(); ++i) + { + this->InitialCommandLineArguments.push_back(args[i]); + } + + // process the command line arguments + for(size_t i=1; i < args.size(); ++i) + { + // handle the simple commandline arguments + this->HandleCommandLineArguments(i,args); + + // handle the script arguments -S -SR -SP + this->HandleScriptArguments(i,args,SRArgumentSpecified); + + // handle a request for a dashboard + std::string arg = args[i]; + if(this->CheckArgument(arg, "-D", "--dashboard") && i < args.size() - 1 ) { this->ProduceXML = true; - this->SetTest("Notes"); i++; - this->SetNotesFiles(args[i].c_str()); + std::string targ = args[i]; + // AddTestsForDashboard parses the dashborad type and converts it + // into the seperate stages + if (!this->AddTestsForDashboardType(targ)) + { + performSomeTest = false; + } } + + if(this->CheckArgument(arg, "-T", "--test-action") && + (i < args.size() -1) ) + { + this->ProduceXML = true; + i++; + if ( !this->SetTest(args[i].c_str(), false) ) + { + performSomeTest = false; + cmCTestLog(this, ERROR_MESSAGE, + "CTest -T called with incorrect option: " + << args[i].c_str() << std::endl); + cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl + << " " << ctestExec << " -T all" << std::endl + << " " << ctestExec << " -T start" << std::endl + << " " << ctestExec << " -T update" << std::endl + << " " << ctestExec << " -T configure" << std::endl + << " " << ctestExec << " -T build" << std::endl + << " " << ctestExec << " -T test" << std::endl + << " " << ctestExec << " -T coverage" << std::endl + << " " << ctestExec << " -T memcheck" << std::endl + << " " << ctestExec << " -T notes" << std::endl + << " " << ctestExec << " -T submit" << std::endl); + } + } + + // what type of test model + if(this->CheckArgument(arg, "-M", "--test-model") && + (i < args.size() -1) ) + { + i++; + std::string const& str = args[i]; + if ( cmSystemTools::LowerCase(str) == "nightly" ) + { + this->SetTestModel(cmCTest::NIGHTLY); + } + else if ( cmSystemTools::LowerCase(str) == "continuous" ) + { + this->SetTestModel(cmCTest::CONTINUOUS); + } + else if ( cmSystemTools::LowerCase(str) == "experimental" ) + { + this->SetTestModel(cmCTest::EXPERIMENTAL); + } + else + { + performSomeTest = false; + cmCTestLog(this, ERROR_MESSAGE, + "CTest -M called with incorrect option: " << str.c_str() + << std::endl); + cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl + << " " << ctestExec << " -M Continuous" << std::endl + << " " << ctestExec << " -M Experimental" << std::endl + << " " << ctestExec << " -M Nightly" << std::endl); + } + } + if(this->CheckArgument(arg, "--extra-submit") && i < args.size() - 1) { this->ProduceXML = true; @@ -1764,11 +1832,16 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) return 0; } } + // --build-and-test options if(this->CheckArgument(arg, "--build-and-test") && i < args.size() - 1) { cmakeAndTest = true; } + + // pass the argument to all the handlers as well, but i may no longer be + // set to what it was originally so I'm not sure this is working as + // intended cmCTest::t_TestingHandlers::iterator it; for ( it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); @@ -1781,16 +1854,19 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) return 0; } } - } + } // the close of the for argument loop + - // default to the build type of ctest itself + // default to the build type of ctest itself if there is one +#ifdef CMAKE_INTDIR if(this->ConfigType.size() == 0) { -#ifdef CMAKE_INTDIR - this->ConfigType = CMAKE_INTDIR; -#endif + this->SetConfigType(CMAKE_INTDIR); } +#endif + // now what sould cmake do? if --build-and-test was specified then + // we run the build and test handler and return if(cmakeAndTest) { this->Verbose = true; @@ -1804,7 +1880,8 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) return retv; } - if(performSomeTest ) + // if some tests must be run + if(performSomeTest) { int res; // call process directory @@ -1837,11 +1914,9 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) it->second->SetVerbose(this->Verbose); it->second->SetSubmitIndex(this->SubmitIndex); } - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); if ( !this->Initialize( cmSystemTools::GetCurrentWorkingDirectory().c_str()) ) { - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); res = 12; cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." << std::endl); @@ -1854,6 +1929,7 @@ int cmCTest::Run(std::vectorconst& args, std::string* output) } return res; } + return 1; } @@ -2230,6 +2306,16 @@ void cmCTest::AddCTestConfigurationOverwrite(const char* encstr) } //---------------------------------------------------------------------- +void cmCTest::SetConfigType(const char* ct) +{ + this->ConfigType = ct?ct:""; + cmSystemTools::ReplaceString(this->ConfigType, ".\\", ""); + std::string confTypeEnv + = "CMAKE_CONFIG_TYPE=" + this->ConfigType; + cmSystemTools::PutEnv(confTypeEnv.c_str()); +} + +//---------------------------------------------------------------------- bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, const char* dconfig, const char* cmake_var) { @@ -2480,3 +2566,16 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg) } } +//------------------------------------------------------------------------- +double cmCTest::GetRemainingTimeAllowed() +{ + if (!this->GetHandler("script")) + { + return 1.0e7; + } + + cmCTestScriptHandler* ch + = static_cast(this->GetHandler("script")); + + return ch->GetRemainingTimeAllowed(); +} diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 14bdfcc..ca2e1a9 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -53,7 +53,7 @@ public: typedef std::set SetOfStrings; ///! Process Command line arguments - int Run(std::vectorconst&, std::string* output = 0); + int Run(std::vector &, std::string* output = 0); /** * Initialize and finalize testing @@ -137,6 +137,13 @@ public: ///! Get the current time as string std::string CurrentTime(); + /** + * Return the time remaianing that the script is allowed to run in + * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has + * not been set it returns 1e7 seconds + */ + double GetRemainingTimeAllowed(); + ///! Open file in the output directory and set the stream bool OpenOutputFile(const std::string& path, const std::string& name, @@ -269,6 +276,9 @@ public: //! Set the output log file name void SetOutputLogFileName(const char* name); + //! Set the visual studio or Xcode config type + void SetConfigType(const char* ct); + //! Various log types enum { DEBUG = 0, @@ -369,6 +379,18 @@ private: void BlockTestErrorDiagnostics(); + //! parse the option after -D and convert it into the appropriate steps + bool AddTestsForDashboardType(std::string &targ); + + //! parse and process most common command line arguments + void HandleCommandLineArguments(size_t &i, + std::vector &args); + + //! hande the -S -SP and -SR arguments + void HandleScriptArguments(size_t &i, + std::vector &args, + bool &SRArgumentSpecified); + //! Reread the configuration file bool UpdateCTestConfiguration(); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index f811e70..1c15ccd 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -969,8 +969,20 @@ void cmDocumentation::PrintColumn(std::ostream& os, const char* text) } //---------------------------------------------------------------------------- -void cmDocumentation::PrintHTMLEscapes(std::ostream& os, const char* text) +static bool cmDocumentationIsHyperlinkChar(char c) +{ + // This is not a complete list but works for CMake documentation. + return ((c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + (c >= '0' && c <= '9') || + c == '-' || c == '.' || c == '/' || c == '~' || c == '@' || + c == ':' || c == '_' || c == '&' || c == '?' || c == '='); +} + +//---------------------------------------------------------------------------- +static void cmDocumentationPrintHTMLChar(std::ostream& os, char c) { + // Use an escape sequence if necessary. static cmDocumentationEntry escapes[] = { {"<", "<", 0}, @@ -979,20 +991,73 @@ void cmDocumentation::PrintHTMLEscapes(std::ostream& os, const char* text) {"\n", "
", 0}, {0,0,0} }; - for(const char* p = text; *p; ++p) + for(const cmDocumentationEntry* op = escapes; op->name; ++op) { - bool found = false; - for(const cmDocumentationEntry* op = escapes; !found && op->name; ++op) - { - if(op->name[0] == *p) + if(op->name[0] == c) { os << op->brief; - found = true; + return; + } + } + + // No escape sequence is needed. + os << c; +} + +//---------------------------------------------------------------------------- +const char* cmDocumentationPrintHTMLLink(std::ostream& os, const char* begin) +{ + // Look for the end of the link. + const char* end = begin; + while(cmDocumentationIsHyperlinkChar(*end)) + { + ++end; + } + + // Print the hyperlink itself. + os << ""; + + // The name of the hyperlink is the text itself. + for(const char* c = begin; c != end; ++c) + { + cmDocumentationPrintHTMLChar(os, *c); + } + os << ""; + + // Return the position at which to continue scanning the input + // string. + return end; +} + +//---------------------------------------------------------------------------- +void cmDocumentation::PrintHTMLEscapes(std::ostream& os, const char* text) +{ + // Hyperlink prefixes. + static const char* hyperlinks[] = {"http://", "ftp://", "mailto:", 0}; + + // Print each character. + for(const char* p = text; *p;) + { + // Handle hyperlinks specially to make them active. + bool found_hyperlink = false; + for(const char** h = hyperlinks; !found_hyperlink && *h; ++h) + { + if(strncmp(p, *h, strlen(*h)) == 0) + { + p = cmDocumentationPrintHTMLLink(os, p); + found_hyperlink = true; } } - if(!found) + + // Print other characters normally. + if(!found_hyperlink) { - os << *p; + cmDocumentationPrintHTMLChar(os, *p++); } } } diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 835144f..767690f 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -19,7 +19,15 @@ #include -void cmExecuteProcessCommandFixText(std::vector& output); +#include /* isspace */ + +static bool cmExecuteProcessCommandIsWhitespace(char c) +{ + return (isspace((int)c) || c == '\n' || c == '\r'); +} + +void cmExecuteProcessCommandFixText(std::vector& output, + bool strip_trailing_whitespace); // cmExecuteProcessCommand bool cmExecuteProcessCommand @@ -36,6 +44,8 @@ bool cmExecuteProcessCommand size_t command_index = 0; bool output_quiet = false; bool error_quiet = false; + bool output_strip_trailing_whitespace = false; + bool error_strip_trailing_whitespace = false; std::string timeout_string; std::string input_file; std::string output_file; @@ -166,10 +176,27 @@ bool cmExecuteProcessCommand doing_command = false; error_quiet = true; } + else if(args[i] == "OUTPUT_STRIP_TRAILING_WHITESPACE") + { + doing_command = false; + output_strip_trailing_whitespace = true; + } + else if(args[i] == "ERROR_STRIP_TRAILING_WHITESPACE") + { + doing_command = false; + error_strip_trailing_whitespace = true; + } else if(doing_command) { cmds[command_index].push_back(args[i].c_str()); } + else + { + cmOStringStream e; + e << " given unknown argument \"" << args[i] << "\"."; + this->SetError(e.str().c_str()); + return false; + } } if ( !this->Makefile->CanIWriteThisFile(output_file.c_str()) ) @@ -294,8 +321,10 @@ bool cmExecuteProcessCommand cmsysProcess_WaitForExit(cp, 0); // Fix the text in the output strings. - cmExecuteProcessCommandFixText(tempOutput); - cmExecuteProcessCommandFixText(tempError); + cmExecuteProcessCommandFixText(tempOutput, + output_strip_trailing_whitespace); + cmExecuteProcessCommandFixText(tempError, + error_strip_trailing_whitespace); // Store the output obtained. if(!output_variable.empty() && tempOutput.size()) @@ -344,7 +373,8 @@ bool cmExecuteProcessCommand } //---------------------------------------------------------------------------- -void cmExecuteProcessCommandFixText(std::vector& output) +void cmExecuteProcessCommandFixText(std::vector& output, + bool strip_trailing_whitespace) { // Remove \0 characters and the \r part of \r\n pairs. unsigned int in_index = 0; @@ -358,6 +388,18 @@ void cmExecuteProcessCommandFixText(std::vector& output) output[out_index++] = c; } } + + // Remove trailing whitespace if requested. + if(strip_trailing_whitespace) + { + while(out_index > 0 && + cmExecuteProcessCommandIsWhitespace(output[out_index-1])) + { + --out_index; + } + } + + // Shrink the vector to the size needed. output.resize(out_index); // Put a terminator on the text string. diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index f69c414..a9286a7 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -78,7 +78,9 @@ public: " [OUTPUT_FILE ]\n" " [ERROR_FILE ]\n" " [OUTPUT_QUIET]\n" - " [ERROR_QUIET])\n" + " [ERROR_QUIET]\n" + " [OUTPUT_STRIP_TRAILING_WHITESPACE]\n" + " [ERROR_STRIP_TRAILING_WHITESPACE])\n" "Runs the given sequence of one or more commands with the standard " "output of each process piped to the standard input of the next. " "A single standard error pipe is used for all processes. " diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 605a790..08102c3 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -57,8 +57,13 @@ cmFindBase::cmFindBase() "" "This command is used to find a SEARCH_XXX_DESC. " "A cache entry named by is created to store the result " - "of this command. If nothing is found, the result will be " - "-NOTFOUND. The name of the SEARCH_XXX that " + "of this command. " + "If the SEARCH_XXX is found the result is stored in the variable " + "and the search will not be repeated unless the variable is cleared. " + "If nothing is found, the result will be " + "-NOTFOUND, and the search will be attempted again the " + "next time FIND_XXX is invoked with the same variable. " + "The name of the SEARCH_XXX that " "is searched for is specified by the names listed " "after the NAMES argument. Additional search locations " "can be specified after the PATHS argument. If ENV var is " diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index e173d47..c5724e8 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -54,44 +54,40 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args) return false; } + // Record options. this->Name = args[0]; - - // Build a list of required components. - std::string components; - const char* components_sep = ""; bool quiet = false; bool required = false; - if(args.size() > 1) - { + bool no_module = false; + std::string components; + const char* components_sep = ""; + + // Parse the arguments. + bool doing_components = false; cmsys::RegularExpression version("^[0-9.]+$"); bool haveVersion = false; for(unsigned int i=1; i < args.size(); ++i) { - if(!haveVersion && version.find(args[i].c_str())) + if(args[i] == "QUIET") { - haveVersion = true; + quiet = true; + doing_components = false; } - else if(args[i] == "QUIET") + else if(args[i] == "NO_MODULE") { - quiet = true; + no_module = true; + doing_components = false; } else if(args[i] == "REQUIRED") { - // The package is required. required = true; - - // Look for a list of required components. - while(++i < args.size()) - { - // Stop looking when a known keyword argument is - // encountered. - if((args[i] == "QUIET") || - (args[i] == "REQUIRED")) + doing_components = true; + } + else if(args[i] == "COMPONENTS") { - --i; - break; + doing_components = true; } - else + else if(doing_components) { // Set a variable telling the find script this component // is required. @@ -103,7 +99,9 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args) components += args[i]; components_sep = ";"; } - } + else if(!haveVersion && version.find(args[i].c_str())) + { + haveVersion = true; } else { @@ -117,9 +115,10 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args) // Store the list of components. std::string components_var = Name + "_FIND_COMPONENTS"; this->Makefile->AddDefinition(components_var.c_str(), components.c_str()); - } // See if there is a Find.cmake module. + if(!no_module) + { bool foundModule = false; if(!this->FindModule(foundModule, quiet, required)) { @@ -129,6 +128,7 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args) { return true; } + } // No find module. Assume the project has a CMake config file. Use // a _DIR cache variable to locate it. diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index eadc0e8..9126c72 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -65,8 +65,8 @@ public: virtual const char* GetFullDocumentation() { return - " FIND_PACKAGE( [major.minor] [QUIET]\n" - " [REQUIRED [componets...]])\n" + " FIND_PACKAGE( [major.minor] [QUIET] [NO_MODULE]\n" + " [[REQUIRED|COMPONENTS] [componets...]])\n" "Finds and loads settings from an external project. _FOUND will " "be set to indicate whether the package was found. Settings that " "can be used when _FOUND is true are package-specific. The " @@ -74,6 +74,7 @@ public: "Directories listed in CMAKE_MODULE_PATH are searched for files called " "\"Find.cmake\". If such a file is found, it is read and " "processed by CMake, and is responsible for finding the package. " + "This first step may be skipped by using the NO_MODULE option. " "If no such file is found, it is expected that the package is another " "project built by CMake that has a \"Config.cmake\" file. " "A cache entry called _DIR is created and is expected to be set " @@ -84,9 +85,10 @@ public: "argument is specified. If _DIR has been set to a directory " "not containing a \"Config.cmake\" file, an error is always " "generated. If REQUIRED is specified and the package is not found, " - "a FATAL_ERROR is generated and the configure step stops executing." - " A package-specific list of components may be listed after the " - "REQUIRED option."; + "a FATAL_ERROR is generated and the configure step stops executing. " + "A package-specific list of components may be listed after the " + "REQUIRED option, or after the COMPONENTS option if no REQUIRED " + "option is given."; } cmTypeMacro(cmFindPackageCommand, cmCommand); diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index e8be5fd..82ac2b7 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -27,7 +27,7 @@ #endif #if defined(CMAKE_BUILD_WITH_CMAKE) -# include +# include #endif //---------------------------------------------------------------------------- @@ -213,7 +213,7 @@ void cmGeneratedFileStreamBase::Close() int cmGeneratedFileStreamBase::CompressFile(const char* oldname, const char* newname) { - gzFile gf = cm_zlib_gzopen(newname, "w"); + gzFile gf = gzopen(newname, "w"); if ( !gf ) { return 0; @@ -228,15 +228,15 @@ int cmGeneratedFileStreamBase::CompressFile(const char* oldname, char buffer[BUFFER_SIZE]; while ( (res = fread(buffer, 1, BUFFER_SIZE, ifs)) > 0 ) { - if ( !cm_zlib_gzwrite(gf, buffer, res) ) + if ( !gzwrite(gf, buffer, res) ) { fclose(ifs); - cm_zlib_gzclose(gf); + gzclose(gf); return 0; } } fclose(ifs); - cm_zlib_gzclose(gf); + gzclose(gf); return 1; } #else diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 8d08c6b..278e2ae 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -53,6 +53,10 @@ bool cmGetDirectoryPropertyCommand::InitialPass( sd += "/"; sd += *i; } + + // The local generators are associated with collapsed paths. + sd = cmSystemTools::CollapseFullPath(sd.c_str()); + // lookup the makefile from the directory name cmLocalGenerator *lg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 00565f3..6b2b051 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1346,7 +1346,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' ) { singleLine.push_back("-C"); - singleLine.push_back(mf->GetDefinition("CMAKE_CFG_INTDIR")); + singleLine.push_back(cmakeCfgIntDir); } singleLine.push_back("--config"); std::string configFile = mf->GetStartOutputDirectory();; diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index c024f6f..30cb948 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -70,13 +70,9 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator() // // @echo "message with spaces" // - // it runs but the quotes are displayed. Instead we can separate - // with a semicolon - // - // @echo;message with spaces - // - // to hack around the problem. - lg->SetNativeEchoCommand("@echo;"); + // it runs but the quotes are displayed. Instead just use cmake to + // echo. + lg->SetNativeEchoCommand("@$(CMAKE_COMMAND) -E echo ", false); return lg; } diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 29a60d4..dc4089b 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -50,6 +50,7 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() lg->SetSilentNoColon(true); lg->SetDefineWindowsNULL(true); lg->SetWindowsShell(true); + lg->SetWatcomWMake(true); lg->SetMakeSilentFlag("-s -h"); lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6a2ec4f..770a796 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -866,17 +866,11 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag, std::string::size_type pos = flags.find(flag); if(pos != flags.npos) { - retFlag = flag; - // remove the flag - flags[pos]=' '; - flags[pos+1]=' '; - char pos2 = flags[pos+2]; - // if the pos after the option - if(pos2 != ' ' && pos2 != 0 ) + while(pos < flags.size() && flags[pos] != ' ') { - retFlag += pos2; - // remove the next part of the flag - flags[pos+2] = ' '; + retFlag += flags[pos]; + flags[pos] = ' '; + pos++; } } return retFlag; @@ -1392,7 +1386,19 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, optLevel[0] = '1'; } std::string gflagc = this->ExtractFlag("-g", cflags); + // put back gdwarf-2 if used since there is no way + // to represent it in the gui, but we still want debug yes + if(gflagc == "-gdwarf-2") + { + cflags += " "; + cflags += gflagc; + } std::string gflag = this->ExtractFlag("-g", flags); + if(gflag == "-gdwarf-2") + { + flags += " "; + flags += gflag; + } const char* debugStr = "YES"; if(gflagc.size() ==0 && gflag.size() == 0) { diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 0478392..3b98cae 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -289,29 +289,6 @@ bool cmIfCommand::IsTrue(const std::vector &args, IncrementArguments(newArgs,argP1,argP2); reducible = 1; } - // is file A newer than file B - if (*arg == "FILE_IS_NEWER" && - argP1 != newArgs.end() && argP2 != newArgs.end()) - { - int fileIsNewer=0; - bool success=cmSystemTools::FileTimeCompare((argP1)->c_str(), - (argP2)->c_str(), - &fileIsNewer); - if(success==false || fileIsNewer==1 || fileIsNewer==0) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - - newArgs.erase(argP2); - newArgs.erase(argP1); - argP1 = arg; - IncrementArguments(newArgs,argP1,argP2); - reducible = 1; - } // does a command exist if (*arg == "COMMAND" && argP1 != newArgs.end()) { @@ -417,9 +394,16 @@ bool cmIfCommand::IsTrue(const std::vector &args, { def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); - if (*(argP1) == "LESS") + double lhs; + double rhs; + if(sscanf(def, "%lg", &lhs) != 1 || + sscanf(def2, "%lg", &rhs) != 1) + { + *arg = "0"; + } + else if (*(argP1) == "LESS") { - if(atof(def) < atof(def2)) + if(lhs < rhs) { *arg = "1"; } @@ -430,7 +414,7 @@ bool cmIfCommand::IsTrue(const std::vector &args, } else if (*(argP1) == "GREATER") { - if(atof(def) > atof(def2)) + if(lhs > rhs) { *arg = "1"; } @@ -441,7 +425,7 @@ bool cmIfCommand::IsTrue(const std::vector &args, } else { - if(atof(def) == atof(def2)) + if(lhs == rhs) { *arg = "1"; } @@ -493,6 +477,29 @@ bool cmIfCommand::IsTrue(const std::vector &args, reducible = 1; } + // is file A newer than file B + if (argP1 != newArgs.end() && argP2 != newArgs.end() && + *(argP1) == "IS_NEWER_THAN") + { + int fileIsNewer=0; + bool success=cmSystemTools::FileTimeCompare(arg->c_str(), + (argP2)->c_str(), + &fileIsNewer); + if(success==false || fileIsNewer==1 || fileIsNewer==0) + { + *arg = "1"; + } + else + { + *arg = "0"; + } + newArgs.erase(argP2); + newArgs.erase(argP1); + argP1 = arg; + IncrementArguments(newArgs,argP1,argP2); + reducible = 1; + } + ++arg; } } diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 1d07248..757377c 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -129,7 +129,7 @@ public: " IF(EXISTS directory-name)\n" "True if the named file or directory exists. " "Behavior is well-defined only for full paths.\n" - " IF(FILE_IS_NEWER file1 file2)\n" + " IF(file1 IS_NEWER_THAN file2)\n" "True if file1 is newer than file2 or if one of the two files " "doesn't exist. " "Behavior is well-defined only for full paths.\n" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8694939..a6e44bd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -40,6 +40,7 @@ cmLocalGenerator::cmLocalGenerator() this->Parent = 0; this->WindowsShell = false; this->WindowsVSIDE = false; + this->WatcomWMake = false; this->MSYSShell = false; this->IgnoreLibPrefix = false; this->UseRelativePaths = false; @@ -840,6 +841,28 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, { return this->TargetImplib; } + if(variable == "TARGET_VERSION_MAJOR") + { + if(replaceValues.TargetVersionMajor) + { + return replaceValues.TargetVersionMajor; + } + else + { + return "0"; + } + } + if(variable == "TARGET_VERSION_MINOR") + { + if(replaceValues.TargetVersionMinor) + { + return replaceValues.TargetVersionMinor; + } + else + { + return "0"; + } + } if(replaceValues.Target) { if(variable == "TARGET_BASE") @@ -1629,7 +1652,9 @@ void cmLocalGenerator { // Compute the proper name to use to link this library. cmTarget* tgt = this->GlobalGenerator->FindTarget(0, lib.c_str()); - if(tgt) + if(tgt && (tgt->GetType() == cmTarget::STATIC_LIBRARY || + tgt->GetType() == cmTarget::SHARED_LIBRARY || + tgt->GetType() == cmTarget::MODULE_LIBRARY)) { // This is a CMake target. Ask the target for its real name. // Pass the full path to the target file but purposely leave @@ -2324,6 +2349,10 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, { flags |= cmsysSystem_Shell_Flag_EchoWindows; } + if(this->WatcomWMake) + { + flags |= cmsysSystem_Shell_Flag_WatcomWMake; + } // Compute the buffer size needed. int size = (this->WindowsShell ? diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 53b4220..4aa49a7 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -185,6 +185,8 @@ public: memset(this, 0, sizeof(*this)); } const char* TargetPDB; + const char* TargetVersionMajor; + const char* TargetVersionMinor; const char* Language; const char* Objects; const char* Target; @@ -276,6 +278,7 @@ protected: std::map UniqueObjectNamesMap; bool WindowsShell; bool WindowsVSIDE; + bool WatcomWMake; bool ForceUnixPath; bool MSYSShell; bool UseRelativePaths; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 96aa03c..8f2051f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -51,6 +51,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->SkipPreprocessedSourceRules = false; this->SkipAssemblySourceRules = false; this->NativeEchoCommand = "@echo "; + this->NativeEchoWindows = true; } //---------------------------------------------------------------------------- @@ -1046,7 +1047,8 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, { // Use the native echo command. cmd = this->NativeEchoCommand; - cmd += this->EscapeForShell(line.c_str(), false, true); + cmd += this->EscapeForShell(line.c_str(), false, + this->NativeEchoWindows); } else { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index e3b457a..45ec88f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -105,6 +105,11 @@ public: void SetWindowsShell(bool v) {this->WindowsShell = v;} /** + * Set to true if the make tool being used is Watcom WMake. + */ + void SetWatcomWMake(bool v) {this->WatcomWMake = v;} + + /** * Set to true if the shell being used is the MSYS shell. * This controls if statements in the makefile and the SHELL variable. * The default is false. @@ -135,8 +140,8 @@ public: * should include all parts of the command up to the beginning of * the message (including a whitespace separator). */ - void SetNativeEchoCommand(const char* cmd) - { this->NativeEchoCommand = cmd; } + void SetNativeEchoCommand(const char* cmd, bool isWindows) + { this->NativeEchoCommand = cmd; this->NativeEchoWindows = isWindows; } /** * Set the string used to include one makefile into another default @@ -341,6 +346,7 @@ private: std::string LibraryOutputPath; std::string ConfigurationName; std::string NativeEchoCommand; + bool NativeEchoWindows; bool DefineWindowsNULL; bool UnixCD; bool PassMakeflags; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index cbc438a..983fde2 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -766,34 +766,33 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, // header stuff customRuleCode += "PreLink_Cmds="; } - const char* prelink_newline = "\\\n\t"; for (std::vector::const_iterator cr = target.GetPreBuildCommands().begin(); cr != target.GetPreBuildCommands().end(); ++cr) { - if(++prelink_count == prelink_total) + if(prelink_count++ > 0) { - prelink_newline = ""; + customRuleCode += "\\\n\t"; } customRuleCode += this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory(), cr->GetEscapeOldStyle(), cr->GetEscapeAllowMakeVars(), - prelink_newline); + "\\\n\t"); } for (std::vector::const_iterator cr = target.GetPreLinkCommands().begin(); cr != target.GetPreLinkCommands().end(); ++cr) { - if(++prelink_count == prelink_total) + if(prelink_count++ > 0) { - prelink_newline = ""; + customRuleCode += "\\\n\t"; } customRuleCode += this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory(), cr->GetEscapeOldStyle(), cr->GetEscapeAllowMakeVars(), - prelink_newline); + "\\\n\t"); } if(prelink_total > 0) { @@ -805,7 +804,6 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, int postbuild_total = static_cast(target.GetPostBuildCommands().size()); int postbuild_count = 0; - const char* postbuild_newline = "\\\n\t"; if(postbuild_total > 0) { customRuleCode += "PostBuild_Cmds="; @@ -814,15 +812,15 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, target.GetPostBuildCommands().begin(); cr != target.GetPostBuildCommands().end(); ++cr) { - if(++postbuild_count == postbuild_total) + if(postbuild_count++ > 0) { - postbuild_newline = ""; + customRuleCode += "\\\n\t"; } customRuleCode += this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory(), cr->GetEscapeOldStyle(), cr->GetEscapeAllowMakeVars(), - postbuild_newline); + "\\\n\t"); } if(postbuild_total > 0) { @@ -1131,6 +1129,20 @@ void cmLocalVisualStudio6Generator } } + // Compute version number information. + std::string targetVersionFlag; + if(target.GetType() == cmTarget::EXECUTABLE || + target.GetType() == cmTarget::SHARED_LIBRARY || + target.GetType() == cmTarget::MODULE_LIBRARY) + { + int major; + int minor; + target.GetTargetVersion(major, minor); + cmOStringStream targetVersionStream; + targetVersionStream << "/version:" << major << "." << minor; + targetVersionFlag = targetVersionStream.str(); + } + // Compute the real name of the target. std::string outputName = "(OUTPUT_NAME is for libraries and executables only)"; @@ -1279,6 +1291,8 @@ void cmLocalVisualStudio6Generator cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", this->IncludeOptions.c_str()); + cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG", + targetVersionFlag.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH // are already quoted in the template file, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 72db6bc..5864669 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -801,6 +801,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp += targetFullName; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; + this->WriteTargetVersionAttribute(fout, target); for(std::map::iterator i = flagMap.begin(); i != flagMap.end(); ++i) { @@ -885,6 +886,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, temp += targetFullName; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; + this->WriteTargetVersionAttribute(fout, target); for(std::map::iterator i = flagMap.begin(); i != flagMap.end(); ++i) { @@ -925,6 +927,17 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } } +//---------------------------------------------------------------------------- +void +cmLocalVisualStudio7Generator +::WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target) +{ + int major; + int minor; + target.GetTargetVersion(major, minor); + fout << "\t\t\t\tVersion=\"" << major << "." << minor << "\"\n"; +} + void cmLocalVisualStudio7Generator ::OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target) @@ -1148,7 +1161,6 @@ void cmLocalVisualStudio7Generator { objectName = ""; } - // Add per-source flags. const char* cflags = (*sf)->GetProperty("COMPILE_FLAGS"); if(cflags) @@ -1161,6 +1173,12 @@ void cmLocalVisualStudio7Generator const char* linkLanguage = target.GetLinkerLanguage (this->GetGlobalGenerator()); + // If lang is set, the compiler will generate code automatically. + // If HEADER_FILE_ONLY is set, we must suppress this generation in + // the project file + bool excludedFromBuild = + (lang && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY")); + // if the source file does not match the linker language // then force c or c++ if(linkLanguage && lang && strcmp(lang, linkLanguage) != 0) @@ -1216,7 +1234,7 @@ void cmLocalVisualStudio7Generator command->GetOutputs(), flags); } else if(compileFlags.size() || additionalDeps.length() - || objectName.size()) + || objectName.size() || excludedFromBuild) { const char* aCompilerTool = "VCCLCompilerTool"; std::string ext = (*sf)->GetSourceExtension(); @@ -1238,8 +1256,13 @@ void cmLocalVisualStudio7Generator { fout << "\t\t\t\tPlatformName << "\">\n" - << "\t\t\t\t\tPlatformName << "\""; + if(excludedFromBuild) + { + fout << " ExcludedFromBuild=\"true\""; + } + fout << ">\n"; + fout << "\t\t\t\t\tEscapeForXML("\n"); + } std::string script = this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory(), @@ -1440,6 +1467,10 @@ void cmLocalVisualStudio7Generator fout << "\nCommandLine=\""; init = true; } + else + { + fout << this->EscapeForXML("\n"); + } std::string script = this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory(), @@ -1465,6 +1496,10 @@ void cmLocalVisualStudio7Generator fout << "\nCommandLine=\""; init = true; } + else + { + fout << this->EscapeForXML("\n"); + } std::string script = this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory(), diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index d52cc63..48dce0c 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -112,6 +112,7 @@ private: const std::vector& depends, const std::vector& outputs, const char* extraFlags); + void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target); void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 5a6df53..c4b1e99 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -113,15 +113,19 @@ cmLocalVisualStudioGenerator const char* workingDirectory, bool escapeOldStyle, bool escapeAllowMakeVars, - const char* newline) + const char* newline_text) { + // Avoid leading or trailing newlines. + const char* newline = ""; + // Store the script in a string. std::string script; if(workingDirectory) { + script += newline; + newline = newline_text; script += "cd "; script += this->Convert(workingDirectory, START_OUTPUT, SHELL); - script += newline; } // for visual studio IDE add extra stuff to the PATH // if CMAKE_MSVCIDE_RUN_PATH is set. @@ -131,16 +135,21 @@ cmLocalVisualStudioGenerator this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH"); if(extraPath) { + script += newline; + newline = newline_text; script += "set PATH="; script += extraPath; script += ";%PATH%"; - script += newline; } } // Write each command on a single line. for(cmCustomCommandLines::const_iterator cl = commandLines.begin(); cl != commandLines.end(); ++cl) { + // Start a new line. + script += newline; + newline = newline_text; + // Start with the command name. const cmCustomCommandLine& commandLine = *cl; script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL); @@ -159,9 +168,6 @@ cmLocalVisualStudioGenerator escapeAllowMakeVars); } } - - // End the line. - script += newline; } return script; } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index c8ef4d3..5905f84 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -372,6 +372,24 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.Objects = buildObjs.c_str(); vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); + + // Setup the target version. + std::string targetVersionMajor; + std::string targetVersionMinor; + { + cmOStringStream majorStream; + cmOStringStream minorStream; + int major; + int minor; + this->Target->GetTargetVersion(major, minor); + majorStream << major; + minorStream << minor; + targetVersionMajor = majorStream.str(); + targetVersionMinor = minorStream.str(); + } + vars.TargetVersionMajor = targetVersionMajor.c_str(); + vars.TargetVersionMinor = targetVersionMinor.c_str(); + std::string linkString = linklibs.str(); vars.LinkLibraries = linkString.c_str(); vars.Flags = flags.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d097d6e..9c3b973 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -531,13 +531,45 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules cleanObjs += ")"; cmLocalGenerator::RuleVariables vars; vars.TargetPDB = targetOutPathPDB.c_str(); + + // Setup the target version. + std::string targetVersionMajor; + std::string targetVersionMinor; + { + cmOStringStream majorStream; + cmOStringStream minorStream; + int major; + int minor; + this->Target->GetTargetVersion(major, minor); + majorStream << major; + minorStream << minor; + targetVersionMajor = majorStream.str(); + targetVersionMinor = minorStream.str(); + } + vars.TargetVersionMajor = targetVersionMajor.c_str(); + vars.TargetVersionMinor = targetVersionMinor.c_str(); + vars.Language = linkLanguage; vars.Objects = buildObjs.c_str(); std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash(); objdir += this->Target->GetName(); objdir += ".dir"; vars.ObjectDir = objdir.c_str(); + std::string targetLinkScriptPathReal; + if(useLinkScript) + { + // Paths in the link script are interpreted directly by the shell + // and not make. + targetLinkScriptPathReal = + this->Convert(targetFullPathReal.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.Target = targetLinkScriptPathReal.c_str(); + } + else + { vars.Target = targetOutPathReal.c_str(); + } std::string linkString = linklibs.str(); vars.LinkLibraries = linkString.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 86cb41a..cf777a6 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -108,7 +108,11 @@ public: "the same version number. " "For executables VERSION can be used to specify the build version. " "When building or installing appropriate symlinks are created if " - "the platform supports symlinks.\n" + "the platform supports symlinks. " + "For shared libraries and executables on Windows the VERSION " + "attribute is parsed to extract a \"major.minor\" version number. " + "These numbers are used as the image version of the binary. " + "\n" "There are a few properties used to specify RPATH rules. " "INSTALL_RPATH is a semicolon-separated list specifying the rpath " "to use in installed targets (for platforms that support it). " diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 4d257b2..8746c7a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -48,7 +48,7 @@ # include # include // auto_ptr # include -# include +# include #endif #if defined(__sgi) && !defined(__GNUC__) @@ -1439,7 +1439,7 @@ int cmSystemToolsGZStructOpen(void* call_data, const char *pathname, } #endif - gzf->GZFile = cm_zlib_gzdopen(fd, gzoflags); + gzf->GZFile = gzdopen(fd, gzoflags); if (!gzf->GZFile) { errno = ENOMEM; @@ -1452,20 +1452,20 @@ int cmSystemToolsGZStructOpen(void* call_data, const char *pathname, int cmSystemToolsGZStructClose(void* call_data) { cmSystemToolsGZStruct* gzf = static_cast(call_data); - return cm_zlib_gzclose(gzf->GZFile); + return gzclose(gzf->GZFile); } ssize_t cmSystemToolsGZStructRead(void* call_data, void* buf, size_t count) { cmSystemToolsGZStruct* gzf = static_cast(call_data); - return cm_zlib_gzread(gzf->GZFile, buf, count); + return gzread(gzf->GZFile, buf, count); } ssize_t cmSystemToolsGZStructWrite(void* call_data, const void* buf, size_t count) { cmSystemToolsGZStruct* gzf = static_cast(call_data); - return cm_zlib_gzwrite(gzf->GZFile, (void*)buf, count); + return gzwrite(gzf->GZFile, (void*)buf, count); } #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 57b01b1..b2c5dc2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -890,6 +890,29 @@ const char* cmTarget::GetLocation(const char* config) return this->Location.c_str(); } +//---------------------------------------------------------------------------- +void cmTarget::GetTargetVersion(int& major, int& minor) +{ + // Set the default values. + major = 0; + minor = 0; + + // Look for a VERSION property. + if(const char* version = this->GetProperty("VERSION")) + { + // Try to parse the version number and store the results that were + // successfully parsed. + int parsed_major; + int parsed_minor; + switch(sscanf(version, "%d.%d", &parsed_major, &parsed_minor)) + { + case 2: minor = parsed_minor; // no break! + case 1: major = parsed_major; // no break! + default: break; + } + } +} + const char *cmTarget::GetProperty(const char* prop) { // watch for special "computed" properties that are dependent on other @@ -1442,16 +1465,29 @@ void cmTarget::GetExecutableNamesInternal(std::string& name, } #endif + // Get the components of the executable name. + std::string prefix; + std::string base; + std::string suffix; + this->GetFullNameInternal(type, config, false, prefix, base, suffix); + // The executable name. - name = this->GetFullNameInternal(type, config, false); + name = prefix+base+suffix; // The executable's real name on disk. +#if defined(__CYGWIN__) + realName = prefix+base; +#else realName = name; +#endif if(version) { realName += "-"; realName += version; } +#if defined(__CYGWIN__) + realName += suffix; +#endif } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 557461f..0dd645d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -176,6 +176,11 @@ public: target property. */ const char* GetLocation(const char* config); + /** Get the target major and minor version numbers interpreted from + the VERSION property. Version 0 is returned if the property is + not set or cannot be parsed. */ + void GetTargetVersion(int& major, int& minor); + /** * Trace through the source files in this target and add al source files * that they depend on, used by the visual studio generators diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 58f3656..2894090 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -16,7 +16,7 @@ =========================================================================*/ #include "cmXMLParser.h" -#include +#include #include //---------------------------------------------------------------------------- diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f19d9d1..d7a89c6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -996,6 +996,9 @@ int cmake::ExecuteCMakeCommand(std::vector& args) std::string dirName = args[2]; dirName += "/Progress"; cmSystemTools::RemoveADirectory(dirName.c_str()); + int count = atoi(args[3].c_str()); + if (count) + { cmSystemTools::MakeDirectory(dirName.c_str()); // write the count into the directory std::string fName = dirName; @@ -1003,10 +1006,10 @@ int cmake::ExecuteCMakeCommand(std::vector& args) FILE *progFile = fopen(fName.c_str(),"w"); if (progFile) { - int count = atoi(args[3].c_str()); fprintf(progFile,"%i\n",count); fclose(progFile); } + } return 0; } @@ -1017,6 +1020,21 @@ int cmake::ExecuteCMakeCommand(std::vector& args) dirName += "/Progress"; std::string fName; FILE *progFile; + + // read the count + fName = dirName; + fName += "/count.txt"; + progFile = fopen(fName.c_str(),"r"); + int count = 0; + if (!progFile) + { + return 0; + } + else + { + fscanf(progFile,"%i",&count); + fclose(progFile); + } unsigned int i; for (i = 3; i < args.size(); ++i) { @@ -1032,20 +1050,10 @@ int cmake::ExecuteCMakeCommand(std::vector& args) } int fileNum = static_cast (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str())); - // read the count - fName = dirName; - fName += "/count.txt"; - progFile = fopen(fName.c_str(),"r"); - if (progFile) - { - int count = 0; - fscanf(progFile,"%i",&count); if (count > 0) { // print the progress fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count); - } - fclose(progFile); } return 0; } @@ -1710,7 +1718,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) this->SetArgs(args); if(cmSystemTools::GetErrorOccuredFlag()) { - CMakeCommandUsage(args[0].c_str()); return -1; } diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index e3f8ff2..b3febd2 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -914,6 +914,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) GET_TEST_PROPERTY(kwsys.testFail WILL_FAIL wfv) SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed") SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES PASS_REGULAR_EXPRESSION "Test passed") + SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value") MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}") ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE) ENDIF(BUILD_TESTING) diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index 33e1149..62807c8 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -59,7 +59,7 @@ static int kwsysSystem_Shell__CharIsWhitespace(char c) /*--------------------------------------------------------------------------*/ static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c) { - return ((c == '\'') || (c == '`') || (c == ';') || + return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || (c == '&') || (c == '$') || (c == '(') || (c == ')')); } @@ -222,7 +222,7 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in, } } - /* Check whether this character needs escaping. */ + /* Check whether this character needs escaping for the shell. */ if(isUnix) { /* On Unix a few special characters need escaping even inside a @@ -261,7 +261,7 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in, } } - /* The dollar sign needs special handling in some environments. */ + /* Check whether this character needs escaping for a make tool. */ if(*c == '$') { if(flags & kwsysSystem_Shell_Flag_Make) @@ -277,6 +277,16 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in, size += 2; } } + else if(*c == '#') + { + if((flags & kwsysSystem_Shell_Flag_Make) && + (flags & kwsysSystem_Shell_Flag_WatcomWMake)) + { + /* In Watcom WMake makefiles a pound is written $# so we need + one extra character. */ + ++size; + } + } } /* Check whether the argument needs surrounding quotes. */ @@ -333,7 +343,7 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, } } - /* Check whether this character needs escaping. */ + /* Check whether this character needs escaping for the shell. */ if(isUnix) { /* On Unix a few special characters need escaping even inside a @@ -377,7 +387,7 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, } } - /* The dollar sign needs special handling in some environments. */ + /* Check whether this character needs escaping for a make tool. */ if(*c == '$') { if(flags & kwsysSystem_Shell_Flag_Make) @@ -405,6 +415,23 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, *out++ = '$'; } } + else if(*c == '#') + { + if((flags & kwsysSystem_Shell_Flag_Make) && + (flags & kwsysSystem_Shell_Flag_WatcomWMake)) + { + /* In Watcom WMake makefiles a pound is written $#. The make + tool will replace it with just # before passing it to the + shell. */ + *out++ = '$'; + *out++ = '#'; + } + else + { + /* Otherwise a pound is written just #. */ + *out++ = '#'; + } + } else { /* Store this character. */ diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in index 8c7d2a8..731bec9 100644 --- a/Source/kwsys/System.h.in +++ b/Source/kwsys/System.h.in @@ -32,6 +32,7 @@ #define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make) #define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE) #define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows) +#define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake) #define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables) #if defined(__cplusplus) @@ -82,12 +83,15 @@ enum kwsysSystem_Shell_Flag_e /** In a windows whell the argument is being passed to "echo". */ kwsysSystem_Shell_Flag_EchoWindows = (1<<2), + /** The target shell is in a Watcom WMake makefile. */ + kwsysSystem_Shell_Flag_WatcomWMake = (1<<3), + /** Make variable reference syntax $(MAKEVAR) should not be escaped to allow a build tool to replace it. Replacement values containing spaces, quotes, backslashes, or other non-alphanumeric characters that have significance to some makes or shells produce undefined behavior. */ - kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<3) + kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<4) }; #if defined(__cplusplus) @@ -107,6 +111,7 @@ enum kwsysSystem_Shell_Flag_e # undef kwsysSystem_Shell_Flag_Make # undef kwsysSystem_Shell_Flag_VSIDE # undef kwsysSystem_Shell_Flag_EchoWindows +# undef kwsysSystem_Shell_Flag_WatcomWMake # undef kwsysSystem_Shell_Flag_AllowMakeVariables #endif diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 86873fb..3f4eee3 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4091,12 +4091,14 @@ namespace KWSYS_NAMESPACE static int SystemToolsDebugReport(int, char* message, int*) { - fprintf(stderr, message); - exit(1); + fprintf(stderr, "%s", message); + fflush(stderr); + return 1; // no further reporting required } + void SystemTools::EnableMSVCDebugHook() { - if(getenv("DART_TEST_FROM_DART")) + if (getenv("DART_TEST_FROM_DART")) { _CrtSetReportHook(SystemToolsDebugReport); } @@ -4109,5 +4111,3 @@ namespace KWSYS_NAMESPACE void SystemTools::EnableMSVCDebugHook() {} } // namespace KWSYS_NAMESPACE #endif - - diff --git a/Source/kwsys/SystemTools.cxx.bak b/Source/kwsys/SystemTools.cxx.bak index 8d95811..86873fb 100644 --- a/Source/kwsys/SystemTools.cxx.bak +++ b/Source/kwsys/SystemTools.cxx.bak @@ -337,6 +337,10 @@ const char* SystemTools::GetExecutableExtension() bool SystemTools::MakeDirectory(const char* path) { + if(!path) + { + return false; + } if(SystemTools::FileExists(path)) { return true; @@ -1366,18 +1370,32 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path) { ret.erase(pos, 1); } - // now escape spaces if there is a space in the path - if(ret.find(" ") != kwsys_stl::string::npos) + // escape spaces and () in the path + if(ret.find_first_of(" ()") != kwsys_stl::string::npos) { kwsys_stl::string result = ""; char lastch = 1; + bool inDollarVariable = false; for(const char* ch = ret.c_str(); *ch != '\0'; ++ch) { // if it is already escaped then don't try to escape it again - if(*ch == ' ' && lastch != '\\') + if((*ch == ' ' || *ch == '(' || *ch == ')') && lastch != '\\') + { + if(*ch == '(' && lastch == '$') + { + inDollarVariable = true; + } + // if we are in a $(..... and we get a ) then do not escape + // the ) and but set inDollarVariable to false + else if(*ch == ')' && inDollarVariable) + { + inDollarVariable = false; + } + else { result += '\\'; } + } result += *ch; lastch = *ch; } @@ -1764,7 +1782,7 @@ long int SystemTools::CreationTime(const char* filename) bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt) { - if (!str || !tmt || strlen(str) < 12) + if (!str || !tmt || strlen(str) > 11) { return false; } @@ -1812,7 +1830,7 @@ bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt) bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt) { - if (!str || !tmt || strlen(str) < 27) + if (!str || !tmt || strlen(str) > 26) { return false; } @@ -2242,6 +2260,17 @@ kwsys_stl::string SystemTools bool SystemTools::FileIsDirectory(const char* name) { + // Remove any trailing slash from the name. + char buffer[KWSYS_SYSTEMTOOLS_MAXPATH]; + int last = static_cast(strlen(name))-1; + if(last >= 0 && (name[last] == '/' || name[last] == '\\')) + { + memcpy(buffer, name, last); + buffer[last] = 0; + name = buffer; + } + + // Now check the file node type. struct stat fs; if(stat(name, &fs) == 0) { @@ -2441,7 +2470,8 @@ void SystemTools::AddTranslationPath(const char * a, const char * b) void SystemTools::AddKeepPath(const char* dir) { - kwsys_stl::string cdir = SystemTools::CollapseFullPath(dir); + kwsys_stl::string cdir; + Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir); SystemTools::AddTranslationPath(cdir.c_str(), dir); } @@ -2798,20 +2828,36 @@ void SystemTools::SplitPath(const char* p, kwsys_stl::string SystemTools::JoinPath(const kwsys_stl::vector& components) { + return SystemTools::JoinPath(components.begin(), components.end()); +} + +//---------------------------------------------------------------------------- +kwsys_stl::string +SystemTools +::JoinPath(kwsys_stl::vector::const_iterator first, + kwsys_stl::vector::const_iterator last) +{ + // Construct result in a single string. kwsys_stl::string result; - if(components.size() > 0) + + // The first two components do not add a slash. + if(first != last) { - result += components[0]; + result += *first++; } - if(components.size() > 1) + if(first != last) { - result += components[1]; + result += *first++; } - for(unsigned int i=2; i < components.size(); ++i) + + // All remaining components are always separated with a slash. + while(first != last) { result += "/"; - result += components[i]; + result += *first++; } + + // Return the concatenated result. return result; } @@ -3348,7 +3394,7 @@ kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format) time_t t; time(&t); strftime(buf, sizeof(buf), format, localtime(&t)); - return buf; + return kwsys_stl::string(buf); } kwsys_stl::string SystemTools::MakeCindentifier(const char* s) @@ -3374,39 +3420,49 @@ kwsys_stl::string SystemTools::MakeCindentifier(const char* s) // Due to a buggy stream library on the HP and another on Mac OSX, we // need this very carefully written version of getline. Returns true // if any data were read before the end-of-file was reached. -bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, kwsys_stl::string& line, - bool *has_newline /* = 0 */) +bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, + kwsys_stl::string& line, + bool* has_newline /* = 0 */) { const int bufferSize = 1024; char buffer[bufferSize]; - line = ""; bool haveData = false; - if ( has_newline ) - { - *has_newline = false; - } + bool haveNewline = false; + + // Start with an empty line. + line = ""; // If no characters are read from the stream, the end of file has - // been reached. - while((is.getline(buffer, bufferSize), is.gcount() > 0)) + // been reached. Clear the fail bit just before reading. + while(!haveNewline && + (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit), + is.getline(buffer, bufferSize), is.gcount() > 0)) { + // We have read at least one byte. haveData = true; - line.append(buffer); - // If newline character was read, the gcount includes the - // character, but the buffer does not. The end of line has been - // reached. - if(strlen(buffer) < static_cast(is.gcount())) + // If newline character was read the gcount includes the character + // but the buffer does not: the end of line has been reached. + size_t length = strlen(buffer); + if(length < static_cast(is.gcount())) { - if ( has_newline ) + haveNewline = true; + } + + // Avoid storing a carriage return character. + if(length > 0 && buffer[length-1] == '\r') { - *has_newline = true; + buffer[length-1] = 0; } - break; + + // Append the data read to the line. + line.append(buffer); } - // The fail bit may be set. Clear it. - is.clear(is.rdstate() & ~kwsys_ios::ios::failbit); + // Return the results. + if(has_newline) + { + *has_newline = haveNewline; } return haveData; } diff --git a/Source/kwsys/kwsysPlatformCxxTests.cmake b/Source/kwsys/kwsysPlatformCxxTests.cmake deleted file mode 100644 index 7775457..0000000 --- a/Source/kwsys/kwsysPlatformCxxTests.cmake +++ /dev/null @@ -1,45 +0,0 @@ -MACRO(KWSYS_PLATFORM_CXX_TEST var description invert) - IF("${var}_COMPILED" MATCHES "^${var}_COMPILED$") - MESSAGE(STATUS "${description}") - TRY_COMPILE(${var}_COMPILED - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx - COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_CXX_TEST_DEFINES} - OUTPUT_VARIABLE OUTPUT) - IF(${var}_COMPILED) - FILE(APPEND - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "${description} compiled with the following output:\n${OUTPUT}\n\n") - ELSE(${var}_COMPILED) - FILE(APPEND - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "${description} failed to compile with the following output:\n${OUTPUT}\n\n") - ENDIF(${var}_COMPILED) - IF(${invert} MATCHES INVERT) - IF(${var}_COMPILED) - MESSAGE(STATUS "${description} - no") - ELSE(${var}_COMPILED) - MESSAGE(STATUS "${description} - yes") - ENDIF(${var}_COMPILED) - ELSE(${invert} MATCHES INVERT) - IF(${var}_COMPILED) - MESSAGE(STATUS "${description} - yes") - ELSE(${var}_COMPILED) - MESSAGE(STATUS "${description} - no") - ENDIF(${var}_COMPILED) - ENDIF(${invert} MATCHES INVERT) - ENDIF("${var}_COMPILED" MATCHES "^${var}_COMPILED$") - IF(${invert} MATCHES INVERT) - IF(${var}_COMPILED) - SET(${var} 0) - ELSE(${var}_COMPILED) - SET(${var} 1) - ENDIF(${var}_COMPILED) - ELSE(${invert} MATCHES INVERT) - IF(${var}_COMPILED) - SET(${var} 1) - ELSE(${var}_COMPILED) - SET(${var} 0) - ENDIF(${var}_COMPILED) - ENDIF(${invert} MATCHES INVERT) -ENDMACRO(KWSYS_PLATFORM_CXX_TEST) diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformCxxTests.cxx deleted file mode 100644 index e921676..0000000 --- a/Source/kwsys/kwsysPlatformCxxTests.cxx +++ /dev/null @@ -1,363 +0,0 @@ -// Setup for tests that use result of stl namespace test. -#if defined(KWSYS_STL_HAVE_STD) -# if KWSYS_STL_HAVE_STD -# define kwsys_stl std -# else -# define kwsys_stl -# endif -#endif - -#ifdef TEST_KWSYS_STL_HAVE_STD -#include -void f(std::list*) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_ANSI -#include -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_HAVE_STD -#include -void f(std::ostream*) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_SSTREAM -#include -int main() -{ - std::ostringstream ostr; - ostr << "hello"; - if(ostr.str().size() == 5) - { - return 0; - } - return -1; -} -#endif - -#ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H -#include -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_STRSTREA_H -#include -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM -# include -# include -void f(ostream& os, const kwsys_stl::string& s) { os << s; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM -# include -# include -void f(istream& is, kwsys_stl::string& s) { is >> s; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -# include -bool f(const kwsys_stl::string& s) { return s != ""; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF -#include -void f(size_t) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS -template class A; -template int f(A&); -template class A -{ -public: - // "friend int f<>(A&)" would conform - friend int f(A&); -private: - int x; -}; - -template int f(A& a) { return a.x = 0; } -template int f(A&); - -int main() -{ - A a; - return f(a); -} -#endif - -#ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES -template -class A -{ -public: - U u; - A(): u(0) {} - template V m(V* p) { return *p = u; } -}; - -int main() -{ - A a; - int s = 1; - return a.m(&s); -} -#endif - -#ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION -template struct A {}; -template <> struct A -{ - static int f() { return 0; } -}; -int main() { return A::f(); } -#endif - -#ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP -namespace N -{ - class A {}; - int f(A*) { return 0; } -} -void f(void*); -int main() -{ - N::A* a = 0; - return f(a); -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS -#include -#include -void f(kwsys_stl::iterator_traits::iterator>::iterator_category const&) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -#include -#include -void f(kwsys_stl::list::iterator x) { kwsys_stl::iterator_category(x); } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -#include -#include -void f(kwsys_stl::list::iterator x) { kwsys_stl::__iterator_category(x); } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -#include -template -void f(const Alloc&) -{ - typedef typename Alloc::size_type alloc_size_type; -} -int main() -{ - f(kwsys_stl::allocator()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -#include -void f(kwsys_stl::allocator::size_type const&) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -#include -template -void f(const T&, const Alloc&) -{ - typedef typename Alloc::template rebind::other alloc_type; -} -int main() -{ - f(0, kwsys_stl::allocator()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -#include -void f(kwsys_stl::allocator const& a) -{ - a.max_size(sizeof(int)); -} -int main() -{ - f(kwsys_stl::allocator()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -#include -void f(kwsys_stl::vector const& v1) -{ - kwsys_stl::vector(1, 1, v1.get_allocator()); -} -int main() -{ - f(kwsys_stl::vector()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM -#include -#include -#include -int main() -{ - struct stat stat1; - (void)stat1.st_mtim.tv_sec; - (void)stat1.st_mtim.tv_nsec; - return 0; -} -#endif - -#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64 -void function(long**) {} -int main() -{ - __int64** p = 0; - function(p); - return 0; -} -#endif - -#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64 -void function(long long**) {} -int main() -{ - __int64** p = 0; - function(p); - return 0; -} -#endif - -#ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE -void function(double& l, unsigned __int64 const& r) -{ - l = static_cast(r); -} - -int main() -{ - double tTo = 0.0; - unsigned __int64 tFrom = 0; - function(tTo, tFrom); - return 0; -} -#endif - -#ifdef TEST_KWSYS_CHAR_IS_SIGNED -/* Return 1 for char signed and 0 for char unsigned. */ -int main() -{ - unsigned char uc = 255; - return (*reinterpret_cast(&uc) < 0)?1:0; -} -#endif - -#ifdef TEST_KWSYS_CXX_TYPE_INFO -/* Collect fundamental type information and save it to a CMake script. */ - -/* Include limits.h to get macros indicating long long and __int64. - Note that certain compilers need special macros to define these - macros in limits.h. */ -#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) -# define _MSC_EXTENSIONS -#endif -#if defined(__GNUC__) && __GNUC__ < 3 -# define _GNU_SOURCE -#endif -#include - -#include -#include - -/* Due to shell differences and limitations of ADD_DEFINITIONS the - KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes - and sometimes not. This macro will make sure the value is treated - as a double-quoted string. */ -#define TO_STRING(x) TO_STRING0(x) -#define TO_STRING0(x) TO_STRING1(x) -#define TO_STRING1(x) #x - -void f() {} - -int main() -{ - /* Construct the output file name. Some preprocessors will add an - extra level of double quotes, so strip them. */ - char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE); - char* fname = fbuf; - if(fname[0] == '"') - { - ++fname; - int len = static_cast(strlen(fname)); - if(len > 0 && fname[len-1] == '"') - { - fname[len-1] = 0; - } - } - - /* Try to open the output file. */ - if(FILE* fout = fopen(fname, "w")) - { - /* Set the size of standard types. */ - fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast(sizeof(char))); - fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast(sizeof(short))); - fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast(sizeof(int))); - fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast(sizeof(long))); - - /* Set the size of some non-standard but common types. */ - /* Check for a limits.h macro for long long to see if the type exists. */ -#if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX) - fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast(sizeof(long long))); -#else - fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n"); -#endif - /* Check for a limits.h macro for __int64 to see if the type exists. */ -#if defined(_I64_MIN) - fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast(sizeof(__int64))); -#else - fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n"); -#endif - - /* Set the size of some pointer types. */ - fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast(sizeof(void*))); - fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast(sizeof(&f))); - - /* Set whether the native type "char" is signed or unsigned. */ - unsigned char uc = 255; - fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n", - (*reinterpret_cast(&uc) < 0)?1:0); - - fclose(fout); - return 0; - } - else - { - fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n", - fname); - return 1; - } -} -#endif diff --git a/Templates/DLLHeader.dsptemplate b/Templates/DLLHeader.dsptemplate index 7234a74..8d4413e 100644 --- a/Templates/DLLHeader.dsptemplate +++ b/Templates/DLLHeader.dsptemplate @@ -71,7 +71,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /machine:I386 /out:"LIBRARY_OUTPUT_PATHRelease/OUTPUT_NAME_RELEASE" +# ADD LINK32 /nologo /dll TARGET_VERSION_FLAG /machine:I386 /out:"LIBRARY_OUTPUT_PATHRelease/OUTPUT_NAME_RELEASE" CM_MULTILINE_OPTIONS_RELEASE CMAKE_CUSTOM_RULE_CODE @@ -103,7 +103,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"LIBRARY_OUTPUT_PATHDebug/OUTPUT_NAME_DEBUG" /pdbtype:sept +# ADD LINK32 /nologo /dll TARGET_VERSION_FLAG /debug /machine:I386 /out:"LIBRARY_OUTPUT_PATHDebug/OUTPUT_NAME_DEBUG" /pdbtype:sept CM_MULTILINE_OPTIONS_DEBUG CMAKE_CUSTOM_RULE_CODE @@ -137,7 +137,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /machine:I386 /out:"LIBRARY_OUTPUT_PATHMinSizeRel/OUTPUT_NAME_MINSIZEREL" +# ADD LINK32 /nologo /dll TARGET_VERSION_FLAG /machine:I386 /out:"LIBRARY_OUTPUT_PATHMinSizeRel/OUTPUT_NAME_MINSIZEREL" CM_MULTILINE_OPTIONS_MINSIZEREL CMAKE_CUSTOM_RULE_CODE @@ -169,7 +169,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"LIBRARY_OUTPUT_PATHRelWithDebInfo/OUTPUT_NAME_RELWITHDEBINFO" +# ADD LINK32 /nologo /dll TARGET_VERSION_FLAG /debug /machine:I386 /pdbtype:sept /out:"LIBRARY_OUTPUT_PATHRelWithDebInfo/OUTPUT_NAME_RELWITHDEBINFO" CM_MULTILINE_OPTIONS_RELWITHDEBINFO CMAKE_CUSTOM_RULE_CODE diff --git a/Templates/EXEHeader.dsptemplate b/Templates/EXEHeader.dsptemplate index 518ec28..ed80c7a 100644 --- a/Templates/EXEHeader.dsptemplate +++ b/Templates/EXEHeader.dsptemplate @@ -68,7 +68,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 -# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 +# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 TARGET_VERSION_FLAG # ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelease\OUTPUT_NAME_RELEASE" CM_MULTILINE_OPTIONS_RELEASE @@ -100,7 +100,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 TARGET_VERSION_FLAG # ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHDebug\OUTPUT_NAME_DEBUG" CM_MULTILINE_OPTIONS_DEBUG @@ -129,7 +129,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 -# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 +# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 TARGET_VERSION_FLAG # ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHMinSizeRel\OUTPUT_NAME_MINSIZEREL" CM_MULTILINE_OPTIONS_MINSIZEREL @@ -159,7 +159,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /IGNORE:4089 -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /IGNORE:4089 +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /IGNORE:4089 TARGET_VERSION_FLAG # ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelWithDebInfo\OUTPUT_NAME_RELWITHDEBINFO" CM_MULTILINE_OPTIONS_RELWITHDEBINFO diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index 02217a8..c9e2636 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -9,7 +9,7 @@ SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Source/kwsys") SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest2/kwsysBin") SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "Release") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") diff --git a/Tests/CTestTest3/test.cmake.in b/Tests/CTestTest3/test.cmake.in index 0be9248..4db2ae4 100644 --- a/Tests/CTestTest3/test.cmake.in +++ b/Tests/CTestTest3/test.cmake.in @@ -21,7 +21,7 @@ SET(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/CVS/KWSys") SET(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/CVS/KWSysBin") SET(CTEST_UPDATE_COMMAND "@CVSCOMMAND@") SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "Release") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") @@ -70,7 +70,7 @@ IF(svncommand) SET(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/SVN/kwsysBin") SET(CTEST_UPDATE_COMMAND "@SVNCOMMAND@") SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") - SET(CTEST_BUILD_CONFIGURATION "Release") + SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index fa3ee41..5a28e56 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -4,6 +4,15 @@ SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) PROJECT (Complex) +# Choose whether to test CMakeLib. +SET(COMPLEX_TEST_CMAKELIB 1) +IF(CMAKE_TEST_DIFFERENT_GENERATOR) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR) +IF(CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES) + # # Define a macro # diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 28db54e..f61963a 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -6,14 +6,14 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) # Link to CMake lib LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) @@ -23,9 +23,9 @@ ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 273e8a2..1603a8c 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -8,7 +8,7 @@ extern "C" { #include "testConly.h" } -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" @@ -64,7 +64,7 @@ void cmPassed(const char* Message, const char* m2="") This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -327,7 +327,7 @@ int main() #endif std::string exe = lib; -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -1059,7 +1059,7 @@ int main() } #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -1257,7 +1257,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in index 0b1e181..8034203 100644 --- a/Tests/Complex/cmTestConfigure.h.in +++ b/Tests/Complex/cmTestConfigure.h.in @@ -4,7 +4,8 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR -#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR +#cmakedefine COMPLEX_TEST_CMAKELIB + #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index fa3ee41..5a28e56 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -4,6 +4,15 @@ SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) PROJECT (Complex) +# Choose whether to test CMakeLib. +SET(COMPLEX_TEST_CMAKELIB 1) +IF(CMAKE_TEST_DIFFERENT_GENERATOR) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR) +IF(CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES) + # # Define a macro # diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 28db54e..f61963a 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -6,14 +6,14 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) # Link to CMake lib LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) @@ -23,9 +23,9 @@ ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 273e8a2..1603a8c 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -8,7 +8,7 @@ extern "C" { #include "testConly.h" } -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" @@ -64,7 +64,7 @@ void cmPassed(const char* Message, const char* m2="") This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -327,7 +327,7 @@ int main() #endif std::string exe = lib; -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -1059,7 +1059,7 @@ int main() } #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -1257,7 +1257,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in index 0b1e181..8034203 100644 --- a/Tests/ComplexOneConfig/cmTestConfigure.h.in +++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in @@ -4,7 +4,8 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR -#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR +#cmakedefine COMPLEX_TEST_CMAKELIB + #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index fa3ee41..5a28e56 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -4,6 +4,15 @@ SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4) PROJECT (Complex) +# Choose whether to test CMakeLib. +SET(COMPLEX_TEST_CMAKELIB 1) +IF(CMAKE_TEST_DIFFERENT_GENERATOR) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR) +IF(CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) +ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES) + # # Define a macro # diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index 28db54e..f61963a 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -6,14 +6,14 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) # Link to CMake lib LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib) LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) @@ -23,9 +23,9 @@ ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) -ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) +ENDIF(COMPLEX_TEST_CMAKELIB) IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 273e8a2..1603a8c 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -8,7 +8,7 @@ extern "C" { #include "testConly.h" } -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" @@ -64,7 +64,7 @@ void cmPassed(const char* Message, const char* m2="") This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -327,7 +327,7 @@ int main() #endif std::string exe = lib; -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -1059,7 +1059,7 @@ int main() } #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -1257,7 +1257,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif -#ifndef CMAKE_TEST_DIFFERENT_GENERATOR +#ifdef COMPLEX_TEST_CMAKELIB // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in index 0b1e181..8034203 100644 --- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in +++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in @@ -4,7 +4,8 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR -#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR +#cmakedefine COMPLEX_TEST_CMAKELIB + #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 7685031..602f69b 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -190,6 +190,8 @@ SET(CHECK_ARGS amper&sand @two-ats@ one@at + "#two-pounds#" + "one#pound" "c:/posix/path/with space" "c:\\windows\\path\\with space" "'single quotes with space'" @@ -209,6 +211,8 @@ SET(CHECK_ARGS "amper&sand with space" "@two-ats@ with space" "one@at with space" + "#two-pounds# with space" + "one#pound with space" ) FOREACH(arg ${CHECK_ARGS}) SET(ARG "${arg}") diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt index d4642a7..d65f4cf 100644 --- a/Tests/MacroTest/CMakeLists.txt +++ b/Tests/MacroTest/CMakeLists.txt @@ -37,11 +37,11 @@ MACRO(strange_macro m) ENDMACRO(strange_macro m) STRANGE_MACRO(var) set(second_var "second_var") -IF("${var}" EQUAL "strange_macro" AND "${second_var}" EQUAL "second_var") +IF("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") PASS("Case Test" "(${var} ${second_var})") -ELSE("${var}" EQUAL "strange_macro" AND "${second_var}" EQUAL "second_var") +ELSE("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") FAILED("Case test" "(${var} ${second_var})") -ENDIF("${var}" EQUAL "strange_macro" AND "${second_var}" EQUAL "second_var") +ENDIF("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") # test backing up command MACRO(ADD_EXECUTABLE exec) diff --git a/Tests/OutOfSource/CMakeLists.txt b/Tests/OutOfSource/CMakeLists.txt index a053f14..265d47d 100644 --- a/Tests/OutOfSource/CMakeLists.txt +++ b/Tests/OutOfSource/CMakeLists.txt @@ -4,6 +4,10 @@ project (OutOfSource) add_subdirectory(SubDir) get_directory_property(ANIMAL DIRECTORY OutOfSourceSubdir DEFINITION WEASELS) +get_directory_property(ANIMALREL DIRECTORY SubDir/../OutOfSourceSubdir DEFINITION WEASELS) +IF(NOT "${ANIMAL}" STREQUAL "${ANIMALREL}") + MESSAGE(FATAL_ERROR "GET_DIRECTORY_PROPERTY does not seem to collapse paths.") +ENDIF(NOT "${ANIMAL}" STREQUAL "${ANIMALREL}") configure_file( ${OutOfSource_SOURCE_DIR}/testdp.h.in diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index 3d8cdb8..a762915 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -218,6 +218,7 @@ ENDIF(CMAKE_CONFIGURATION_TYPES) # Dummy test of CPack SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") SET(CPACK_PACKAGE_VENDOR "Kitware") +SET(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") IF(WIN32 AND NOT UNIX) FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis @@ -229,7 +230,7 @@ IF(WIN32 AND NOT UNIX) ENDIF(NOT NSIS_MAKENSIS) ENDIF(WIN32 AND NOT UNIX) IF(UNIX AND NOT APPLE) - # SET(CPACK_GENERATOR "TGZ;STGZ") + SET(CPACK_GENERATOR "TGZ;STGZ;TZ") # FIND_PROGRAM(found_compress # NAMES compress) # IF(found_compress) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 3d8cdb8..a762915 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -218,6 +218,7 @@ ENDIF(CMAKE_CONFIGURATION_TYPES) # Dummy test of CPack SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") SET(CPACK_PACKAGE_VENDOR "Kitware") +SET(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") IF(WIN32 AND NOT UNIX) FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis @@ -229,7 +230,7 @@ IF(WIN32 AND NOT UNIX) ENDIF(NOT NSIS_MAKENSIS) ENDIF(WIN32 AND NOT UNIX) IF(UNIX AND NOT APPLE) - # SET(CPACK_GENERATOR "TGZ;STGZ") + SET(CPACK_GENERATOR "TGZ;STGZ;TZ") # FIND_PROGRAM(found_compress # NAMES compress) # IF(found_compress) diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 3376a38..a682076 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -76,9 +76,9 @@ FOREACH(var ENDFOREACH(var) # Verify that the file was created recently. -IF(NOT FILE_IS_NEWER "${file}" "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") +IF(NOT "${file}" IS_NEWER_THAN "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") MESSAGE(FATAL_ERROR "IF(FILE_IS_NEWER) does not seem to work.") -ENDIF(NOT FILE_IS_NEWER "${file}" "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") +ENDIF(NOT "${file}" IS_NEWER_THAN "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in") # Test configuration of the string SET(TEST_DEFINED 123) diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in new file mode 100644 index 0000000..845a1bd --- /dev/null +++ b/Utilities/cmThirdParty.h.in @@ -0,0 +1,26 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#ifndef __cmThirdParty_h +#define __cmThirdParty_h + +/* Whether CMake is using its own utility libraries. */ +#cmakedefine CMAKE_USE_SYSTEM_CURL +#cmakedefine CMAKE_USE_SYSTEM_EXPAT +#cmakedefine CMAKE_USE_SYSTEM_XMLRPC +#cmakedefine CMAKE_USE_SYSTEM_ZLIB + +#endif diff --git a/Utilities/cm_curl.h b/Utilities/cm_curl.h new file mode 100644 index 0000000..0fcb5c5 --- /dev/null +++ b/Utilities/cm_curl.h @@ -0,0 +1,28 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#ifndef __cm_curl_h +#define __cm_curl_h + +/* Use the curl library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_CURL +# include +#else +# include +#endif + +#endif diff --git a/Utilities/cm_expat.h b/Utilities/cm_expat.h new file mode 100644 index 0000000..f152abb --- /dev/null +++ b/Utilities/cm_expat.h @@ -0,0 +1,28 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#ifndef __cm_expat_h +#define __cm_expat_h + +/* Use the expat library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_EXPAT +# include +#else +# include +#endif + +#endif diff --git a/Utilities/cm_xmlrpc.h b/Utilities/cm_xmlrpc.h new file mode 100644 index 0000000..95655bf --- /dev/null +++ b/Utilities/cm_xmlrpc.h @@ -0,0 +1,30 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#ifndef __cm_xmlrpc_h +#define __cm_xmlrpc_h + +/* Use the xmlrpc library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_XMLRPC +# include +# include +#else +# include +# include +#endif + +#endif diff --git a/Utilities/cm_zlib.h b/Utilities/cm_zlib.h new file mode 100644 index 0000000..a5bb52a --- /dev/null +++ b/Utilities/cm_zlib.h @@ -0,0 +1,28 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#ifndef __cm_zlib_h +#define __cm_zlib_h + +/* Use the zlib library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_ZLIB +# include +#else +# include +#endif + +#endif diff --git a/Utilities/cmtar/CMakeLists.txt b/Utilities/cmtar/CMakeLists.txt index a54e629..e1d8651 100644 --- a/Utilities/cmtar/CMakeLists.txt +++ b/Utilities/cmtar/CMakeLists.txt @@ -62,7 +62,6 @@ ENDMACRO(CHECK_SYMBOL_EXISTS_EX) INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") -INCLUDE_DIRECTORIES(${CURL_SPECIAL_LIBZ_INCLUDES}) #check for stdc headers CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) @@ -367,11 +366,18 @@ ENDIF(NOT HAVE_FNMATCH) #SET(NEED_GLOB 1) #ENDIF(NOT HAVE_GLOB) +# Setup zlib. +IF(NOT CMTAR_ZLIB_LIBRARIES) + MESSAGE(FATAL_ERROR "Parent project must set CMTAR_ZLIB_LIBRARIES.") +ENDIF(NOT CMTAR_ZLIB_LIBRARIES) +IF(NOT CMTAR_ZLIB_HEADER) + MESSAGE(FATAL_ERROR "Parent project must set CMTAR_ZLIB_HEADER.") +ENDIF(NOT CMTAR_ZLIB_HEADER) +INCLUDE_DIRECTORIES(${CMTAR_ZLIB_INCLUDE_DIRS}) CONFIGURE_FILE(${LIBTAR_SOURCE_DIR}/config.h.in ${LIBTAR_BINARY_DIR}/libtar/config.h) ADD_LIBRARY(cmtar STATIC ${libtar_SRC}) ADD_EXECUTABLE(tartest libtar.c) -TARGET_LINK_LIBRARIES(tartest cmtar ${CMAKE_ZLIB_LIBRARIES}) - +TARGET_LINK_LIBRARIES(tartest cmtar ${CMTAR_ZLIB_LIBRARIES}) diff --git a/Utilities/cmtar/config.h.in b/Utilities/cmtar/config.h.in index 1ab4362..b3b7f5c 100644 --- a/Utilities/cmtar/config.h.in +++ b/Utilities/cmtar/config.h.in @@ -42,9 +42,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #cmakedefine HAVE_LIBZ @HAVE_LIBZ@ -/* Define to 1 if you have the VTK's `z' library */ -#cmakedefine HAVE_VTK_LIBZ @HAVE_VTK_LIBZ@ - /* Define to 1 if the system has the type `major_t'. */ #cmakedefine HAVE_MAJOR_T @HAVE_MAJOR_T@ @@ -209,3 +206,5 @@ /* Define to `long long' if not defined in system header files. */ #cmakedefine uint64_t @uint64_t@ + +#define CMTAR_ZLIB_HEADER "@CMTAR_ZLIB_HEADER@" diff --git a/Utilities/cmtar/libtar.c b/Utilities/cmtar/libtar.c index c918e24..362c105 100644 --- a/Utilities/cmtar/libtar.c +++ b/Utilities/cmtar/libtar.c @@ -35,18 +35,7 @@ # include #endif -#ifdef HAVE_LIBZ -#ifdef HAVE_VTK_LIBZ -# include -# define cm_zlib_gzdopen gzdopen -# define cm_zlib_gzclose gzclose -# define cm_zlib_gzread gzread -# define cm_zlib_gzwrite gzwrite - -#else -# include -#endif -#endif +#include CMTAR_ZLIB_HEADER #include @@ -117,7 +106,7 @@ static int libtar_gzopen(void* call_data, const char *pathname, } #endif - gzf->GZFile = cm_zlib_gzdopen(fd, gzoflags); + gzf->GZFile = gzdopen(fd, gzoflags); if (!gzf->GZFile) { errno = ENOMEM; @@ -130,19 +119,19 @@ static int libtar_gzopen(void* call_data, const char *pathname, static int libtar_gzclose(void* call_data) { struct gzStruct* gzf = (struct gzStruct*)call_data; - return cm_zlib_gzclose(gzf->GZFile); + return gzclose(gzf->GZFile); } static ssize_t libtar_gzread(void* call_data, void* buf, size_t count) { struct gzStruct* gzf = (struct gzStruct*)call_data; - return cm_zlib_gzread(gzf->GZFile, buf, count); + return gzread(gzf->GZFile, buf, count); } static ssize_t libtar_gzwrite(void* call_data, const void* buf, size_t count) { struct gzStruct* gzf = (struct gzStruct*)call_data; - return cm_zlib_gzwrite(gzf->GZFile, (void*)buf, count); + return gzwrite(gzf->GZFile, (void*)buf, count); } tartype_t gztype = { diff --git a/Utilities/cmxmlrpc/xmlrpc.h b/Utilities/cmxmlrpc/xmlrpc.h index 69160a2..30b8384 100644 --- a/Utilities/cmxmlrpc/xmlrpc.h +++ b/Utilities/cmxmlrpc/xmlrpc.h @@ -29,7 +29,7 @@ #include #include -#include +#include #ifdef HAVE_UNICODE_WCHAR #include @@ -778,7 +778,7 @@ char *xmlrpc_authcookie(void); in here. For backward compatibility, we need to include it here, even though it really isn't logical to do so. */ -#include +#include #endif diff --git a/Utilities/cmxmlrpc/xmlrpc_expat.c b/Utilities/cmxmlrpc/xmlrpc_expat.c index cb467d1..d7b6e19 100644 --- a/Utilities/cmxmlrpc/xmlrpc_expat.c +++ b/Utilities/cmxmlrpc/xmlrpc_expat.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "xmlrpc.h" #include "xmlrpc_int.h" diff --git a/Utilities/cmxmlrpc/xmlrpc_server.h b/Utilities/cmxmlrpc/xmlrpc_server.h index e51d960..7024f43 100644 --- a/Utilities/cmxmlrpc/xmlrpc_server.h +++ b/Utilities/cmxmlrpc/xmlrpc_server.h @@ -27,7 +27,7 @@ #ifndef _XMLRPC_SERVER_H_ #define _XMLRPC_SERVER_H_ 1 -#include +#include #ifdef __cplusplus extern "C" { diff --git a/bootstrap b/bootstrap index 739149d..eecfead 100755 --- a/bootstrap +++ b/bootstrap @@ -36,6 +36,7 @@ cmake_data_dir="/share/cmake-${cmake_version}" cmake_doc_dir="/doc/cmake-${cmake_version}" cmake_man_dir="/man" cmake_init_file="" +cmake_bootstrap_system_libs="" # Determine whether this is a MinGW environment. if echo "${cmake_system}" | grep MINGW >/dev/null 2>&1; then @@ -205,6 +206,10 @@ Configuration: --parallel=n bootstrap cmake in parallel, where n is number of nodes [1] --init=FILE use FILE for cmake initialization + --system-libs use system-installed third-party libraries + (for use only by package maintainers) + --no-system-libs use cmake-provided third-party libraries + (default) Directory and file names: --prefix=PREFIX install files in tree rooted at PREFIX @@ -444,6 +449,12 @@ for a in "$@"; do if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then cmake_init_file=`echo $a | sed "s/^--init=//"` fi + if echo $a | grep "^--system-libs" > /dev/null 2> /dev/null; then + cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=1" + fi + if echo $a | grep "^--no-system-libs" > /dev/null 2> /dev/null; then + cmake_bootstrap_system_libs="-DCMAKE_USE_SYSTEM_LIBRARIES=0" + fi if echo $a | grep "^--help" > /dev/null 2> /dev/null; then cmake_usage fi @@ -1287,7 +1298,7 @@ export CXX export MAKE # Run bootstrap CMake to configure real CMake -"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" +"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_bootstrap_system_libs} RES=$? if [ "${RES}" -ne "0" ]; then cmake_error 11 "Problem while running initial CMake" diff --git a/doxygen.config b/doxygen.config index 4197fbe..c22f265 100644 --- a/doxygen.config +++ b/doxygen.config @@ -236,7 +236,7 @@ WARN_FORMAT = "$file:$line: $text" # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = "d:\Insight\CMake\Source" +INPUT = "Source" # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -- cgit v0.12