diff --git a/CMakeLists.txt b/CMakeLists.txt index 7821b8e37..b1cde8923 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -353,8 +353,8 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 6) -SET(CMake_VERSION_PATCH 3) -#SET(CMake_VERSION_RC 17) +SET(CMake_VERSION_PATCH 4) +#SET(CMake_VERSION_RC 6) # CVS versions are odd, if this is an odd minor version # then set the CMake_VERSION_DATE variable IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") diff --git a/ChangeLog.manual b/ChangeLog.manual index 20564eb38..da70ce05e 100755 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,52 @@ +Changes in CMake 2.6.4 RC 6 +- Use $ var in CPack.cmake, and not @var@ +- Add more missing OSXX11 CPack files + +Changes in CMake 2.6.4 RC 5 +- Add missing file for OSXX11 CPack generator +- cmake-gui fix path length in the binary directory's combo box + +Changes in CMake 2.6.4 RC 4 +- Better document Verbatim in custom commands +- Fix #8843 ctest system information was not always correct on linux +- Fix transitive linking of imported libraries + +Changes in CMake 2.6.4 RC 3 +- Documentation fix for #8815 +- Fix CDash only submit with ctest_submit +- various fixes for FindQt4.cmake +- cmake-gui block checkable flag for item during configure/generate. +- put qt version in about for cmake-gui + +Changes in CMake 2.6.4 RC 2 +- Fix issues in FindBoost #8576 #8734 +- Fix -D issues with VS 6 +- Fix scope issue with CMAKE_CURRENT_LIST_FILE and macros +- Eclipse make VERBOSE off in makfiles #7585, and use built-in includes +- Codeblocks auto header finding +- Fix crash in include_directories #8704 +- Some documentation fixes to commands and classes. +- Do not warn if LIBPATH is not set for nmake + +Changes in CMake 2.6.4 RC 1 +- Add some better documentation about RPATH variables +- No longer mark header files as HEADER_FILE_ONLY automatically, + this gets rid of the ugly red marks in Visual Stuido +- Fix man-page preformatted text paragraphing +- Teach file(REMOVE) how to use relative paths +- Gracefully handle broken version symlinks +- Fix ASM source file extension default list +- Pass shared library export symbol in DEFINES +- Enforce unique binary directories +- Fix cmake-mode.el indentation cursor motion +- Simplify reverse cmLocalGenerator::Convert +- More robust decision to suppress implicit include dirs +- Fix Fortran implicit dependency include path (and test it) +- Clarify docs of old *_OUTPUT_PATH vars +- Fix svn update logic for modified files +- Add get_filename_component(... REALPATH) +- Work around broken GetLongPathName case + Changes in CMake 2.6.3 RC 17 - 15 - Fix Xcode rebuild issue with static libraries and add a test. diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el index 0fbecb76d..a000c659d 100644 --- a/Docs/cmake-mode.el +++ b/Docs/cmake-mode.el @@ -3,7 +3,7 @@ ; Program: CMake - Cross-Platform Makefile Generator ; Module: $RCSfile: cmake-mode.el,v $ ; -; Copyright (c) 2000-$Date: 2008-03-11 14:54:40 $ Kitware, Inc., Insight Consortium. All rights reserved. +; Copyright (c) 2000-$Date: 2009-03-23 17:58:40 $ 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 @@ -102,54 +102,70 @@ (defun cmake-indent () "Indent current line as CMAKE code." (interactive) - (beginning-of-line) (if (cmake-line-starts-inside-string) () (if (bobp) - (indent-line-to 0) - (let ((point-start (point)) - token cur-indent) + (cmake-indent-line-to 0) + (let (cur-indent) (save-excursion - ; Search back for the last indented line. - (cmake-find-last-indented-line) - - ; Start with the indentation on this line. - (setq cur-indent (current-indentation)) - - ; Search forward counting tokens that adjust indentation. - (while (re-search-forward cmake-regex-token point-start t) - (setq token (match-string 0)) - (if (string-match (concat "^" cmake-regex-paren-left "$") token) - (setq cur-indent (+ cur-indent cmake-tab-width)) + (beginning-of-line) + + (let ((point-start (point)) + token) + + ; Search back for the last indented line. + (cmake-find-last-indented-line) + + ; Start with the indentation on this line. + (setq cur-indent (current-indentation)) + + ; Search forward counting tokens that adjust indentation. + (while (re-search-forward cmake-regex-token point-start t) + (setq token (match-string 0)) + (if (string-match (concat "^" cmake-regex-paren-left "$") token) + (setq cur-indent (+ cur-indent cmake-tab-width)) + ) + (if (string-match (concat "^" cmake-regex-paren-right "$") token) + (setq cur-indent (- cur-indent cmake-tab-width)) + ) + (if (and + (string-match cmake-regex-block-open token) + (looking-at (concat "[ \t]*" cmake-regex-paren-left)) + ) + (setq cur-indent (+ cur-indent cmake-tab-width)) + ) ) - (if (string-match (concat "^" cmake-regex-paren-right "$") token) + (goto-char point-start) + + ; If this is the end of a block, decrease indentation. + (if (looking-at cmake-regex-block-close) (setq cur-indent (- cur-indent cmake-tab-width)) ) - (if (and - (string-match cmake-regex-block-open token) - (looking-at (concat "[ \t]*" cmake-regex-paren-left)) - ) - (setq cur-indent (+ cur-indent cmake-tab-width)) - ) ) ) - ; If this is the end of a block, decrease indentation. - (if (looking-at cmake-regex-block-close) - (setq cur-indent (- cur-indent cmake-tab-width)) - ) - ; Indent this line by the amount selected. (if (< cur-indent 0) - (indent-line-to 0) - (indent-line-to cur-indent) + (cmake-indent-line-to 0) + (cmake-indent-line-to cur-indent) ) ) ) ) ) +(defun cmake-point-in-indendation () + (string-match "^[ \\t]*$" (buffer-substring (point-at-bol) (point)))) + +(defun cmake-indent-line-to (column) + "Indent the current line to COLUMN. +If point is within the existing indentation it is moved to the end of +the indentation. Otherwise it retains the same position on the line" + (if (cmake-point-in-indendation) + (indent-line-to column) + (save-excursion (indent-line-to column)))) + ;------------------------------------------------------------------------------ ;; diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 95a0645c7..cef1e78f7 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -28,9 +28,9 @@ IF(NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL) ENDIF(NOT _INCLUDED_FILE) -IF(NOT CMAKE_ASM@ASM_DIALECT@_SOURCE_FILE_EXTENSIONS) - SET(CMAKE_ASM@ASM_DIALECT@_SOURCE_FILE_EXTENSIONS s;S;asm) -ENDIF(NOT CMAKE_ASM@ASM_DIALECT@_SOURCE_FILE_EXTENSIONS) +IF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) + SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) +ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 5a8c10cb3..d845221f4 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -35,6 +35,44 @@ IF(NOT _INCLUDED_SYSTEM_INFO_FILE) ENDIF(NOT _INCLUDED_SYSTEM_INFO_FILE) +# The Eclipse generator needs to know the standard include path +# so that Eclipse ca find the headers at runtime and parsing etc. works better +# This is done here by actually running gcc with the options so it prints its +# system include directories, which are parsed then and stored in the cache. +IF("${CMAKE_EXTRA_GENERATOR}" MATCHES "Eclipse") + + MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _result) + SET(${_result}) + SET(_gccOutput) + FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" ) + EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -v -E -x ${_lang} dummy + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles + ERROR_VARIABLE _gccOutput + OUTPUT_QUIET ) + FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy") + + IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" ) + SET(${_result} ${CMAKE_MATCH_1}) + STRING(REPLACE "\n" " " ${_result} "${${_result}}") + SEPARATE_ARGUMENTS(${_result}) + ENDIF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" ) + ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang) + + # Now check for C + IF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS) + _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs) + SET(CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") + ENDIF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS) + + # And now the same for C++ + IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS) + _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs) + SET(CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories") + ENDIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS) + +ENDIF("${CMAKE_EXTRA_GENERATOR}" MATCHES "Eclipse") + + # for most systems a module is the same as a shared library # so unless the variable CMAKE_MODULE_EXISTS is set just # copy the values from the LIBRARY variables diff --git a/Modules/CPack.OSXScriptLauncher.in b/Modules/CPack.OSXScriptLauncher.in index a3e1737e9..c71586046 100755 Binary files a/Modules/CPack.OSXScriptLauncher.in and b/Modules/CPack.OSXScriptLauncher.in differ diff --git a/Modules/CPack.OSXScriptLauncher.rsrc.in b/Modules/CPack.OSXScriptLauncher.rsrc.in new file mode 100644 index 000000000..5f5f17a1c Binary files /dev/null and b/Modules/CPack.OSXScriptLauncher.rsrc.in differ diff --git a/Modules/CPack.OSXX11.main.scpt.in b/Modules/CPack.OSXX11.main.scpt.in new file mode 100644 index 000000000..de30ea11b Binary files /dev/null and b/Modules/CPack.OSXX11.main.scpt.in differ diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in index 3fa92b509..9339e7cad 100644 Binary files a/Modules/CPack.background.png.in and b/Modules/CPack.background.png.in differ diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 553ceeac2..cd13cbf68 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -778,7 +778,7 @@ cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") -cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "@CPACK_PACKAGE_INSTALL_DIRECTORY@") +cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackConfig.cmake") diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 46f860593..5435df4f6 100755 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -1,6 +1,6 @@ -# - Check if the source code provided in the SOURCE argument compiles. +# - Check if the C source code provided in the SOURCE argument compiles. # CHECK_C_SOURCE_COMPILES(SOURCE VAR) -# - macro which checks if the source code compiles +# # SOURCE - source code to try to compile # VAR - variable to store whether the source code compiled # diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index c5455ae10..11d625165 100755 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -1,6 +1,6 @@ -# - Check if the source code provided in the SOURCE argument compiles and runs. +# - Check if the C source code provided in the SOURCE argument compiles and runs. # CHECK_C_SOURCE_RUNS(SOURCE VAR) -# - macro which checks if the source code runs +# # SOURCE - source code to try to compile # VAR - variable to store the result, 1 for success, empty for failure # diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index e5c3eccb9..f987ebea4 100755 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -1,6 +1,6 @@ -# - Check if the source code provided in the SOURCE argument compiles. +# - Check if the C++ source code provided in the SOURCE argument compiles. # CHECK_CXX_SOURCE_COMPILES(SOURCE VAR) -# - macro which checks if the source code compiles +# # SOURCE - source code to try to compile # VAR - variable to store whether the source code compiled # diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index b0c9ba52f..ef9aa7168 100755 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -1,6 +1,6 @@ -# - Check if the source code provided in the SOURCE argument compiles and runs. +# - Check if the C++ source code provided in the SOURCE argument compiles and runs. # CHECK_CXX_SOURCE_RUNS(SOURCE VAR) -# - macro which checks if the source code compiles +# # SOURCE - source code to try to compile # VAR - variable to store the result, 1 for success, empty for failure # diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 518f8a87d..ce6eb5b52 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -68,86 +68,87 @@ # # ============================================================================ # -# Variables used by this module, they can change the default behaviour and need to be set -# before calling find_package: +# Variables used by this module, they can change the default behaviour and +# need to be set before calling find_package: # -# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded +# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded # boost libraries. If not specified, defaults # to ON. # -# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static +# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static # boost libraries. Defaults to OFF. # # Other Variables used by this module which you may want to set. # -# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching +# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching # the boost include directory. Please see # the documentation above regarding this # annoying, but necessary variable :( # -# Boost_DEBUG Set this to TRUE to enable debugging output +# Boost_DEBUG Set this to TRUE to enable debugging output # of FindBoost.cmake if you are having problems. # Please enable this before filing any bug # reports. # -# Boost_COMPILER Set this to the compiler suffix used by Boost -# (e.g. "-gcc43") if FindBoods has problems finding +# Boost_COMPILER Set this to the compiler suffix used by Boost +# (e.g. "-gcc43") if FindBoost has problems finding # the proper Boost installation # -# These last three variables are available also as environment variables: +# These last three variables are available also as environment variables: # -# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for +# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for # Boost. Set this if the module has problems finding # the proper Boost installation. # -# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the +# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the # module has problems finding the proper Boost installation # -# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the +# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the # module has problems finding the proper Boost installation # # Variables defined by this module: # -# Boost_FOUND System has Boost, this means the include dir was +# Boost_FOUND System has Boost, this means the include dir was # found, as well as all the libraries specified in # the COMPONENTS list. # -# Boost_INCLUDE_DIRS Boost include directories: not cached +# Boost_INCLUDE_DIRS Boost include directories: not cached # -# Boost_INCLUDE_DIR This is almost the same as above, but this one is +# Boost_INCLUDE_DIR This is almost the same as above, but this one is # cached and may be modified by advanced users # -# Boost_LIBRARIES Link these to use the Boost libraries that you +# Boost_LIBRARIES Link to these to use the Boost libraries that you # specified: not cached # -# Boost_LIBRARY_DIRS The path to where the Boost library files are. +# Boost_LIBRARY_DIRS The path to where the Boost library files are. # -# Boost_VERSION The version number of the boost libraries that +# Boost_VERSION The version number of the boost libraries that # have been found, same as in version.hpp from Boost # -# Boost_LIB_VERSION The version number in filename form as +# Boost_LIB_VERSION The version number in filename form as # it's appended to the library filenames # -# Boost_MAJOR_VERSION major version number of boost -# Boost_MINOR_VERSION minor version number of boost -# Boost_SUBMINOR_VERSION subminor version number of boost +# Boost_MAJOR_VERSION major version number of boost +# Boost_MINOR_VERSION minor version number of boost +# Boost_SUBMINOR_VERSION subminor version number of boost # -# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call +# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINTIIONS}) # to have diagnostic information about Boost's # automatic linking outputted during compilation time. # -# For each component you list the following variables are set. -# ATTENTION: The component names need to be in lower case, just as the boost -# library names however the CMake variables use upper case for the component -# part. So you'd get Boost_SERIALIZATION_FOUND for example. +# For each component you specify in find_package(), the following (UPPER-CASE) +# variables are set. You can use these variables if you would like to pick and +# choose components for your targets instead of just using Boost_LIBRARIES. +# +# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. +# +# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost +# "component" (includes debug and optimized keywords +# when needed). +# +# ===================================================================== # -# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. -# Boost_${COMPONENT}_LIBRARY The absolute path of the Boost library "component". -# Boost_${COMPONENT}_LIBRARY_DEBUG The absolute path of the debug version of the -# Boost library "component". -# Boost_${COMPONENT}_LIBRARY_RELEASE The absolute path of the release version of the -# Boost library "component" # # Copyright (c) 2006-2008 Andreas Schneider # Copyright (c) 2007 Wengo @@ -159,48 +160,11 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # -IF(NOT DEFINED Boost_USE_MULTITHREADED) - SET(Boost_USE_MULTITHREADED TRUE) -ENDIF() -if(Boost_FIND_VERSION_EXACT) - # The version may appear in a directory with or without the patch - # level, even when the patch level is non-zero. - set(_boost_TEST_VERSIONS - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") -else(Boost_FIND_VERSION_EXACT) - # The user has not requested an exact version. Among known - # versions, find those that are acceptable to the user request. - set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.38.0" "1.38" "1.37.0" "1.37" - "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" - "1.34" "1.33.1" "1.33.0" "1.33") - set(_boost_TEST_VERSIONS) - if(Boost_FIND_VERSION) - set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - # Select acceptable versions. - foreach(version ${_Boost_KNOWN_VERSIONS}) - if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") - # This version is high enough. - list(APPEND _boost_TEST_VERSIONS "${version}") - elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") - # This version is a short-form for the requested version with - # the patch level dropped. - list(APPEND _boost_TEST_VERSIONS "${version}") - endif() - endforeach(version) - else(Boost_FIND_VERSION) - # Any version is acceptable. - set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") - endif(Boost_FIND_VERSION) -endif(Boost_FIND_VERSION_EXACT) - -# The reason that we failed to find Boost. This will be set to a -# user-friendly message when we fail to find some necessary piece of -# Boost. -set(Boost_ERROR_REASON) +#------------------------------------------------------------------------------- +# FindBoost functions & macros +# ############################################ # # Check the existence of the libraries. @@ -210,6 +174,7 @@ set(Boost_ERROR_REASON) # with the CMake distribution. This is NOT my work. All work was done by the # original authors of the FindQt4.cmake file. Only minor modifications were # made to remove references to Qt and make this file more generally applicable +# And ELSE/ENDIF pairs were removed for readability. ######################################################################### MACRO (_Boost_ADJUST_LIB_VARS basename) @@ -219,27 +184,28 @@ MACRO (_Boost_ADJUST_LIB_VARS basename) # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + ELSE() # if there are no configuration types and CMAKE_BUILD_TYPE has no value # then just use the release libraries SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + ENDIF() + # FIXME: This probably should be set for both cases SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) + ENDIF() # if only the release version was found, set the debug variable also to the release version IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) - ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) + ENDIF() # if only the debug version was found, set the release variable also to the debug version IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) + ENDIF() IF (Boost_${basename}_LIBRARY) set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") @@ -254,7 +220,7 @@ MACRO (_Boost_ADJUST_LIB_VARS basename) set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") - ENDIF (Boost_${basename}_LIBRARY) + ENDIF(Boost_${basename}_LIBRARY) ENDIF (Boost_INCLUDE_DIR ) # Make variables changeble to the advanced user @@ -265,6 +231,8 @@ MACRO (_Boost_ADJUST_LIB_VARS basename) ) ENDMACRO (_Boost_ADJUST_LIB_VARS) +#------------------------------------------------------------------------------- + # # Runs compiler with "-dumpversion" and parses major/minor # version with a regex. @@ -281,12 +249,69 @@ FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) ENDFUNCTION() - +# +# End functions/macros +# #------------------------------------------------------------------------------- + + +IF(NOT DEFINED Boost_USE_MULTITHREADED) + SET(Boost_USE_MULTITHREADED TRUE) +ENDIF() + +if(Boost_FIND_VERSION_EXACT) + # The version may appear in a directory with or without the patch + # level, even when the patch level is non-zero. + set(_boost_TEST_VERSIONS + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") +else(Boost_FIND_VERSION_EXACT) + # The user has not requested an exact version. Among known + # versions, find those that are acceptable to the user request. + set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.38.0" "1.38" "1.37.0" "1.37" + "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" + "1.34" "1.33.1" "1.33.0" "1.33") + set(_boost_TEST_VERSIONS) + if(Boost_FIND_VERSION) + set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + # Select acceptable versions. + foreach(version ${_Boost_KNOWN_VERSIONS}) + if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") + # This version is high enough. + list(APPEND _boost_TEST_VERSIONS "${version}") + elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") + # This version is a short-form for the requested version with + # the patch level dropped. + list(APPEND _boost_TEST_VERSIONS "${version}") + endif() + endforeach(version) + else(Boost_FIND_VERSION) + # Any version is acceptable. + set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") + endif(Boost_FIND_VERSION) +endif(Boost_FIND_VERSION_EXACT) + +# The reason that we failed to find Boost. This will be set to a +# user-friendly message when we fail to find some necessary piece of +# Boost. +set(Boost_ERROR_REASON) + SET( _boost_IN_CACHE TRUE) IF(Boost_INCLUDE_DIR) + + # On versions < 1.35, remove the System library from the considered list + # since it wasn't added until 1.35. + if(Boost_VERSION AND Boost_FIND_COMPONENTS) + math(EXPR _boost_maj "${Boost_VERSION} / 100000") + math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000") + if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35) + list(REMOVE_ITEM Boost_FIND_COMPONENTS system) + endif() + endif() + FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) STRING(TOUPPER ${COMPONENT} COMPONENT) IF(NOT Boost_${COMPONENT}_FOUND) @@ -503,7 +528,7 @@ ELSE (_boost_IN_CACHE) # Setting some more suffixes for the library SET (Boost_LIB_PREFIX "") - if ( MSVC AND Boost_USE_STATIC_LIBS ) + if ( WIN32 AND Boost_USE_STATIC_LIBS ) SET (Boost_LIB_PREFIX "lib") endif() diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 8d028242f..2050dec8e 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -3,10 +3,20 @@ # The most important issue is that the Qt4 qmake is available via the system path. # This qmake is then used to detect basically everything else. # This module defines a number of key variables and macros. -# First is QT_USE_FILE which is the path to a CMake file that can be included -# to compile Qt 4 applications and libraries. By default, the QtCore and QtGui -# libraries are loaded. This behavior can be changed by setting one or more -# of the following variables to true before doing INCLUDE(${QT_USE_FILE}): +# The variable QT_USE_FILE is set which is the path to a CMake file that can be included +# to compile Qt 4 applications and libraries. It sets up the compilation +# environment for include directories, preprocessor defines and populates a +# QT_LIBRARIES variable. +# +# Typical usage could be something like: +# find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtXml REQUIRED ) +# include(${QT_USE_FILE}) +# add_executable(myexe main.cpp) +# target_link_libraries(myexe ${QT_LIBRARIES}) +# +# When using the components argument, QT_USE_QT* variables are automatically set +# for the QT_USE_FILE to pick up. If one wishes to manually set them, the +# available ones to set include: # QT_DONT_USE_QTCORE # QT_DONT_USE_QTGUI # QT_USE_QT3SUPPORT @@ -32,19 +42,6 @@ # QT_USE_QTXMLPATTERNS # QT_USE_PHONON # -# The file pointed to by QT_USE_FILE will set up your compile environment -# by adding include directories, preprocessor defines, and populate a -# QT_LIBRARIES variable containing all the Qt libraries and their dependencies. -# Add the QT_LIBRARIES variable to your TARGET_LINK_LIBRARIES. -# -# Typical usage could be something like: -# FIND_PACKAGE(Qt4) -# SET(QT_USE_QTXML 1) -# INCLUDE(${QT_USE_FILE}) -# ADD_EXECUTABLE(myexe main.cpp) -# TARGET_LINK_LIBRARIES(myexe ${QT_LIBRARIES}) -# -# # There are also some files that need processing by some Qt tools such as moc # and uic. Listed below are macros that may be used to process those files. # @@ -128,6 +125,7 @@ # must exists and are not updated in any way. # # +# Below is a detailed list of variables that FindQt4.cmake sets. # QT_FOUND If false, don't try to use Qt. # QT4_FOUND If false, don't try to use Qt 4. # @@ -267,6 +265,25 @@ # (They make no sense in Qt4) # QT_QT_LIBRARY Qt-Library is now split + +# Use FIND_PACKAGE( Qt4 COMPONENTS ... ) to enable modules +IF( Qt4_FIND_COMPONENTS ) + FOREACH( component ${Qt4_FIND_COMPONENTS} ) + STRING( TOUPPER ${component} _COMPONENT ) + SET( QT_USE_${_COMPONENT} 1 ) + ENDFOREACH( component ) + + # To make sure we don't use QtCore or QtGui when not in COMPONENTS + IF(NOT QT_USE_QTCORE) + SET( QT_DONT_USE_QTCORE 1 ) + ENDIF(NOT QT_USE_QTCORE) + + IF(NOT QT_USE_QTGUI) + SET( QT_DONT_USE_QTGUI 1 ) + ENDIF(NOT QT_USE_QTGUI) + +ENDIF( Qt4_FIND_COMPONENTS ) + # If Qt3 has already been found, fail. IF(QT_QT_LIBRARY) IF(Qt4_FIND_REQUIRED) @@ -372,6 +389,18 @@ IF (QT_QMAKE_EXECUTABLE) STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}") STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}") + # Suppport finding at least a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 ) + # This implementation is a hack to avoid duplicating code and make sure we stay + # source-compatible with CMake 2.6.x + # For CMake 2.8, we should not set QT_MIN_VERSION but only use Qt4_FIND_VERSION_MAJOR, + # Qt4_FIND_VERSION_MINOR, etc + IF( Qt4_FIND_VERSION ) + SET( QT_MIN_VERSION ${Qt4_FIND_VERSION} ) + SET( req_qt_major_vers ${Qt4_FIND_VERSION_MAJOR} ) + SET( req_qt_minor_vers ${Qt4_FIND_VERSION_MINOR} ) + SET( req_qt_patch_vers ${Qt4_FIND_VERSION_PATCH} ) + ENDIF( Qt4_FIND_VERSION ) + IF (NOT req_qt_major_vers EQUAL 4) MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"") ENDIF (NOT req_qt_major_vers EQUAL 4) @@ -385,12 +414,27 @@ IF (QT_QMAKE_EXECUTABLE) MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}") MATH(EXPR found_vers "${QT_VERSION_MAJOR}*10000 + ${QT_VERSION_MINOR}*100 + ${QT_VERSION_PATCH}") + # Support finding *exactly* a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 EXACT ) + # The 'else' branch should be removed for CMake 2.8 + IF( Qt4_FIND_VERSION_EXACT ) + IF(found_vers EQUAL req_vers) + SET( QT4_QMAKE_FOUND TRUE ) + ELSE(found_vers EQUAL req_vers) + SET( QT4_QMAKE_FOUND FALSE ) + IF (found_vers LESS req_vers) + SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE) + ELSE (found_vers LESS req_vers) + SET(QT4_INSTALLED_VERSION_TOO_NEW TRUE) + ENDIF (found_vers LESS req_vers) + ENDIF(found_vers EQUAL req_vers) + ELSE( Qt4_FIND_VERSION_EXACT ) IF (found_vers LESS req_vers) SET(QT4_QMAKE_FOUND FALSE) SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE) ELSE (found_vers LESS req_vers) SET(QT4_QMAKE_FOUND TRUE) ENDIF (found_vers LESS req_vers) + ENDIF( Qt4_FIND_VERSION_EXACT ) ENDIF (qt_version_tmp) ENDIF (QT_QMAKE_EXECUTABLE) @@ -526,6 +570,10 @@ IF (QT4_QMAKE_FOUND) SET(QT_QAXSERVER_INCLUDE_DIR NOTFOUND) SET(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND) SET(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND) + IF(WIN32) + SET(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND) + SET(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND) + ENDIF(WIN32) ENDIF(QT_QMAKE_CHANGED) FOREACH(QT_MODULE ${QT_MODULES}) @@ -621,6 +669,9 @@ IF (QT4_QMAKE_FOUND) CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS) CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC) IF(Q_WS_MAC) + IF(QT_QMAKE_CHANGED) + UNSET(QT_MAC_USE_COCOA CACHE) + ENDIF(QT_QMAKE_CHANGED) CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA) ENDIF(Q_WS_MAC) @@ -735,9 +786,9 @@ IF (QT4_QMAKE_FOUND) ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) IF(QT_QMAKE_CHANGED) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library" FORCE) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) ELSE(QT_QMAKE_CHANGED) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library") + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library") ENDIF(QT_QMAKE_CHANGED) IF (QT_${basename}_LIBRARY) @@ -798,30 +849,9 @@ IF (QT4_QMAKE_FOUND) ####################################### - # find moc and uic using qmake - QT_QUERY_QMAKE(QT_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC") - QT_QUERY_QMAKE(QT_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC") - - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH - "${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL) - # make sure we have / and not \ as qmake gives on windows - FILE(TO_CMAKE_PATH - "${QT_UIC_EXECUTABLE_INTERNAL}" QT_UIC_EXECUTABLE_INTERNAL) - - IF(QT_QMAKE_CHANGED) - SET(QT_MOC_EXECUTABLE - ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable" FORCE) - SET(QT_UIC_EXECUTABLE - ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable" FORCE) - ELSE(QT_QMAKE_CHANGED) - SET(QT_MOC_EXECUTABLE - ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable") - SET(QT_UIC_EXECUTABLE - ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable") - ENDIF(QT_QMAKE_CHANGED) - IF(QT_QMAKE_CHANGED) + SET(QT_UIC_EXECUTABLE NOTFOUND) + SET(QT_MOC_EXECUTABLE NOTFOUND) SET(QT_UIC3_EXECUTABLE NOTFOUND) SET(QT_RCC_EXECUTABLE NOTFOUND) SET(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND) @@ -829,6 +859,18 @@ IF (QT4_QMAKE_FOUND) SET(QT_LUPDATE_EXECUTABLE NOTFOUND) SET(QT_LRELEASE_EXECUTABLE NOTFOUND) ENDIF(QT_QMAKE_CHANGED) + + FIND_PROGRAM(QT_MOC_EXECUTABLE + NAMES moc-qt4 moc + PATHS ${QT_BINARY_DIR} + NO_DEFAULT_PATH + ) + + FIND_PROGRAM(QT_UIC_EXECUTABLE + NAMES uic-qt4 uic + PATHS ${QT_BINARY_DIR} + NO_DEFAULT_PATH + ) FIND_PROGRAM(QT_UIC3_EXECUTABLE NAMES uic3 @@ -855,13 +897,13 @@ IF (QT4_QMAKE_FOUND) ) FIND_PROGRAM(QT_LUPDATE_EXECUTABLE - NAMES lupdate + NAMES lupdate-qt4 lupdate PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) FIND_PROGRAM(QT_LRELEASE_EXECUTABLE - NAMES lrelease + NAMES lrelease-qt4 lrelease PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH ) @@ -1221,7 +1263,13 @@ IF (QT4_QMAKE_FOUND) FOREACH (_current_FILE ${ARGN}) GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) GET_FILENAME_COMPONENT(qm ${_abs_FILE} NAME_WE) - SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") + GET_SOURCE_FILE_PROPERTY(output_location ${_abs_FILE} OUTPUT_LOCATION) + IF(output_location) + FILE(MAKE_DIRECTORY "${output_location}") + SET(qm "${output_location}/${qm}.qm") + ELSE(output_location) + SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") + ENDIF(output_location) ADD_CUSTOM_COMMAND(OUTPUT ${qm} COMMAND ${QT_LRELEASE_EXECUTABLE} @@ -1559,11 +1607,23 @@ IF (QT4_QMAKE_FOUND) ELSE(QT4_QMAKE_FOUND) SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) + + # The code below is overly complex to make sure we do not break compatibility with CMake 2.6.x + # For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and + # QT4_INSTALLED_VERSION_TOO_NEW IF(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD) - MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") + IF( Qt4_FIND_VERSION_EXACT ) + MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, version ${QT_MIN_VERSION} is required") + ELSE( Qt4_FIND_VERSION_EXACT ) + MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") + ENDIF( Qt4_FIND_VERSION_EXACT ) ELSE(QT4_INSTALLED_VERSION_TOO_OLD) - MESSAGE( FATAL_ERROR "Qt qmake not found!") + IF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) + MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too new, version ${QT_MIN_VERSION} is required") + ELSE( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) + MESSAGE( FATAL_ERROR "Qt qmake not found!") + ENDIF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) ENDIF(QT4_INSTALLED_VERSION_TOO_OLD) ELSE(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake index cf7680eed..49aa84319 100644 --- a/Modules/Platform/Darwin-icc.cmake +++ b/Modules/Platform/Darwin-icc.cmake @@ -103,7 +103,6 @@ SET(CMAKE_Fortran_CREATE_SHARED_MODULE # We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC. # We also need to consider to use cce (which is the 64bit compiler) and not JUST the 32bit compiler. # I have no idea what the best way to do that would be. -SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES /usr/local/include ) # default to searching for frameworks first diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 2d89cef2f..00d0c96dc 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -140,7 +140,6 @@ SET(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK -SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES /usr/local/include) # default to searching for frameworks first SET(CMAKE_FIND_FRAMEWORK FIRST) # set up the default search directories for frameworks diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 7ed85c0ac..584d3346c 100755 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -53,5 +53,12 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /lib /usr/lib /usr/lib32 /usr/lib64 ) +LIST(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) +LIST(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) + # Enable use of lib64 search path variants by default. SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 08db394ee..266281b9f 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestSubmitCommand.cxx,v $ Language: C++ - Date: $Date: 2006-03-29 17:33:41 $ - Version: $Revision: 1.13 $ + Date: $Date: 2009-03-31 14:29:12 $ + Version: $Revision: 1.13.12.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -29,31 +29,66 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() = this->Makefile->GetDefinition("CTEST_DROP_LOCATION"); const char* ctestTriggerSite = this->Makefile->GetDefinition("CTEST_TRIGGER_SITE"); + bool ctestDropSiteCDash + = this->Makefile->IsOn("CTEST_DROP_SITE_CDASH"); if ( !ctestDropMethod ) { ctestDropMethod = "http"; } - if ( !ctestDropSite ) - { - ctestDropSite = "public.kitware.com"; - } - if ( !ctestDropLocation ) + + if ( ctestDropSiteCDash ) { - ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi"; + // drop site is a CDash server... + // + if ( !ctestDropSite ) + { + // error: CDash requires CTEST_DROP_SITE definition + // in CTestConfig.cmake + } + if ( !ctestDropLocation ) + { + // error: CDash requires CTEST_DROP_LOCATION definition + // in CTestConfig.cmake + } } - if ( !ctestTriggerSite ) + else { - ctestTriggerSite - = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: " - << ctestTriggerSite << std::endl;); + // drop site is a *NOT* a CDash server... + // + // Keep all this code in case anybody out there is still + // using newer CMake with non-CDash servers + // + if ( !ctestDropSite ) + { + ctestDropSite = "public.kitware.com"; + } + if ( !ctestDropLocation ) + { + ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi"; + } + if ( !ctestTriggerSite ) + { + ctestTriggerSite + = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: " + << ctestTriggerSite << std::endl;); + } } this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod); this->CTest->SetCTestConfiguration("DropSite", ctestDropSite); this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation); - this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); + + this->CTest->SetCTestConfiguration("IsCDash", + ctestDropSiteCDash ? "TRUE" : "FALSE"); + + // Only propagate TriggerSite for non-CDash projects: + // + if ( !ctestDropSiteCDash ) + { + this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); + } this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER"); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 3334784eb..0b3e2d949 100755 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCTestUpdateHandler.cxx,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:54 $ - Version: $Revision: 1.41.2.2 $ + Date: $Date: 2009-03-23 17:58:49 $ + Version: $Revision: 1.41.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -693,7 +693,7 @@ int cmCTestUpdateHandler::ProcessHandler() cmCTestUpdateHandler::AuthorsToUpdatesMap authors_files_map; int numUpdated = 0; - int numModiefied = 0; + int numModified = 0; int numConflicting = 0; // In subversion, get the latest revision if ( updateType == cmCTestUpdateHandler::e_SVN ) @@ -750,7 +750,7 @@ int cmCTestUpdateHandler::ProcessHandler() std::string upChar = file_update_line.match(1); std::string upFile = file_update_line.match(2); char mod = upChar[0]; - bool modifiedOrConflict = false; + bool notLocallyModified = false; if ( mod == 'X' || mod == 'L') { continue; @@ -758,14 +758,14 @@ int cmCTestUpdateHandler::ProcessHandler() if ( mod != 'M' && mod != 'C' && mod != 'G' ) { count ++; - modifiedOrConflict = true; + notLocallyModified = true; } const char* file = upFile.c_str(); cmCTestLog(this->CTest, DEBUG, "Line" << cc << ": " << mod << " - " << file << std::endl); std::string output; - if ( modifiedOrConflict ) + if ( notLocallyModified ) { std::string logcommand; switch ( updateType ) @@ -806,6 +806,10 @@ int cmCTestUpdateHandler::ProcessHandler() ofs << output << std::endl; } } + else + { + res = false; + } if ( res ) { cmCTestLog(this->CTest, DEBUG, output << std::endl); @@ -993,7 +997,7 @@ int cmCTestUpdateHandler::ProcessHandler() } else if ( mod == 'M' ) { - numModiefied ++; + numModified ++; os << "\t" << std::endl; } else @@ -1089,9 +1093,9 @@ int cmCTestUpdateHandler::ProcessHandler() cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numUpdated << " updated files" << std::endl); } - if ( numModiefied ) + if ( numModified ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numModiefied + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Found " << numModified << " locally modified files" << std::endl); } @@ -1101,7 +1105,7 @@ int cmCTestUpdateHandler::ProcessHandler() << " conflicting files" << std::endl); } - if ( numModiefied == 0 && numConflicting == 0 && numUpdated == 0 ) + if ( numModified == 0 && numConflicting == 0 && numUpdated == 0 ) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Project is up-to-date" << std::endl); @@ -1136,7 +1140,7 @@ int cmCTestUpdateHandler::ProcessHandler() static_cast((cmSystemTools::GetTime() - elapsed_time_start)/6)/10.0 << "\n" << "\t"; - if ( numModiefied > 0 || numConflicting > 0 ) + if ( numModified > 0 || numConflicting > 0 ) { os << "Update error: There are modified or conflicting files in the " "repository"; diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 1ad5b494a..963017729 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: CMakeSetupDialog.cxx,v $ Language: C++ - Date: $Date: 2008-12-31 15:14:30 $ - Version: $Revision: 1.40.2.8 $ + Date: $Date: 2009-03-31 14:29:15 $ + Version: $Revision: 1.40.2.9 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -32,7 +32,7 @@ #include #include #include - +#include "cmVersion.h" #include "QCMake.h" #include "QCMakeCacheView.h" #include "AddCacheEntry.h" @@ -673,7 +673,12 @@ void CMakeSetupDialog::doDeleteCache() void CMakeSetupDialog::doAbout() { - QString msg = "CMake\nwww.cmake.org"; + QString msg = "CMake %1\n" + "Using Qt %2\n" + "www.cmake.org"; + + msg = msg.arg(cmVersion::GetCMakeVersion().c_str()); + msg = msg.arg(qVersion()); QDialog dialog; dialog.setWindowTitle(tr("About")); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index 8fab9d58b..ae0dca2bc 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -51,9 +51,7 @@ - - 7 - 0 + 0 0 diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index f1556ac2e..d8f986b3d 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: QCMakeCacheView.cxx,v $ Language: C++ - Date: $Date: 2008-07-13 21:55:25 $ - Version: $Revision: 1.26.2.4 $ + Date: $Date: 2009-03-31 14:29:18 $ + Version: $Revision: 1.26.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -517,6 +517,7 @@ Qt::ItemFlags QCMakeCacheModel::flags (const QModelIndex& idx) const if(!this->EditEnabled) { f &= ~Qt::ItemIsEditable; + return f; } if(QCMakeProperty::BOOL == this->data(idx, TypeRole).toInt()) { diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 27bb0091d..5df9f5cf0 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmAddCustomCommandCommand.h,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:17 $ - Version: $Revision: 1.33.2.2 $ + Date: $Date: 2009-04-07 19:32:07 $ + Version: $Revision: 1.33.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -75,9 +75,10 @@ public: " [IMPLICIT_DEPENDS depend1 ...]\n" " [WORKING_DIRECTORY dir]\n" " [COMMENT comment] [VERBATIM] [APPEND])\n" - "This defines a new command that can be executed during the build " - "process. The outputs named should be listed as source files in the " - "target for which they are to be generated. " + "This defines a command to generate specified OUTPUT file(s). " + "A target created in the same directory (CMakeLists.txt file) that " + "specifies any output of the custom command as a source file is given " + "a rule to generate the file using the command at build time. " "If an output name is a relative path it will be interpreted " "relative to the build tree directory corresponding to the current " "source directory. " @@ -122,14 +123,15 @@ public: "options are currently ignored when APPEND is given, " "but may be used in the future." "\n" - "If VERBATIM is given then all the arguments to the commands will be " - "passed exactly as specified no matter the build tool used. " + "If VERBATIM is given then all arguments to the commands will be " + "escaped properly for the build tool so that the invoked command " + "receives each argument unchanged. " "Note that one level of escapes is still used by the CMake language " - "processor before ADD_CUSTOM_TARGET even sees the arguments. " + "processor before add_custom_command even sees the arguments. " "Use of VERBATIM is recommended as it enables correct behavior. " - "When VERBATIM is not given the behavior is platform specific. " - "In the future VERBATIM may be enabled by default. The only reason " - "it is an option is to preserve compatibility with older CMake code.\n" + "When VERBATIM is not given the behavior is platform specific because " + "there is no protection of tool-specific special characters." + "\n" "If the output of the custom command is not actually " "created as a file on disk it should be marked as SYMBOLIC with " "SET_SOURCE_FILES_PROPERTIES.\n" @@ -151,6 +153,10 @@ public: "this does NOT add a file-level dependency that would cause the " "custom command to re-run whenever the executable is recompiled.\n" + "The DEPENDS option specifies files on which the command depends. " + "If any dependency is an OUTPUT of another custom command in the " + "same directory (CMakeLists.txt file) CMake automatically brings the " + "other custom command into the target in which this command is built. " "If DEPENDS specifies any target (created by an ADD_* command) " "a target-level dependency is created to make sure the target is " "built before any target using this custom command. Additionally, " diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index 3b744bf8f..8f6966b00 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmAddCustomTargetCommand.h,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:45 $ - Version: $Revision: 1.22.2.1 $ + Date: $Date: 2009-04-07 19:32:07 $ + Version: $Revision: 1.22.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -87,15 +87,16 @@ public: "If COMMENT is set, the value will be displayed as a " "message before the commands are executed at build time. " "Dependencies listed with the DEPENDS argument may reference files " - "and outputs of custom commands created with ADD_CUSTOM_COMMAND.\n" - "If VERBATIM is given then all the arguments to the commands will be " - "passed exactly as specified no matter the build tool used. " + "and outputs of custom commands created with add_custom_command() in " + "the same directory (CMakeLists.txt file).\n" + "If VERBATIM is given then all arguments to the commands will be " + "escaped properly for the build tool so that the invoked command " + "receives each argument unchanged. " "Note that one level of escapes is still used by the CMake language " "processor before add_custom_target even sees the arguments. " "Use of VERBATIM is recommended as it enables correct behavior. " - "When VERBATIM is not given the behavior is platform specific. " - "In the future VERBATIM may be enabled by default. The only reason " - "it is an option is to preserve compatibility with older CMake code." + "When VERBATIM is not given the behavior is platform specific because " + "there is no protection of tool-specific special characters." "\n" "The SOURCES option specifies additional source files to be included " "in the custom target. " diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e21354980..86678e435 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCPluginAPI.cxx,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.42 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.42.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -706,10 +706,6 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, headerExts.push_back(headerExtensions[i]); } - // Implement the old SetName method code here. - sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", - cmProperty::SOURCE_FILE); - // Save the original name given. sf->SourceName = name; @@ -742,13 +738,6 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, } } - // See if the file is a header file - if(std::find( headerExts.begin(), headerExts.end(), - sf->SourceExtension ) == headerExts.end()) - { - sf->Properties.SetProperty("HEADER_FILE_ONLY", "0", - cmProperty::SOURCE_FILE); - } sf->FullPath = hname; return; } @@ -763,8 +752,6 @@ void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, if(cmSystemTools::FileExists(hname.c_str())) { sf->SourceExtension = *ext; - sf->Properties.SetProperty("HEADER_FILE_ONLY", "0", - cmProperty::SOURCE_FILE); sf->FullPath = hname; return; } @@ -814,9 +801,11 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, } // Implement the old SetName method code here. - sf->Properties.SetProperty("HEADER_FILE_ONLY", - headerFileOnly? "1" : "0", - cmProperty::SOURCE_FILE); + if(headerFileOnly) + { + sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", + cmProperty::SOURCE_FILE); + } sf->SourceName = name; std::string fname = sf->SourceName; if(ext && strlen(ext)) diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 9baac9526..48ea06330 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCommandArgumentParserHelper.cxx,v $ Language: C++ - Date: $Date: 2009-01-01 17:49:41 $ - Version: $Revision: 1.20.4.1 $ + Date: $Date: 2009-03-27 15:55:57 $ + Version: $Revision: 1.20.4.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -115,11 +115,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { return 0; } - if(this->FileName && strcmp(var, "CMAKE_CURRENT_LIST_FILE") == 0) - { - return this->AddString(this->FileName); - } - else if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) + if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) { cmOStringStream ostr; ostr << this->FileLine; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 95289766a..67ebd40d3 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmComputeLinkDepends.cxx,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:49 $ - Version: $Revision: 1.12.2.7 $ + Date: $Date: 2009-04-07 19:32:07 $ + Version: $Revision: 1.12.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -295,7 +295,8 @@ cmComputeLinkDepends::AllocateLinkEntry(std::string const& item) } //---------------------------------------------------------------------------- -int cmComputeLinkDepends::AddLinkEntry(std::string const& item) +int cmComputeLinkDepends::AddLinkEntry(int depender_index, + std::string const& item) { // Check if the item entry has already been added. std::map::iterator lei = this->LinkEntryIndex.find(item); @@ -312,7 +313,7 @@ int cmComputeLinkDepends::AddLinkEntry(std::string const& item) int index = lei->second; LinkEntry& entry = this->EntryList[index]; entry.Item = item; - entry.Target = this->FindTargetToLink(entry.Item.c_str()); + entry.Target = this->FindTargetToLink(depender_index, entry.Item.c_str()); entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' && item.substr(0, 10) != "-framework"); @@ -409,7 +410,8 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // Initialize the item entry. LinkEntry& entry = this->EntryList[lei->second]; entry.Item = dep.Item; - entry.Target = this->FindTargetToLink(dep.Item.c_str()); + entry.Target = this->FindTargetToLink(dep.DependerIndex, + dep.Item.c_str()); // This item was added specifically because it is a dependent // shared library. It may get special treatment @@ -500,7 +502,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, } else if(this->OldLinkDirMode) { - this->CheckWrongConfigItem(*di); + this->CheckWrongConfigItem(depender_index, *di); } // Reset the link type until another explicit type is given. @@ -529,7 +531,7 @@ cmComputeLinkDepends::AddTargetLinkEntries(int depender_index, } else if(this->OldLinkDirMode) { - this->CheckWrongConfigItem(li->first); + this->CheckWrongConfigItem(depender_index, li->first); } } @@ -558,7 +560,7 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index, } // Add a link entry for this item. - int dependee_index = this->AddLinkEntry(item); + int dependee_index = this->AddLinkEntry(depender_index, item); // The dependee must come after the depender. if(depender_index >= 0) @@ -664,10 +666,19 @@ std::string cmComputeLinkDepends::CleanItemName(std::string const& item) } //---------------------------------------------------------------------------- -cmTarget* cmComputeLinkDepends::FindTargetToLink(const char* name) +cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index, + const char* name) { - // Look for a target. - cmTarget* tgt = this->Makefile->FindTargetToUse(name); + // Look for a target in the scope of the depender. + cmMakefile* mf = this->Makefile; + if(depender_index >= 0) + { + if(cmTarget* depender = this->EntryList[depender_index].Target) + { + mf = depender->GetMakefile(); + } + } + cmTarget* tgt = mf->FindTargetToUse(name); // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable @@ -987,7 +998,8 @@ void cmComputeLinkDepends::DisplayFinalEntries() } //---------------------------------------------------------------------------- -void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item) +void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, + std::string const& item) { if(!this->OldLinkDirMode) { @@ -997,7 +1009,7 @@ void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item) // For CMake 2.4 bug-compatibility we need to consider the output // directories of targets linked in another configuration as link // directories. - if(cmTarget* tgt = this->FindTargetToLink(item.c_str())) + if(cmTarget* tgt = this->FindTargetToLink(depender_index, item.c_str())) { if(!tgt->IsImported()) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 1c8249ba1..27985415b 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmComputeLinkDepends.h,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:51 $ - Version: $Revision: 1.5.2.7 $ + Date: $Date: 2009-04-07 19:32:07 $ + Version: $Revision: 1.5.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -81,14 +81,14 @@ private: std::map::iterator AllocateLinkEntry(std::string const& item); - int AddLinkEntry(std::string const& item); + int AddLinkEntry(int depender_index, std::string const& item); void AddVarLinkEntries(int depender_index, const char* value); void AddTargetLinkEntries(int depender_index, LinkLibraryVectorType const& libs); void AddLinkEntries(int depender_index, std::vector const& libs); std::string CleanItemName(std::string const& item); - cmTarget* FindTargetToLink(const char* name); + cmTarget* FindTargetToLink(int depender_index, const char* name); // One entry for each unique item. std::vector EntryList; @@ -162,7 +162,7 @@ private: // Compatibility help. bool OldLinkDirMode; - void CheckWrongConfigItem(std::string const& item); + void CheckWrongConfigItem(int depender_index, std::string const& item); std::set OldWrongConfigItems; }; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 307b0f565..3b27e023d 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDependsFortran.cxx,v $ Language: C++ - Date: $Date: 2008-05-15 19:39:50 $ - Version: $Revision: 1.46.2.2 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.46.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -141,6 +141,9 @@ cmDependsFortran cmDepends(lg), Internal(new cmDependsFortranInternals) { + // Configure the include file search path. + this->SetIncludePathFromLanguage("Fortran"); + // Get the list of definitions. std::vector definitions; cmMakefile* mf = this->LocalGenerator->GetMakefile(); diff --git a/Source/cmDependsFortranParser.cxx b/Source/cmDependsFortranParser.cxx index 2ce632df9..75b8cda32 100644 --- a/Source/cmDependsFortranParser.cxx +++ b/Source/cmDependsFortranParser.cxx @@ -145,8 +145,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDependsFortranParser.cxx,v $ Language: C++ - Date: $Date: 2008-04-24 16:56:25 $ - Version: $Revision: 1.16.2.2 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.16.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -242,8 +242,8 @@ static char charmap[] = { inline int strcasecmpCM(const char *s1, const char *s2) { const char *cm = charmap; - const char* us1 = s1; - const char* us2 = s2; + unsigned char const* us1 = reinterpret_cast(s1); + unsigned char const* us2 = reinterpret_cast(s2); while(cm[*us1] == cm[*us2++]) if(*us1++ == '\0') diff --git a/Source/cmDependsFortranParser.y b/Source/cmDependsFortranParser.y index 4d0e760dc..f42b8892a 100644 --- a/Source/cmDependsFortranParser.y +++ b/Source/cmDependsFortranParser.y @@ -4,8 +4,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDependsFortranParser.y,v $ Language: C++ - Date: $Date: 2008-04-24 16:56:25 $ - Version: $Revision: 1.18.2.2 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.18.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -101,8 +101,8 @@ static char charmap[] = { inline int strcasecmpCM(const char *s1, const char *s2) { const char *cm = charmap; - const char* us1 = s1; - const char* us2 = s2; + unsigned char const* us1 = reinterpret_cast(s1); + unsigned char const* us2 = reinterpret_cast(s2); while(cm[*us1] == cm[*us2++]) if(*us1++ == '\0') diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index fb7f11685..27afd923f 100755 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -931,21 +931,17 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("EXECUTABLE_OUTPUT_PATH", cmProperty::VARIABLE, "Old executable location variable.", - "This variable should no longer be used as of CMake 2.6. " - "Use the RUNTIME_OUTPUT_DIRECTORY target property instead. " - "It will override this variable if it is set.\n" - "If set, this is the directory where all executables " - "built during the build process will be placed.",false, + "The target property RUNTIME_OUTPUT_DIRECTORY supercedes " + "this variable for a target if it is set. " + "Executable targets are otherwise placed in this directory.",false, "Variables that Control the Build"); cm->DefineProperty ("LIBRARY_OUTPUT_PATH", cmProperty::VARIABLE, "Old library location variable.", - "This variable should no longer be used as of CMake 2.6. " - "Use the ARCHIVE_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY, and " - "RUNTIME_OUTPUT_DIRECTORY target properties instead. " - "They will override this variable if they are set.\n" - "If set, this is the directory where all the libraries " - "built during the build process will be placed.",false, + "The target properties ARCHIVE_OUTPUT_DIRECTORY, " + "LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY supercede " + "this variable for a target if they are set. " + "Library targets are otherwise placed in this directory.",false, "Variables that Control the Build"); @@ -1101,6 +1097,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This is a list of file extensions that may be " "part of a project for a given language but are not compiled. ",false, "Variables for Languages"); + + cm->DefineProperty + ("CMAKE__IMPLICIT_INCLUDE_DIRECTORIES", cmProperty::VARIABLE, + "Directories implicitly searched by the compiler for header files.", + "CMake does not explicitly specify these directories on compiler " + "command lines for language . " + "This prevents system include directories from being treated as user " + "include directories on some compilers.", false, + "Variables for Languages"); cm->DefineProperty ("CMAKE__LINKER_PREFERENCE", cmProperty::VARIABLE, diff --git a/Source/cmDocumentationFormatterMan.cxx b/Source/cmDocumentationFormatterMan.cxx index 106827e19..6c6321059 100644 --- a/Source/cmDocumentationFormatterMan.cxx +++ b/Source/cmDocumentationFormatterMan.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmDocumentationFormatterMan.cxx,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:46 $ - Version: $Revision: 1.5.2.1 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.5.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -71,7 +71,7 @@ void cmDocumentationFormatterMan::PrintPreformatted(std::ostream& os, os << ".nf\n" << man_text; if (*text && man_text.at(man_text.length()-1) != '\n') os << "\n"; - os << ".fi\n"; + os << ".fi\n\n"; } void cmDocumentationFormatterMan::PrintParagraph(std::ostream& os, diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index e106aaa76..89a3a273f 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExtraCodeBlocksGenerator.cxx,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:52 $ - Version: $Revision: 1.18.2.2 $ + Date: $Date: 2009-03-27 15:55:59 $ + Version: $Revision: 1.18.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2004 Alexander Neundorf neundorf@kde.org, All rights reserved. @@ -230,7 +230,10 @@ void cmExtraCodeBlocksGenerator // Collect all used source files in the project - std::map sourceFiles; + // Sort them into two containers, one for C/C++ implementation files + // which may have an acompanying header, one for all other files + std::map cFiles; + std::set otherFiles; for (std::vector::const_iterator lg=lgs.begin(); lg!=lgs.end(); lg++) { @@ -250,7 +253,32 @@ void cmExtraCodeBlocksGenerator for (std::vector::const_iterator si=sources.begin(); si!=sources.end(); si++) { - sourceFiles[(*si)->GetFullPath()] = ti->first; + // check whether it is a C/C++ implementation file + bool isCFile = false; + if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C')) + { + for(std::vector::const_iterator + ext = mf->GetSourceExtensions().begin(); + ext != mf->GetSourceExtensions().end(); + ++ext) + { + if ((*si)->GetExtension() == *ext) + { + isCFile = true; + break; + } + } + } + + // then put it accordingly into one of the two containers + if (isCFile) + { + cFiles[(*si)->GetFullPath()] = *si ; + } + else + { + otherFiles.insert((*si)->GetFullPath()); + } } } default: // intended fallthrough @@ -259,13 +287,61 @@ void cmExtraCodeBlocksGenerator } } - // insert all used source files in the CodeBlocks project - for (std::map::const_iterator - sit=sourceFiles.begin(); - sit!=sourceFiles.end(); + // The following loop tries to add header files matching to implementation + // files to the project. It does that by iterating over all source files, + // replacing the file name extension with ".h" and checks whether such a + // file exists. If it does, it is inserted into the map of files. + // A very similar version of that code exists also in the kdevelop + // project generator. + for (std::map::const_iterator + sit=cFiles.begin(); + sit!=cFiles.end(); + ++sit) + { + std::string headerBasename=cmSystemTools::GetFilenamePath(sit->first); + headerBasename+="/"; + headerBasename+=cmSystemTools::GetFilenameWithoutExtension(sit->first); + + // check if there's a matching header around + for(std::vector::const_iterator + ext = mf->GetHeaderExtensions().begin(); + ext != mf->GetHeaderExtensions().end(); + ++ext) + { + std::string hname=headerBasename; + hname += "."; + hname += *ext; + // if it's already in the set, don't check if it exists on disk + std::set::const_iterator headerIt=otherFiles.find(hname); + if (headerIt != otherFiles.end()) + { + break; + } + + if(cmSystemTools::FileExists(hname.c_str())) + { + otherFiles.insert(hname); + break; + } + } + } + + // insert all source files in the CodeBlocks project + // first the C/C++ implementation files, then all others + for (std::map::const_iterator + sit=cFiles.begin(); + sit!=cFiles.end(); + ++sit) + { + fout<<" first <<"\">\n" + " \n"; + } + for (std::set::const_iterator + sit=otherFiles.begin(); + sit!=otherFiles.end(); ++sit) { - fout<<" first <<"\">\n" + fout<<" c_str() <<"\">\n" " \n"; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 268c3c5cb..679dc4abd 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExtraEclipseCDT4Generator.cxx,v $ Language: C++ - Date: $Date: 2009-01-15 14:17:20 $ - Version: $Revision: 1.13.2.4 $ + Date: $Date: 2009-03-27 15:56:01 $ + Version: $Revision: 1.13.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2004 Alexander Neundorf neundorf@kde.org, All rights reserved. @@ -95,7 +95,6 @@ void cmExtraEclipseCDT4Generator cmGlobalUnixMakefileGenerator3* mf = static_cast(generator); mf->SetToolSupportsColor(true); - mf->SetForceVerboseMakefiles(true); } //---------------------------------------------------------------------------- @@ -251,6 +250,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() fout << "\t\t\t\t\n" "\t\t\t\t\torg.eclipse.cdt.make.core.environment\n" + "\t\t\t\t\tVERBOSE=1|\n" // enforce VERBOSE Makefile output "\t\t\t\t\t" ; // set vsvars32.bat environment available at CMake time, @@ -394,6 +394,30 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() fout << "\n"; } +//---------------------------------------------------------------------------- +void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( + cmGeneratedFileStream& fout, + const std::vector& includeDirs, + std::set& emittedDirs) +{ + for(std::vector::const_iterator inc = includeDirs.begin(); + inc != includeDirs.end(); + ++inc) + { + if (!inc->empty()) + { + std::string dir = cmSystemTools::CollapseFullPath(inc->c_str()); + if(emittedDirs.find(dir) == emittedDirs.end()) + { + emittedDirs.insert(dir); + fout << "\n"; + } + } + } +} + //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { @@ -590,18 +614,29 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { const std::vector& includeDirs = (*it)->GetMakefile()->GetIncludeDirectories(); - for(std::vector::const_iterator inc = includeDirs.begin(); - inc != includeDirs.end(); - ++inc) - { - std::string dir = cmSystemTools::CollapseFullPath(inc->c_str()); - if(emmited.find(dir) == emmited.end()) - { - emmited.insert(dir); - fout << "GetEclipsePath(dir) - << "\" kind=\"inc\" path=\"\" system=\"true\"/>\n"; - } + this->AppendIncludeDirectories(fout, includeDirs, emmited); } + // now also the system include directories, in case we found them in + // CMakeSystemSpecificInformation.cmake. This makes Eclipse find the + // standard headers. + mf->GetDefinition("CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS"); + std::string compiler = mf->GetSafeDefinition("CMAKE_C_COMPILER"); + if (!compiler.empty()) + { + std::string systemIncludeDirs = mf->GetSafeDefinition( + "CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS"); + std::vector dirs; + cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + this->AppendIncludeDirectories(fout, dirs, emmited); + } + compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); + if (!compiler.empty()) + { + std::string systemIncludeDirs = mf->GetSafeDefinition( + "CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS"); + std::vector dirs; + cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + this->AppendIncludeDirectories(fout, dirs, emmited); } fout << "\n"; diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 6d0231ddf..84ebaebd5 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmExtraEclipseCDT4Generator.h,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:52 $ - Version: $Revision: 1.4.2.1 $ + Date: $Date: 2009-03-27 15:56:06 $ + Version: $Revision: 1.4.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2004 Alexander Neundorf, neundorf@kde.org. All rights reserved. @@ -111,6 +111,10 @@ private: const std::string& defname, const std::string& altdefname); + static void AppendIncludeDirectories(cmGeneratedFileStream& fout, + const std::vector& includeDirs, + std::set& emittedDirs); + std::vector SrcLinkedResources; std::vector OutLinkedResources; std::string HomeDirectory; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 3f1f87b24..8c776e3c4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmFileCommand.cxx,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:52 $ - Version: $Revision: 1.103.2.8 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.103.2.9 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -2185,13 +2185,20 @@ bool cmFileCommand::HandleRemove(std::vector const& args, i++; // Get rid of subcommand for(;i != args.end(); ++i) { - if(cmSystemTools::FileIsDirectory(i->c_str()) && recurse) + std::string fileName = *i; + if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) { - cmSystemTools::RemoveADirectory(i->c_str()); + fileName = this->Makefile->GetCurrentDirectory(); + fileName += "/" + *i; + } + + if(cmSystemTools::FileIsDirectory(fileName.c_str()) && recurse) + { + cmSystemTools::RemoveADirectory(fileName.c_str()); } else { - cmSystemTools::RemoveFile(i->c_str()); + cmSystemTools::RemoveFile(fileName.c_str()); } } return true; diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 1db13f396..44986b7f3 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGetFilenameComponentCommand.cxx,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.17 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.17.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -75,7 +75,8 @@ bool cmGetFilenameComponentCommand { result = cmSystemTools::GetFilenameWithoutExtension(filename); } - else if (args[2] == "ABSOLUTE") + else if (args[2] == "ABSOLUTE" || + args[2] == "REALPATH") { // If the path given is relative evaluate it relative to the // current source directory. @@ -92,6 +93,11 @@ bool cmGetFilenameComponentCommand // Collapse the path to its simplest form. result = cmSystemTools::CollapseFullPath(filename.c_str()); + if(args[2] == "REALPATH") + { + // Resolve symlinks if possible + result = cmSystemTools::GetRealPath(filename.c_str()); + } } else { diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index b5a11437e..ed36c58a0 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGetFilenameComponentCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.14 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.14.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -68,11 +68,12 @@ public: { return " get_filename_component(VarName FileName\n" - " PATH|ABSOLUTE|NAME|EXT|NAME_WE\n" + " PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH\n" " [CACHE])\n" "Set VarName to be the path (PATH), file name (NAME), file " "extension (EXT), file name without extension (NAME_WE) of FileName, " - "or the full absolute (ABSOLUTE) file name without symlinks. " + "the full path (ABSOLUTE), or the full path with all symlinks " + "resolved (REALPATH). " "Note that the path is converted to Unix slashes format and has no " "trailing slashes. The longest file extension is always considered. " "If the optional CACHE argument is specified, the result variable is " diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4e77de0a5..1aad6d176 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-11-11 21:52:22 $ - Version: $Revision: 1.227.2.9 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.227.2.10 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -732,18 +732,22 @@ void cmGlobalGenerator::Configure() this->ProjectMap.clear(); this->RuleHashes.clear(); this->DirectoryContentMap.clear(); + this->BinaryDirectories.clear(); // start with this directory cmLocalGenerator *lg = this->CreateLocalGenerator(); this->LocalGenerators.push_back(lg); // set the Start directories + cmMakefile* mf = lg->GetMakefile(); lg->GetMakefile()->SetStartDirectory (this->CMakeInstance->GetStartDirectory()); lg->GetMakefile()->SetStartOutputDirectory (this->CMakeInstance->GetStartOutputDirectory()); lg->GetMakefile()->MakeStartDirectoriesCurrent(); + this->BinaryDirectories.insert(mf->GetStartOutputDirectory()); + // now do it lg->Configure(); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b636fcade..b5fcde4ec 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalGenerator.h,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:46 $ - Version: $Revision: 1.107.2.6 $ + Date: $Date: 2009-03-23 17:58:40 $ + Version: $Revision: 1.107.2.7 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -252,6 +252,12 @@ public: std::vector::const_iterator first, std::vector::const_iterator last); + /** Return whether the given binary directory is unused. */ + bool BinaryDirectoryIsNew(const char* dir) + { + return this->BinaryDirectories.insert(dir).second; + } + protected: // for a project collect all its targets by following depend // information, and also collect all the targets @@ -346,6 +352,9 @@ private: derived(dc), LoadedFromDisk(dc.LoadedFromDisk) {} }; std::map DirectoryContentMap; + + // Set of binary directories on disk. + std::set BinaryDirectories; }; #endif diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 18d0156d7..5e770485f 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalNMakeMakefileGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:46 $ - Version: $Revision: 1.26.2.1 $ + Date: $Date: 2009-03-27 15:56:10 $ + Version: $Revision: 1.26.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -35,8 +35,7 @@ void cmGlobalNMakeMakefileGenerator mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); if(!(cmSystemTools::GetEnv("INCLUDE") && - cmSystemTools::GetEnv("LIB") && - cmSystemTools::GetEnv("LIBPATH")) + cmSystemTools::GetEnv("LIB")) ) { std::string message = "To use the NMake generator, cmake must be run " diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 45f4ab413..17b2e5d4e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator3 Module: $RCSfile: cmGlobalUnixMakefileGenerator3.h,v $ Language: C++ - Date: $Date: 2008-06-13 12:55:17 $ - Version: $Revision: 1.55.2.1 $ + Date: $Date: 2009-03-27 15:56:15 $ + Version: $Revision: 1.55.2.2 $ Copyright (c) 2005 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -176,7 +176,6 @@ protected: // in the rule to satisfy the make program. std::string EmptyRuleHackCommand; - std::map TargetSourceFileCount; bool ForceVerboseMakefiles; }; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8e0119e6a..ed884c479 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalXCodeGenerator.cxx,v $ Language: C++ -Date: $Date: 2009-02-19 16:53:45 $ -Version: $Revision: 1.186.2.13 $ +Date: $Date: 2009-03-23 17:58:41 $ +Version: $Revision: 1.186.2.14 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -728,7 +728,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, { externalObjFiles.push_back(xsf); } - else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY") || + else if(this->IsHeaderFile(*i) || (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) || (tsFlags.Type == cmTarget::SourceFileTypePublicHeader)) { @@ -738,7 +738,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, { resourceFiles.push_back(xsf); } - else + else if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY")) { // Include this file in the build if it has a known language // and has not been listed as an ignored extension for this @@ -907,6 +907,15 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } } +//---------------------------------------------------------------------------- +bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf) +{ + const std::vector& hdrExts = + this->CurrentMakefile->GetHeaderExtensions(); + return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) != + hdrExts.end()); +} + //---------------------------------------------------------------------------- cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase(const char* name, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 8ffb0ecbf..60326d957 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmGlobalXCodeGenerator.h,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:48 $ - Version: $Revision: 1.52.2.2 $ + Date: $Date: 2009-03-23 17:58:41 $ + Version: $Revision: 1.52.2.3 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -159,6 +159,7 @@ private: cmTarget& cmtarget); void CreateXCodeTargets(cmLocalGenerator* gen, std::vector&); + bool IsHeaderFile(cmSourceFile*); void AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget); void CreateXCodeDependHackTarget(std::vector& targets); diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index d0c66d0c3..d6a6c0dad 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmIncludeDirectoryCommand.cxx,v $ Language: C++ - Date: $Date: 2008-03-08 14:50:56 $ - Version: $Revision: 1.30 $ + Date: $Date: 2009-03-27 15:56:22 $ + Version: $Revision: 1.30.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -94,20 +94,15 @@ void cmIncludeDirectoryCommand::AddDirectory(const char *i, } // remove any leading or trailing spaces and \r - pos = ret.size()-1; - while(ret[pos] == ' ' || ret[pos] == '\r') + std::string::size_type b = ret.find_first_not_of(" \r"); + std::string::size_type e = ret.find_last_not_of(" \r"); + if ((b!=ret.npos) && (e!=ret.npos)) { - ret.erase(pos); - pos--; + ret.assign(ret, b, 1+e-b); // copy the remaining substring } - pos = 0; - while(ret.size() && ret[pos] == ' ' || ret[pos] == '\r') + else { - ret.erase(pos,1); - } - if (!ret.size()) - { - return; + return; // if we get here, we had only whitespace in the string } if (!cmSystemTools::IsOff(ret.c_str())) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cbddd006d..8888e2e25 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalGenerator.cxx,v $ Language: C++ - Date: $Date: 2009-02-04 22:04:49 $ - Version: $Revision: 1.269.2.10 $ + Date: $Date: 2009-03-23 17:58:41 $ + Version: $Revision: 1.269.2.11 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -1133,9 +1133,10 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) { return this->LanguageToIncludeFlags[lang].c_str(); } + cmOStringStream includeFlags; std::vector includes; - this->GetIncludeDirectories(includes); + this->GetIncludeDirectories(includes, lang); std::vector::iterator i; std::string flagVar = "CMAKE_INCLUDE_FLAG_"; @@ -1241,7 +1242,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, - bool filter_system_dirs) + const char* lang) { // Need to decide whether to automatically include the source and // binary directories at the beginning of the include path. @@ -1307,21 +1308,18 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } } - if(filter_system_dirs) + // Load implicit include directories for this language. + std::string impDirVar = "CMAKE_"; + impDirVar += lang; + impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; + if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str())) { - // Do not explicitly add the standard include path "/usr/include". - // This can cause problems with certain standard library - // implementations because the wrong headers may be found first. - emitted.insert("/usr/include"); - if(const char* implicitIncludes = this->Makefile->GetDefinition - ("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES")) + std::vector impDirVec; + cmSystemTools::ExpandListArgument(value, impDirVec); + for(std::vector::const_iterator i = impDirVec.begin(); + i != impDirVec.end(); ++i) { - std::vector implicitIncludeVec; - cmSystemTools::ExpandListArgument(implicitIncludes, implicitIncludeVec); - for(unsigned int k = 0; k < implicitIncludeVec.size(); ++k) - { - emitted.insert(implicitIncludeVec[k]); - } + emitted.insert(*i); } } @@ -2127,25 +2125,15 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, bool optional) { const char* remotePath = this->GetRelativeRootPath(remote); + + // The relative root must have a path (i.e. not FULL or NONE) + assert(remotePath != 0); + if(local && (!optional || this->UseRelativePaths)) { std::vector components; - std::string result; - switch(remote) - { - case HOME: - case HOME_OUTPUT: - case START: - case START_OUTPUT: - cmSystemTools::SplitPath(local, components); - result = this->ConvertToRelativePath(components, remotePath); - break; - case FULL: - result = remotePath; - break; - case NONE: - break; - } + cmSystemTools::SplitPath(local, components); + std::string result = this->ConvertToRelativePath(components, remotePath); return this->ConvertToOutputFormat(result.c_str(), output); } else diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f43a22203..2d98a3bf1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalGenerator.h,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:52 $ - Version: $Revision: 1.103.2.3 $ + Date: $Date: 2009-03-23 17:58:45 $ + Version: $Revision: 1.103.2.4 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -190,7 +190,7 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector& dirs, - bool filter_system_dirs = true); + const char* lang = "C"); /** Compute the language used to compile the given source file. */ const char* GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9a283e1f7..deaa1827d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalUnixMakefileGenerator3.cxx,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:52 $ - Version: $Revision: 1.240.2.8 $ + Date: $Date: 2009-03-27 15:56:29 $ + Version: $Revision: 1.240.2.10 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -500,7 +500,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() infoFileStream << "SET(CMAKE_C_INCLUDE_PATH\n"; std::vector includeDirs; - this->GetIncludeDirectories(includeDirs, false); + this->GetIncludeDirectories(includeDirs); for(std::vector::iterator i = includeDirs.begin(); i != includeDirs.end(); ++i) { @@ -1967,7 +1967,7 @@ cmLocalUnixMakefileGenerator3 cmd += this->Convert(makefile,NONE,SHELL); cmd += " "; - // Passg down verbosity level. + // Pass down verbosity level. if(this->GetMakeSilentFlag().size()) { cmd += this->GetMakeSilentFlag(); diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index bc328b1dc..91570e3f4 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalUnixMakefileGenerator3.h,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:52 $ - Version: $Revision: 1.82.2.1 $ + Date: $Date: 2009-03-27 15:56:34 $ + Version: $Revision: 1.82.2.2 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -282,7 +282,7 @@ protected: void WriteLocalMakefileTargets(std::ostream& ruleFileStream, std::set &emitted); - // this method Writes the Directory informaiton files + // this method Writes the Directory information files void WriteDirectoryInformationFile(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 135e86ded..4c0001fa2 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmLocalVisualStudio6Generator.cxx,v $ Language: C++ - Date: $Date: 2009-01-13 18:03:53 $ - Version: $Revision: 1.141.2.4 $ + Date: $Date: 2009-03-27 15:56:36 $ + Version: $Revision: 1.141.2.5 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -1712,11 +1712,11 @@ cmLocalVisualStudio6Generator } // Now do the VS6-specific check. - if(define.find_first_of("=") != define.npos) + if(define.find_first_of(" ") != define.npos) { cmOStringStream e; - e << "WARNING: The VS6 IDE does not support preprocessor definitions " - << "with values.\n" + e << "WARNING: The VS6 IDE does not support preprocessor definition " + << "values with spaces.\n" << "CMake is dropping a preprocessor definition: " << define << "\n" << "Consider defining the macro in a (configured) header file.\n"; cmSystemTools::Message(e.str().c_str()); diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index edf3cf07c..e228bd1f5 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakeDepend.cxx,v $ Language: C++ - Date: $Date: 2007-12-15 01:31:27 $ - Version: $Revision: 1.46 $ + Date: $Date: 2009-03-23 17:58:48 $ + Version: $Revision: 1.46.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -264,30 +264,6 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, } -void cmMakeDepend::GenerateMakefileDependencies() -{ - // Now create cmDependInformation objects for files in the directory - cmTargets &tgts = this->Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); - l != tgts.end(); l++) - { - const std::vector &classes = l->second.GetSourceFiles(); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); ++i) - { - if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY")) - { - cmDependInformation* info = - this->GetDependInformation((*i)->GetFullPath().c_str(),0); - this->AddFileToSearchPath(info->FullPath.c_str()); - info->SourceFile = *i; - this->GenerateDependInformation(info); - } - } - } -} - - // find the full path to fname by searching the this->IncludeDirectories array std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) { @@ -362,37 +338,3 @@ void cmMakeDepend::AddSearchPath(const char* path) { this->IncludeDirectories.push_back(path); } - -// Add a directory to the search path -void cmMakeDepend::AddFileToSearchPath(const char* file) -{ - std::string filepath = file; - std::string::size_type pos = filepath.rfind('/'); - if(pos != std::string::npos) - { - std::string path = filepath.substr(0, pos); - if(std::find(this->IncludeDirectories.begin(), - this->IncludeDirectories.end(), path) - == this->IncludeDirectories.end()) - { - this->IncludeDirectories.push_back(path); - return; - } - } -} - -const cmDependInformation* -cmMakeDepend::GetDependInformationForSourceFile(const cmSourceFile &sf) const -{ - for(DependInformationMapType::const_iterator i = - this->DependInformationMap.begin(); - i != this->DependInformationMap.end(); ++i) - { - const cmDependInformation* info = i->second; - if(info->SourceFile == &sf) - { - return info; - } - } - return 0; -} diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index 146a2da86..c673bddf0 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakeDepend.h,v $ Language: C++ - Date: $Date: 2006-05-12 16:29:09 $ - Version: $Revision: 1.24 $ + Date: $Date: 2009-03-23 17:58:48 $ + Version: $Revision: 1.24.10.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -96,35 +96,18 @@ public: */ virtual void SetMakefile(cmMakefile* makefile); - /** - * Get the depend info struct for a source file - */ - const cmDependInformation - *GetDependInformationForSourceFile(const cmSourceFile &sf) const; - /** * Add a directory to the search path for include files. */ virtual void AddSearchPath(const char*); - /** - * Generate dependencies for all the sources of all the targets - * in the makefile. - */ - void GenerateMakefileDependencies(); - /** * Generate dependencies for the file given. Returns a pointer to * the cmDependInformation object for the file. */ const cmDependInformation* FindDependencies(const char* file); -protected: - /** - * Add a source file to the search path. - */ - void AddFileToSearchPath(const char* filepath); - +protected: /** * Compute the depend information for this class. */ diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 40eda7e84..d9d5a9494 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefile.cxx,v $ Language: C++ - Date: $Date: 2009-02-04 16:44:17 $ - Version: $Revision: 1.463.2.12 $ + Date: $Date: 2009-03-27 15:56:41 $ + Version: $Revision: 1.463.2.14 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -83,7 +83,7 @@ cmMakefile::cmMakefile() this->AddSourceGroup("", "^.*$"); this->AddSourceGroup ("Source Files", - "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp" + "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|F|f90|for|fpp" "|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); this->AddSourceGroup("Header Files", "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"); @@ -1208,10 +1208,10 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) return false; } - // VS6 IDE does not support definitions with values. + // VS6 IDE does not support definition values with spaces. if((strcmp(this->LocalGenerator->GetGlobalGenerator()->GetName(), "Visual Studio 6") == 0) && - (def.find("=") != def.npos)) + (def.find(" ") != def.npos)) { return false; } @@ -1535,6 +1535,21 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, } } + // Make sure the binary directory is unique. + cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + if(!gg->BinaryDirectoryIsNew(binPath)) + { + cmOStringStream e; + e << "The binary directory\n" + << " " << binPath << "\n" + << "is already used to build another source directory, so it cannot " + << "be used to build source directory\n" + << " " << srcPath << "\n" + << "Specify a unique binary directory name."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } + // create a new local generator and set its parent cmLocalGenerator *lg2 = this->LocalGenerator->GetGlobalGenerator()->CreateLocalGenerator(); @@ -3460,7 +3475,7 @@ void cmMakefile::DefineProperties(cmake *cm) "in the directory's parent.\n" "CMake will automatically drop some definitions that " "are not supported by the native build tool. " - "The VS6 IDE does not support definitions with values " + "The VS6 IDE does not support definition values with spaces " "(but NMake does).\n" "Dislaimer: Most native build tools have poor support for escaping " "certain values. CMake has work-arounds for many cases but some " diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 89d0fd40f..7a1b9f022 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmMakefileTargetGenerator.cxx,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:52 $ - Version: $Revision: 1.93.2.7 $ + Date: $Date: 2009-03-23 17:58:48 $ + Version: $Revision: 1.93.2.8 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -268,8 +268,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - flags += "-D"; - flags += exportMacro; + this->LocalGenerator->AppendDefines(defines, exportMacro, lang); } // Add preprocessor definitions for this target and configuration. diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index bfb870287..68b69f0f6 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmProjectCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.16 $ + Date: $Date: 2009-03-27 15:56:45 $ + Version: $Revision: 1.16.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -64,14 +64,16 @@ public: virtual const char* GetFullDocumentation() { return - " project(projectname [CXX] [C] [Java])\n" + " project( [languageName1 languageName2 ... ] )\n" "Sets the name of the project. " - "This creates the variables projectname_BINARY_DIR and " - "projectname_SOURCE_DIR. " + "Additionally this sets the variables _BINARY_DIR and " + "_SOURCE_DIR to the respective values.\n" "Optionally you can specify which languages your project supports. " - "By default all languages are supported. If you do not have a " - "C++ compiler, but want" - " to build a c program with cmake, then use this option."; + "Example languages are CXX (i.e. C++), C, Fortran, etc. " + "By default C and CXX are enabled. E.g. if you do not have a " + "C++ compiler, you can disable the check for it by explicitely listing " + "the languages you want to support, e.g. C. By using the special " + "language \"NONE\" all checks for any language can be disabled."; } cmTypeMacro(cmProjectCommand, cmCommand); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 750954236..e0a135148 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmSourceFile.cxx,v $ Language: C++ - Date: $Date: 2008-10-24 15:18:54 $ - Version: $Revision: 1.47.2.4 $ + Date: $Date: 2009-03-27 15:56:47 $ + Version: $Revision: 1.47.2.6 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -246,25 +246,6 @@ void cmSourceFile::CheckExtension() this->SetProperty("EXTERNAL_OBJECT", "1"); } - // Look for header files. - cmMakefile* mf = this->Location.GetMakefile(); - const std::vector& hdrExts = mf->GetHeaderExtensions(); - if(std::find(hdrExts.begin(), hdrExts.end(), this->Extension) == - hdrExts.end()) - { - // This is not a known header file extension. Mark it as not a - // header unless the user has already explicitly set the property. - if(!this->GetProperty("HEADER_FILE_ONLY")) - { - this->SetProperty("HEADER_FILE_ONLY", "0"); - } - } - else - { - // This is a known header file extension. The source cannot be compiled. - this->SetProperty("HEADER_FILE_ONLY", "1"); - } - // Try to identify the source file language from the extension. if(this->Language.empty()) { @@ -424,7 +405,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "(ex. \"COMPILE_DEFINITIONS_DEBUG\").\n" "CMake will automatically drop some definitions that " "are not supported by the native build tool. " - "The VS6 IDE does not support definitions with values " + "The VS6 IDE does not support definition values with spaces " "(but NMake does). Xcode does not support per-configuration " "definitions on source files.\n" "Dislaimer: Most native build tools have poor support for escaping " diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index bba96ed8d..c807600b8 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmStringCommand.h,v $ Language: C++ - Date: $Date: 2008-01-23 15:27:59 $ - Version: $Revision: 1.28 $ + Date: $Date: 2009-03-27 15:56:47 $ + Version: $Revision: 1.28.2.1 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -132,9 +132,10 @@ public: " + Matches preceding pattern one or more times\n" " ? Matches preceding pattern zero or once only\n" " | Matches a pattern on either side of the |\n" - " () Saves a matched subexpression, which can be referenced in " - "the REGEX REPLACE operation. Additionally it is saved in the special " - "CMake variables CMAKE_MATCH_(0..9)."; + " () Saves a matched subexpression, which can be referenced \n" + " in the REGEX REPLACE operation. Additionally it is saved\n" + " by all regular expression-related commands, including \n" + " e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9)."; } cmTypeMacro(cmStringCommand, cmCommand); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 25c00ad1e..871416ac2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmTarget.cxx,v $ Language: C++ - Date: $Date: 2009-02-04 16:44:17 $ - Version: $Revision: 1.207.2.13 $ + Date: $Date: 2009-03-27 15:56:47 $ + Version: $Revision: 1.207.2.15 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -73,7 +73,9 @@ void cmTarget::DefineProperties(cmake *cm) "BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link " "the target in the build tree with the INSTALL_RPATH. This takes " "precedence over SKIP_BUILD_RPATH and avoids the need for relinking " - "before installation."); + "before installation. " + "This property is initialized by the value of the variable " + "CMAKE_BUILD_WITH_INSTALL_RPATH if it is set when a target is created."); cm->DefineProperty ("CLEAN_DIRECT_OUTPUT", cmProperty::TARGET, @@ -106,7 +108,7 @@ void cmTarget::DefineProperties(cmake *cm) "(ex. \"COMPILE_DEFINITIONS_DEBUG\").\n" "CMake will automatically drop some definitions that " "are not supported by the native build tool. " - "The VS6 IDE does not support definitions with values " + "The VS6 IDE does not support definition values with spaces " "(but NMake does).\n" "Dislaimer: Most native build tools have poor support for escaping " "certain values. CMake has work-arounds for many cases but some " @@ -341,14 +343,19 @@ void cmTarget::DefineProperties(cmake *cm) ("INSTALL_RPATH", cmProperty::TARGET, "The rpath to use for installed targets.", "A semicolon-separated list specifying the rpath " - "to use in installed targets (for platforms that support it)."); + "to use in installed targets (for platforms that support it). " + "This property is initialized by the value of the variable " + "CMAKE_INSTALL_RPATH if it is set when a target is created."); cm->DefineProperty ("INSTALL_RPATH_USE_LINK_PATH", cmProperty::TARGET, "Add paths to linker search and installed rpath.", "INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will " "append directories in the linker search path and outside the " - "project to the INSTALL_RPATH. "); + "project to the INSTALL_RPATH. " + "This property is initialized by the value of the variable " + "CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a target is " + "created."); cm->DefineProperty ("LINK_FLAGS", cmProperty::TARGET, @@ -522,7 +529,9 @@ void cmTarget::DefineProperties(cmake *cm) "Should rpaths be used for the build tree.", "SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic " "generation of an rpath allowing the target to run from the " - "build tree. "); + "build tree. " + "This property is initialized by the value of the variable " + "CMAKE_SKIP_BUILD_RPATH if it is set when a target is created."); cm->DefineProperty ("SOVERSION", cmProperty::TARGET, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3c077c3c7..6d8010039 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmake.cxx,v $ Language: C++ - Date: $Date: 2009-02-06 21:15:16 $ - Version: $Revision: 1.375.2.17 $ + Date: $Date: 2009-03-23 17:58:49 $ + Version: $Revision: 1.375.2.18 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -1363,24 +1363,28 @@ int cmake::ExecuteCMakeCommand(std::vector& args) if(soName != realName) { std::string fname = cmSystemTools::GetFilenameName(realName); - if(cmSystemTools::FileExists(soName.c_str())) + if(cmSystemTools::FileExists(soName.c_str()) || + cmSystemTools::FileIsSymlink(soName.c_str())) { cmSystemTools::RemoveFile(soName.c_str()); } if(!cmSystemTools::CreateSymlink(fname.c_str(), soName.c_str())) { + cmSystemTools::ReportLastSystemError("cmake_symlink_library"); result = 1; } } if(name != soName) { std::string fname = cmSystemTools::GetFilenameName(soName); - if(cmSystemTools::FileExists(soName.c_str())) + if(cmSystemTools::FileExists(name.c_str()) || + cmSystemTools::FileIsSymlink(name.c_str())) { cmSystemTools::RemoveFile(name.c_str()); } if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str())) { + cmSystemTools::ReportLastSystemError("cmake_symlink_library"); result = 1; } } @@ -1395,12 +1399,14 @@ int cmake::ExecuteCMakeCommand(std::vector& args) if(name != realName) { std::string fname = cmSystemTools::GetFilenameName(realName); - if(cmSystemTools::FileExists(realName.c_str())) + if(cmSystemTools::FileExists(name.c_str()) || + cmSystemTools::FileIsSymlink(name.c_str())) { cmSystemTools::RemoveFile(name.c_str()); } if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str())) { + cmSystemTools::ReportLastSystemError("cmake_symlink_executable"); result = 1; } } diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 5b21c0158..d443e4ce7 100755 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -3,8 +3,8 @@ Program: BatchMake Module: $RCSfile: SystemInformation.cxx,v $ Language: C++ - Date: $Date: 2008-12-31 15:14:33 $ - Version: $Revision: 1.22.2.6 $ + Date: $Date: 2009-04-07 19:32:07 $ + Version: $Revision: 1.22.2.7 $ Copyright (c) 2005 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. @@ -2273,7 +2273,7 @@ int SystemInformationImplementation::QueryMemory() unsigned long av=0; unsigned long ap=0; - char buffer[1024]; // for skipping unused lines + char buffer[1024]; // for reading lines int linuxMajor = 0; int linuxMinor = 0; @@ -2316,34 +2316,39 @@ int SystemInformationImplementation::QueryMemory() // new /proc/meminfo format since kernel 2.6.x // Rigorously, this test should check from the developping version 2.5.x // that introduced the new format... - - long freeMem; - long buffersMem; - long cachedMem; - - fscanf(fd,"MemTotal:%ld kB\n", &this->TotalPhysicalMemory); - fscanf(fd,"MemFree:%ld kB\n", &freeMem); - fscanf(fd,"Buffers:%ld kB\n", &buffersMem); - fscanf(fd,"Cached:%ld kB\n", &cachedMem); - - this->TotalPhysicalMemory /= 1024; - this->AvailablePhysicalMemory = freeMem+cachedMem+buffersMem; - this->AvailablePhysicalMemory /= 1024; - - // Skip SwapCached, Active, Inactive, HighTotal, HighFree, LowTotal - // and LowFree. - int i=0; - while(i<7) + + enum { mMemTotal, mMemFree, mBuffers, mCached, mSwapTotal, mSwapFree }; + const char* format[6] = + { "MemTotal:%lu kB", "MemFree:%lu kB", "Buffers:%lu kB", + "Cached:%lu kB", "SwapTotal:%lu kB", "SwapFree:%lu kB" }; + bool have[6] = { false, false, false, false, false, false }; + unsigned long value[6]; + int count = 0; + while(fgets(buffer, sizeof(buffer), fd)) { - fgets(buffer, sizeof(buffer), fd); // skip a line - ++i; + for(int i=0; i < 6; ++i) + { + if(!have[i] && sscanf(buffer, format[i], &value[i]) == 1) + { + have[i] = true; + ++count; + } + } + } + if(count == 6) + { + this->TotalPhysicalMemory = value[mMemTotal] / 1024; + this->AvailablePhysicalMemory = + (value[mMemFree] + value[mBuffers] + value[mCached]) / 1024; + this->TotalVirtualMemory = value[mSwapTotal] / 1024; + this->AvailableVirtualMemory = value[mSwapFree] / 1024; + } + else + { + kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; + fclose(fd); + return 0; } - - fscanf(fd,"SwapTotal:%ld kB\n", &this->TotalVirtualMemory); - fscanf(fd,"SwapFree:%ld kB\n", &this->AvailableVirtualMemory); - - this->TotalVirtualMemory /= 1024; - this->AvailableVirtualMemory /= 1024; } else { diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index d9336c75d..27b47e7a0 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -205,6 +205,10 @@ inline void Realpath(const char *path, kwsys_stl::string & resolved_path) resolved_path = fullpath; KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path); } + else + { + resolved_path = path; + } } #else #include @@ -237,8 +241,16 @@ inline void Realpath(const char *path, kwsys_stl::string & resolved_path) { char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH]; - realpath(path, resolved_name); - resolved_path = resolved_name; + char *ret = realpath(path, resolved_name); + if(ret) + { + resolved_path = ret; + } + else + { + // if path resolution fails, return what was passed in + resolved_path = path; + } } #endif @@ -3046,6 +3058,11 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p) { return p; } + // Use original path if conversion back to a long path failed. + if(longPath == shortPath) + { + longPath = p; + } // make sure drive letter is always upper case if(longPath.size() > 1 && longPath[1] == ':') { diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index c637bfc98..c64ddd5ac 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -351,7 +351,9 @@ public: const char* in_base); /** - * Get the real path for a given path, removing all symlinks. + * Get the real path for a given path, removing all symlinks. In + * the event of an error (non-existent path, permissions issue, + * etc.) the original path is returned. */ static kwsys_stl::string GetRealPath(const char* path); diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index b2b29e608..dd79efa65 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -14,6 +14,7 @@ AddCMakeTest(VariableWatch "") AddCMakeTest(Include "") AddCMakeTest(FindBase "") AddCMakeTest(Toolchain "") +AddCMakeTest(GetFilenameComponentRealpath "") # Not ready for Unix testing yet. Coming "soon"... # diff --git a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in new file mode 100644 index 000000000..c795512a2 --- /dev/null +++ b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in @@ -0,0 +1,57 @@ +set(bindir ${CMAKE_CURRENT_BINARY_DIR}) + +# +# Test nonexistent REALPATH & ABSOLUTE resolution +# +get_filename_component(nonexistent1 ${bindir}/THIS_IS_A_NONEXISTENT_FILE REALPATH) +get_filename_component(nonexistent2 ${bindir}/THIS_IS_A_NONEXISTENT_FILE ABSOLUTE) +if(NOT nonexistent1 STREQUAL "${bindir}/THIS_IS_A_NONEXISTENT_FILE") + message(FATAL_ERROR "REALPATH is not preserving nonexistent files") +endif() +if(NOT nonexistent2 STREQUAL "${bindir}/THIS_IS_A_NONEXISTENT_FILE") + message(FATAL_ERROR "ABSOLUTE is not preserving nonexistent files") +endif() + +# +# Test symbolic link resolution +# +if(UNIX) + # file1 => file2 => file3 (real) + file(WRITE ${bindir}/file3 "test file") + + find_program(LN NAMES "ln") + if(LN) + # Create symlinks using "ln -s" + if(NOT EXISTS ${bindir}/file2) + execute_process(COMMAND ${LN} "-s" "${bindir}/file3" "${bindir}/file2") + endif() + if(NOT EXISTS ${bindir}/file1) + execute_process(COMMAND ${LN} "-s" "${bindir}/file2" "${bindir}/file1") + endif() + + get_filename_component(file1 ${bindir}/file1 REALPATH) + get_filename_component(file2 ${bindir}/file2 REALPATH) + get_filename_component(file3 ${bindir}/file3 REALPATH) + + if(NOT file3 STREQUAL "${bindir}/file3") + message(FATAL_ERROR "CMake fails resolving REALPATH file file3") + endif() + + if(NOT file2 STREQUAL "${bindir}/file3") + message(FATAL_ERROR "CMake fails resolving simple symlink") + endif() + + if(NOT file1 STREQUAL "${bindir}/file3") + message(FATAL_ERROR "CMake fails resolving double symlink") + endif() + + # cleanup + file(REMOVE ${bindir}/file1) + file(REMOVE ${bindir}/file2) + if(EXISTS file1 OR EXISTS file2) + message(FATAL_ERROR "removal of file1 or file2 failed") + endif() + endif(LN) + + file(REMOVE ${bindir}/file3) +endif() diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt new file mode 100644 index 000000000..16cff2df2 --- /dev/null +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -0,0 +1,69 @@ +# Import targets from the exported build tree. +include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake) + +# Import targets from the exported install tree. +include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake) + +# Try referencing an executable imported from the install tree. +add_custom_command( + OUTPUT ${Import_BINARY_DIR}/exp_generated.c + COMMAND exp_testExe1 ${Import_BINARY_DIR}/exp_generated.c + DEPENDS exp_testExe1 + ) +add_custom_command( + OUTPUT ${Import_BINARY_DIR}/exp_generated3.c + COMMAND exp_testExe3 ${Import_BINARY_DIR}/exp_generated3.c + DEPENDS exp_testExe3 + ) + +add_executable(imp_testExe1 + imp_testExe1.c + ${Import_BINARY_DIR}/exp_generated.c + ${Import_BINARY_DIR}/exp_generated3.c + ) + +# Try linking to a library imported from the install tree. +target_link_libraries(imp_testExe1 exp_testLib2 exp_testLib3 exp_testLib4) + +# Try building a plugin to an executable imported from the install tree. +add_library(imp_mod1 MODULE imp_mod1.c) +target_link_libraries(imp_mod1 exp_testExe2) + +# Try referencing an executable imported from the build tree. +add_custom_command( + OUTPUT ${Import_BINARY_DIR}/bld_generated.c + COMMAND bld_testExe1 ${Import_BINARY_DIR}/bld_generated.c + DEPENDS bld_testExe1 + ) +add_custom_command( + OUTPUT ${Import_BINARY_DIR}/bld_generated3.c + COMMAND bld_testExe3 ${Import_BINARY_DIR}/bld_generated3.c + DEPENDS bld_testExe3 + ) + +add_executable(imp_testExe1b + imp_testExe1.c + ${Import_BINARY_DIR}/bld_generated.c + ${Import_BINARY_DIR}/bld_generated3.c + ) + +# Try linking to a library imported from the build tree. +target_link_libraries(imp_testExe1b bld_testLib2 bld_testLib3 bld_testLib4) + +# Try building a plugin to an executable imported from the build tree. +add_library(imp_mod1b MODULE imp_mod1.c) +target_link_libraries(imp_mod1b bld_testExe2) + +# Export/CMakeLists.txt pretends the RelWithDebInfo (as well as Debug) +# configuration should link to debug libs. +foreach(c DEBUG RELWITHDEBINFO) + set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) + set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) +endforeach(c) + +# Create a library to be linked by another directory in this project +# to test transitive linking to otherwise invisible imported targets. +add_library(imp_lib1 STATIC imp_lib1.c) +target_link_libraries(imp_lib1 exp_testLib2) +add_library(imp_lib1b STATIC imp_lib1.c) +target_link_libraries(imp_lib1b bld_testLib2) diff --git a/Tests/ExportImport/Import/A/imp_lib1.c b/Tests/ExportImport/Import/A/imp_lib1.c new file mode 100644 index 000000000..d8c66e63f --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_lib1.c @@ -0,0 +1,6 @@ +extern int testLib2(void); + +int imp_lib1(void) +{ + return testLib2(); +} diff --git a/Tests/ExportImport/Import/imp_mod1.c b/Tests/ExportImport/Import/A/imp_mod1.c similarity index 100% rename from Tests/ExportImport/Import/imp_mod1.c rename to Tests/ExportImport/Import/A/imp_mod1.c diff --git a/Tests/ExportImport/Import/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c similarity index 100% rename from Tests/ExportImport/Import/imp_testExe1.c rename to Tests/ExportImport/Import/A/imp_testExe1.c diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index 27f291028..00bf3063d 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -6,65 +6,19 @@ if(CMAKE_ANSI_CFLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") endif(CMAKE_ANSI_CFLAGS) -# Import targets from the exported build tree. -include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake) - -# Import targets from the exported install tree. -include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake) - -# Try referencing an executable imported from the install tree. -add_custom_command( - OUTPUT ${Import_BINARY_DIR}/exp_generated.c - COMMAND exp_testExe1 ${Import_BINARY_DIR}/exp_generated.c - DEPENDS exp_testExe1 - ) -add_custom_command( - OUTPUT ${Import_BINARY_DIR}/exp_generated3.c - COMMAND exp_testExe3 ${Import_BINARY_DIR}/exp_generated3.c - DEPENDS exp_testExe3 - ) - -add_executable(imp_testExe1 - imp_testExe1.c - ${Import_BINARY_DIR}/exp_generated.c - ${Import_BINARY_DIR}/exp_generated3.c - ) - -# Try linking to a library imported from the install tree. -target_link_libraries(imp_testExe1 exp_testLib2 exp_testLib3 exp_testLib4) - -# Try building a plugin to an executable imported from the install tree. -add_library(imp_mod1 MODULE imp_mod1.c) -target_link_libraries(imp_mod1 exp_testExe2) - -# Try referencing an executable imported from the build tree. -add_custom_command( - OUTPUT ${Import_BINARY_DIR}/bld_generated.c - COMMAND bld_testExe1 ${Import_BINARY_DIR}/bld_generated.c - DEPENDS bld_testExe1 - ) -add_custom_command( - OUTPUT ${Import_BINARY_DIR}/bld_generated3.c - COMMAND bld_testExe3 ${Import_BINARY_DIR}/bld_generated3.c - DEPENDS bld_testExe3 - ) - -add_executable(imp_testExe1b - imp_testExe1.c - ${Import_BINARY_DIR}/bld_generated.c - ${Import_BINARY_DIR}/bld_generated3.c - ) - -# Try linking to a library imported from the build tree. -target_link_libraries(imp_testExe1b bld_testLib2 bld_testLib3 bld_testLib4) - -# Try building a plugin to an executable imported from the build tree. -add_library(imp_mod1b MODULE imp_mod1.c) -target_link_libraries(imp_mod1b bld_testExe2) - -# Export/CMakeLists.txt pretends the RelWithDebInfo (as well as Debug) -# configuration should link to debug libs. -foreach(c DEBUG RELWITHDEBINFO) - set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) - set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG) -endforeach(c) +# Import everything in a subdirectory. +add_subdirectory(A) + +# Make sure the imported targets are scoped inside the subdirectory. +if(TARGET exp_testLib2) + message(FATAL_ERROR "Imported target exp_testLib2 is not scoped in subdir!") +endif() +if(TARGET bld_testLib2) + message(FATAL_ERROR "Imported target bld_testLib2 is not scoped in subdir!") +endif() + +# Test transitive linking to a target imported in the subdirectory. +add_executable(imp_testTransExe1 imp_testTransExe1.c) +target_link_libraries(imp_testTransExe1 imp_lib1) +add_executable(imp_testTransExe1b imp_testTransExe1.c) +target_link_libraries(imp_testTransExe1b imp_lib1b) diff --git a/Tests/ExportImport/Import/imp_testTransExe1.c b/Tests/ExportImport/Import/imp_testTransExe1.c new file mode 100644 index 000000000..360a112ac --- /dev/null +++ b/Tests/ExportImport/Import/imp_testTransExe1.c @@ -0,0 +1,6 @@ +extern int imp_lib1(void); + +int main() +{ + return imp_lib1(); +} diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index e8515c400..e4fc4c2d7 100755 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -127,6 +127,7 @@ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) in_interface/module.f90) add_definitions(-DFOO -DBAR=1) + include_directories(${testf_SOURCE_DIR}/include) add_executable(test_preprocess test_preprocess.F90) set(TEST_MODULE_DEPENDS 1) diff --git a/Tests/Fortran/include/test_preprocess.h b/Tests/Fortran/include/test_preprocess.h new file mode 100644 index 000000000..29ac4b65f --- /dev/null +++ b/Tests/Fortran/include/test_preprocess.h @@ -0,0 +1,5 @@ +#ifdef BAR + PRINT * , 'BAR was defined via ADD_DEFINITIONS' +#else + PRINT *, 'If you can read this something went wrong' +#endif diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/Fortran/test_preprocess.F90 index 374a6ff77..e4f1fbe76 100644 --- a/Tests/Fortran/test_preprocess.F90 +++ b/Tests/Fortran/test_preprocess.F90 @@ -46,10 +46,6 @@ PROGRAM PPTEST #endif ! 0 ; -#ifdef BAR - PRINT * , 'BAR was defined via ADD_DEFINITIONS' -#else - PRINT *, 'If you can read this something went wrong' -#endif +#include "test_preprocess.h" END PROGRAM diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt index d0220ff92..7ec50c7b7 100644 --- a/Tests/MacroTest/CMakeLists.txt +++ b/Tests/MacroTest/CMakeLists.txt @@ -86,3 +86,8 @@ ELSE(SOME_CHECK) ENDIF(SOME_CHECK) ADD_EXECUTABLE(MacroTest macroTest.c) + +MACRO(GET_CURRENT_FILE var) + SET(${var} ${CMAKE_CURRENT_LIST_FILE}) +ENDMACRO(GET_CURRENT_FILE) +INCLUDE(context.cmake) diff --git a/Tests/MacroTest/context.cmake b/Tests/MacroTest/context.cmake new file mode 100644 index 000000000..f4d7035fb --- /dev/null +++ b/Tests/MacroTest/context.cmake @@ -0,0 +1,10 @@ +GET_CURRENT_FILE(current_file) +IF(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") + MESSAGE(FATAL_ERROR + "Macro file context is broken. Expected:\n" + " ${CMAKE_CURRENT_LIST_FILE}\n" + "but got:\n" + " ${current_file}\n" + "from the macro." + ) +ENDIF(NOT "${current_file}" STREQUAL "${CMAKE_CURRENT_LIST_FILE}") diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index fa9a1098b..bb3390780 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -65,14 +65,20 @@ if(NOT BORLAND AND NOT PP_VS70) set(SEMICOLON "\;") endif(NOT BORLAND AND NOT PP_VS70) -if(NOT PP_BORLAND AND NOT PP_WATCOM) - # Borland, WMake: multiple spaces - # The make tool seems to remove extra whitespace from inside - # quoted strings when passing to the compiler. It does not have - # trouble passing to other tools, and the compiler may be directly - # invoked from the command line. - set(STRING_EXTRA "${STRING_EXTRA} ") -endif(NOT PP_BORLAND AND NOT PP_WATCOM) +if(NOT PP_VS6) + # VS 6 IDE: spaces + # The project parser unconditionally separates arguments at spaces. + set(STRING_EXTRA "${STRING_EXTRA} ") + + if(NOT PP_BORLAND AND NOT PP_WATCOM) + # Borland, WMake: multiple spaces + # The make tool seems to remove extra whitespace from inside + # quoted strings when passing to the compiler. It does not have + # trouble passing to other tools, and the compiler may be directly + # invoked from the command line. + set(STRING_EXTRA "${STRING_EXTRA} ") + endif(NOT PP_BORLAND AND NOT PP_WATCOM) +endif(NOT PP_VS6) if(NOT PP_VS) # VS: , @@ -152,7 +158,7 @@ endif(PP_NMAKE OR PP_UMAKE) # support it and it is not an operator it is not worthwhile. # Compose the final test string. -set(STRING_VALUE "hello `~!@$*)(_+-=}{][:'.?/ ${STRING_EXTRA}world") +set(STRING_VALUE "hello`~!@$*)(_+-=}{][:'.?/${STRING_EXTRA}world") #----------------------------------------------------------------------------- # Function-style macro command-line support: @@ -194,11 +200,7 @@ endif(PP_VS6) add_definitions(-DOLD_DEF -DOLD_EXPR=2) # Make sure old-style definitions are converted to directory property. -if(PREPROCESS_VS6) - set(OLD_DEFS_EXPECTED "OLD_DEF") -else(PREPROCESS_VS6) - set(OLD_DEFS_EXPECTED "OLD_DEF;OLD_EXPR=2") -endif(PREPROCESS_VS6) +set(OLD_DEFS_EXPECTED "OLD_DEF;OLD_EXPR=2") get_property(OLD_DEFS DIRECTORY PROPERTY COMPILE_DEFINITIONS) if(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}") message(SEND_ERROR "add_definitions not converted to directory property!") @@ -225,23 +227,26 @@ foreach(c "" "_DEBUG" "_RELEASE") ) endforeach(c) -# Add definitions with values. VS6 does not support this. +# Add definitions with values. if(NOT PREPROCESS_VS6) - set_property( - TARGET Preprocess - APPEND PROPERTY COMPILE_DEFINITIONS - "TARGET_STRING=\"${STRING_VALUE}${SEMICOLON}\"" - "TARGET_EXPR=${EXPR}" - "TARGET_PATH=\"${TARGET_PATH}\"" - ) - set_property( - SOURCE preprocess.c preprocess${VS6}.cxx - APPEND PROPERTY COMPILE_DEFINITIONS - "FILE_STRING=\"${STRING_VALUE}${SEMICOLON}\"" - "FILE_EXPR=${EXPR}" - "FILE_PATH=\"${FILE_PATH}\"" - ) + # The path might have spaces, which VS6 does not support. + set(DEF_TARGET_PATH "TARGET_PATH=\"${TARGET_PATH}\"") + set(DEF_FILE_PATH "FILE_PATH=\"${FILE_PATH}\"") endif(NOT PREPROCESS_VS6) +set_property( + TARGET Preprocess + APPEND PROPERTY COMPILE_DEFINITIONS + "TARGET_STRING=\"${STRING_VALUE}${SEMICOLON}\"" + "TARGET_EXPR=${EXPR}" + ${DEF_TARGET_PATH} + ) +set_property( + SOURCE preprocess.c preprocess${VS6}.cxx + APPEND PROPERTY COMPILE_DEFINITIONS + "FILE_STRING=\"${STRING_VALUE}${SEMICOLON}\"" + "FILE_EXPR=${EXPR}" + ${DEF_FILE_PATH} + ) # Helper target for running test manually in build tree. add_custom_target(drive COMMAND Preprocess) diff --git a/Tests/Preprocess/preprocess.c b/Tests/Preprocess/preprocess.c index 5dd90036b..16209acf4 100644 --- a/Tests/Preprocess/preprocess.c +++ b/Tests/Preprocess/preprocess.c @@ -9,7 +9,6 @@ int check_defines_C(void) { int result = 1; -#ifndef PREPROCESS_VS6 if(strcmp(FILE_STRING, STRING_VALUE) != 0) { fprintf(stderr, @@ -38,7 +37,6 @@ int check_defines_C(void) result = 0; } } -#endif #ifdef NDEBUG # ifdef FILE_DEF_DEBUG { diff --git a/Tests/Preprocess/preprocess.cxx b/Tests/Preprocess/preprocess.cxx index 628521ff9..27b6ac89a 100644 --- a/Tests/Preprocess/preprocess.cxx +++ b/Tests/Preprocess/preprocess.cxx @@ -11,7 +11,6 @@ extern "C" int check_defines_C(void); int check_defines_CXX() { int result = 1; -#ifndef PREPROCESS_VS6 if(strcmp(FILE_STRING, STRING_VALUE) != 0) { fprintf(stderr, @@ -40,7 +39,6 @@ int check_defines_CXX() result = 0; } } -#endif #ifdef NDEBUG # ifdef FILE_DEF_DEBUG { diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt index 52f4a6fe9..03aa09578 100644 --- a/Tests/X11/CMakeLists.txt +++ b/Tests/X11/CMakeLists.txt @@ -6,6 +6,7 @@ INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake) MESSAGE("X11_FOUND: ${X11_FOUND}") ADD_EXECUTABLE (UseX11 X11.c) +install(TARGETS UseX11 DESTINATION bin) # so for universal binaries this test will fail if # @@ -26,10 +27,14 @@ IF(X11_FOUND) IF(APPLE) ADD_EXECUTABLE(HelloWorldX11 HelloWorldX11.cxx) TARGET_LINK_LIBRARIES(HelloWorldX11 ${X11_LIBRARIES}) - install( TARGETS HelloWorldX11 DESTINATION bin) - # build a CPack driven installer package + install(TARGETS HelloWorldX11 DESTINATION bin) + + set(CPACK_BINARY_OSXX11 ON CACHE BOOL "" FORCE) + set(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "" FORCE ) set(CPACK_PACKAGE_NAME HelloWorldX11Package) set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11) - include(CPack) ENDIF(APPLE) ENDIF(X11_FOUND) + +# build a CPack driven installer package +include(CPack)