diff --git a/CMakeLists.txt b/CMakeLists.txt index bdedb6508..29337481c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,7 +315,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 0) -SET(CMake_VERSION_RC 2) +SET(CMake_VERSION_RC 3) # We use odd minor numbers for development versions. # Use a date for the development patch level. @@ -460,9 +460,9 @@ INSTALL( DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - PATTERN "*.sh.in" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE + PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE PATTERN "CVS" EXCLUDE ) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index a9d4d75d3..2a6ce0604 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -25,6 +25,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "remark\\(1209" "stl_deque.h:1051" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" + "[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value" "Parser.cxx.*warning.*2111-D.*statement is unreachable" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" ) diff --git a/ChangeLog.manual b/ChangeLog.manual index 114270629..65cb72822 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,58 @@ +Changes in CMake 2.8.0 RC 3 +- CTest Added OS Platform (cpu architecture) detection support to windows system +- Several minor FindBoost changes to address posts on mailing list +- Resolve #9685: Fix include dir to be correct path for gnutils +- Fix color check for dependency scanning +- Remove CMP00015 for now as it breaks more things than it fixes +- Reduce duration of ctest_sleep arguments. Add SmallAndFast project. Replace kwsys with SmallAndFast to make CTestTest faster. (I will keep an eye on coverage results after this commit and make sure we still have equivalent ctest coverage.) +- Do not use -fPIC to link executables +- Split Borland compiler information files +- Trimmed off the newline from sw_vers output on mac, it could cause xml parsing errors if left in +- Check for openssl-linked option with Qt 4.4+ before making ssl a dependency. +- Make Complex test of CMakeLib more optional +- Modernize FindVTK module +- Fix find_package() when _DIR is wrong +- Do not collapse path of NOTFOUND values +- More robust implicit link line detection regex +- fix Xcode 30 generator +- Use the correct CMake (the freshly built one) to drive the CMakeWizardTest. +- Support more special characters in file(STRINGS) +- Log implicit link line detection regex +- speedup C dependency scanning even more +- Avoid non-root copies of root-only targets +- Added better OS information for Mac OS X +- Use work-around from bug 4772 for C++ and Fortran +- FortranCInterface: Mangling for Intel on Windows +- cmake-gui don't allow consecutive generates without a configure. +- Fix Preprocess test for Intel on Windows +- Teach intel compiler on windows to place .lib files and .pdb files. +- CPack: Fix bash-isms in launch script +- BUG: #0009648 Change "The following tests FAILED" message to print on stdout rather than stderr +- Avoid (Unix|Windows)Paths.cmake multiple include +- When getting include dirs for moc, also watch for framework includes and use -F instead of -I. +- Find locally installed software first +- Add '#!/bin/sh' to cygwin-package.sh +- Fix permsissions of installed SquishRunTestCase.sh +- Fix module docs to be manpage (groff) friendly +- Support GNU/kFreeBSD +- Remove old Encoding field from CMake.desktop +- FindQt3: Prefer (moc|uic)-qt3 names over (moc|uic) +- Match width of ctest "Start xx: " line to line up with the end test line +- Remove old license from FindPkgConfig.cmake module +- Test target link information invalidation +- Invalidate target link info when necessary +- Use new style header generation and get rid of OBJECT_DEPENDS in tutorial +- Fix issue #8649 - move the location of CPACK_NSIS_EXTRA_INSTALL_COMMANDS so that it is not excluded from execution when 'Do not create shortcuts' is checked. +- add the additional features for the dbus macros from KDE's FindQt4.cmake +fc9f7a5 Fix warnings in CMake source code. +- Correct some typos in error messages in the string command. Add a test that covers more of the code implemented in cmStringCommand.cxx, especially the error handlers. +- Create INTERPROCEDURAL_OPTIMIZATION build feature +- Document CMAKE_CURRENT_LIST_FILE more precisely +- Fix the documentation to say what it really does. Bug #9638 +- document how the minimum version can be specified +- Fix warnings in CMake source code. Suppress rampant warnings emanating from Qt files. +- Add documentation for Cocoa flag and move Motif under X11 flag. + Changes in CMake 2.8.0 RC 2 - Fix FindQt4 so that QtHelp depends on QtNetwork - Add missing copyright notice to CMake.cmake module diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index aa8fdc7ab..fb4f0e8a3 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -58,13 +58,12 @@ IF (NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF (NOT _INCLUDED_FILE) -# some systems include the compiler information in the system file -# and if this is the enable_language command then it may not have been -# included at this point, or needs to be included again so that the -# language_INIT variables are set correctly +# We specify the compiler information in the system file for some +# platforms, but this language may not have been enabled when the file +# was first included. Include it again to get the language info. +# Remove this when all compiler info is removed from system files. IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME} - OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) ENDIF (NOT _INCLUDED_FILE) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 681e49562..9929dfa0d 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -54,7 +54,15 @@ IF(CMAKE_CXX_COMPILER_ID) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF(CMAKE_CXX_COMPILER_ID) IF (NOT _INCLUDED_FILE) - INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL + RESULT_VARIABLE _INCLUDED_FILE) +ENDIF (NOT _INCLUDED_FILE) +# We specify the compiler information in the system file for some +# platforms, but this language may not have been enabled when the file +# was first included. Include it again to get the language info. +# Remove this when all compiler info is removed from system files. +IF (NOT _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) ENDIF (NOT _INCLUDED_FILE) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 872e9abbb..c8f4c9940 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -66,7 +66,9 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" # Skip this with Xcode for now. AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode) - CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs) + CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Parsed ${lang} implicit link information from above output:\n${log}\n\n") ENDIF() SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE) SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 68a9480a5..623caf9a8 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -25,6 +25,7 @@ # HP-UX HP-UX # IRIX IRIX # Linux Linux +# GNU/kFreeBSD GNU/kFreeBSD # NetBSD NetBSD # OpenBSD OpenBSD # OFS/1 (Digital Unix) OSF1 @@ -121,6 +122,11 @@ MACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) SET(${_PREFIX}_NAME BSDOS) ENDIF(${_PREFIX}_NAME MATCHES BSD.OS) + # fix for GNU/kFreeBSD, remove the GNU/ + IF(${_PREFIX}_NAME MATCHES kFreeBSD) + SET(${_PREFIX}_NAME kFreeBSD) + ENDIF(${_PREFIX}_NAME MATCHES kFreeBSD) + # fix for CYGWIN which has windows version in it IF(${_PREFIX}_NAME MATCHES CYGWIN) SET(${_PREFIX}_NAME CYGWIN) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 8d61cfb29..ea4feb08d 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -28,13 +28,20 @@ IF(CMAKE_COMPILER_IS_GNUG77) SET(CMAKE_BASE_NAME g77) ENDIF(CMAKE_COMPILER_IS_GNUG77) IF(CMAKE_Fortran_COMPILER_ID) - IF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake) - SET(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER_ID}-Fortran) - ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF(CMAKE_Fortran_COMPILER_ID) -SET(CMAKE_SYSTEM_AND_Fortran_COMPILER_INFO_FILE - ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) -INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) +IF (NOT _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL + RESULT_VARIABLE _INCLUDED_FILE) +ENDIF (NOT _INCLUDED_FILE) +# We specify the compiler information in the system file for some +# platforms, but this language may not have been enabled when the file +# was first included. Include it again to get the language info. +# Remove this when all compiler info is removed from system files. +IF (NOT _INCLUDED_FILE) + INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) +ENDIF (NOT _INCLUDED_FILE) + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index d0bbc8c09..b8a681f56 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -16,16 +16,20 @@ # This is used internally by CMake and should not be included by user # code. -function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var) +function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) set(implicit_libs "") set(implicit_dirs_tmp) + set(log "") # Parse implicit linker arguments. set(linker "CMAKE_LINKER-NOTFOUND") if(CMAKE_LINKER) get_filename_component(linker ${CMAKE_LINKER} NAME) endif() - set(linker_regex "^( *|.*/)(${linker}|ld|collect2)") + # Construct a regex to match linker lines. It must match both the + # whole line and just the command (argv[0]). + set(linker_regex "^( *|.*[/\\])(${linker}|ld|collect2)[^/\\]*( |$)") + set(log "${log} link line regex: [${linker_regex}]\n") string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) set(cmd) @@ -38,38 +42,51 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var) list(GET args 0 cmd) endif() if("${cmd}" MATCHES "${linker_regex}") + set(log "${log} link line: [${line}]\n") string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}") foreach(arg IN LISTS args) if("${arg}" MATCHES "^-L(.:)?[/\\]") # Unix search path. string(REGEX REPLACE "^-L" "" dir "${arg}") list(APPEND implicit_dirs_tmp ${dir}) + set(log "${log} arg [${arg}] ==> dir [${dir}]\n") elseif("${arg}" MATCHES "^-l[^:]") # Unix library. string(REGEX REPLACE "^-l" "" lib "${arg}") list(APPEND implicit_libs ${lib}) + set(log "${log} arg [${arg}] ==> lib [${lib}]\n") elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$") # Unix library full path. list(APPEND implicit_libs ${arg}) + set(log "${log} arg [${arg}] ==> lib [${arg}]\n") elseif("${arg}" MATCHES "^-Y(P,)?") # Sun search path. string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") string(REPLACE ":" ";" dirs "${dirs}") list(APPEND implicit_dirs_tmp ${dirs}) + set(log "${log} arg [${arg}] ==> dirs [${dirs}]\n") elseif("${arg}" MATCHES "^-l:") # HP named library. list(APPEND implicit_libs ${arg}) + set(log "${log} arg [${arg}] ==> lib [${arg}]\n") elseif("${arg}" MATCHES "^-z(all|default|weak)extract") # Link editor option. list(APPEND implicit_libs ${arg}) + set(log "${log} arg [${arg}] ==> opt [${arg}]\n") + else() + set(log "${log} arg [${arg}] ==> ignore\n") endif() endforeach() break() elseif("${line}" MATCHES "LPATH(=| is:? )") + set(log "${log} LPATH line: [${line}]\n") # HP search path. string(REGEX REPLACE ".*LPATH(=| is:? *)" "" paths "${line}") string(REPLACE ":" ";" paths "${paths}") list(APPEND implicit_dirs_tmp ${paths}) + set(log "${log} dirs [${paths}]\n") + else() + set(log "${log} ignore line: [${line}]\n") endif() endforeach() @@ -78,10 +95,16 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var) foreach(d IN LISTS implicit_dirs_tmp) get_filename_component(dir "${d}" ABSOLUTE) list(APPEND implicit_dirs "${dir}") + set(log "${log} collapse dir [${d}] ==> [${dir}]\n") endforeach() list(REMOVE_DUPLICATES implicit_dirs) + # Log results. + set(log "${log} implicit libs: [${implicit_libs}]\n") + set(log "${log} implicit dirs: [${implicit_dirs}]\n") + # Return results. set(${lib_var} "${implicit_libs}" PARENT_SCOPE) set(${dir_var} "${implicit_dirs}" PARENT_SCOPE) + set(${log_var} "${log}" PARENT_SCOPE) endfunction() diff --git a/Modules/CPack.RuntimeScript.in b/Modules/CPack.RuntimeScript.in index eaecdd8fa..f27444fd9 100755 --- a/Modules/CPack.RuntimeScript.in +++ b/Modules/CPack.RuntimeScript.in @@ -3,10 +3,10 @@ # Modified from: Aaron Voisine CWD="`dirname \"$0\"`" -TMP=/tmp/$UID/TemporaryItems +TMP=/tmp/$(id -ru)/TemporaryItems version=`sw_vers -productVersion` -if [ "$?" == "0" ]; then +if [ "$?" = "0" ]; then major=${version%%\.*} rest=${version#*\.} minor=${rest%%\.*} @@ -24,7 +24,7 @@ echo "Build = $build" # if 10.5 or greater, then all the open-x11 stuff need not occur -if ((( $major < 10 )) || ((( $major == 10)) && (( $minor < 5 )))); then +if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then version=`sw_vers -productVersion` if [ "$?" = "0" ]; then major=${version%%\.*} @@ -44,7 +44,7 @@ echo "Build = $build" # if 10.5 or greater, then all the open-x11 stuff need not occur -if ((( $major < 10 )) || ((( $major == 10)) && (( $minor < 5 )))); then +if [ "$major" -lt 10 ] || ([ "$major" -eq 10 ] && [ "$minor" -lt 5 ]); then ps -wx -ocommand | grep -e '[X]11.app' > /dev/null if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then echo "rm -f ~/.xinitrc" > ~/.xinitrc diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index fbee50a3f..b604d0ba6 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -22,13 +22,13 @@ # BISON_${Name}_OUTPUTS - The sources files generated by bison # BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line # -#==================================================================== -# Example: +# ==================================================================== +# Example: # -# find_package(BISON) -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) -# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) -#==================================================================== +# find_package(BISON) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) +# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) +# ==================================================================== #============================================================================= # Copyright 2009 Kitware, Inc. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 93d4683e9..04f5d528c 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1,6 +1,11 @@ # - Try to find Boost include dirs and libraries # Usage of this module as follows: # +# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below. +# Due to Boost naming conventions and limitations in CMake this find +# module is NOT future safe with respect to Boost version numbers, +# and may break. +# # == Using Header-Only libraries from within Boost: == # # find_package( Boost 1.36.0 ) @@ -65,7 +70,7 @@ # omit the 3rd version number from include paths if it is 0 although not all # binary Boost releases do so. # -# SET(Boost_ADDITIONAL_VERSIONS "0.99" "0.99.0" "1.78" "1.78.0") +# SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") # # ===================================== ============= ======================== # @@ -90,6 +95,12 @@ # of FindBoost.cmake if you are having problems. # Please enable this before filing any bug # reports. +# +# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information +# about why it failed or how to fix the problem +# unless this is set to TRUE or the REQUIRED +# keyword is specified in find_package(). +# [Since CMake 2.8.0] # # Boost_COMPILER Set this to the compiler suffix used by Boost # (e.g. "-gcc43") if FindBoost has problems finding @@ -154,6 +165,7 @@ # Copyright 2007 Wengo # Copyright 2007 Mike Jackson # Copyright 2008 Andreas Pakulat +# Copyright 2008-2009 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -547,8 +559,9 @@ ELSE (_boost_IN_CACHE) # NOTE: this is not perfect yet, if you experience any issues # please report them and use the Boost_COMPILER variable # to work around the problems. - if("${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") if(WIN32) set (_boost_COMPILER "-iw") else() @@ -874,11 +887,23 @@ ELSE (_boost_IN_CACHE) SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) ENDIF ( Boost_${UPPERCOMPONENT}_FOUND ) ENDFOREACH(COMPONENT) - ELSE (Boost_FOUND) - IF (Boost_FIND_REQUIRED) - message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") - ENDIF(Boost_FIND_REQUIRED) - ENDIF(Boost_FOUND) + else() + if(Boost_FIND_REQUIRED) + message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") + else() + if(NOT Boost_FIND_QUIETLY) + # we opt not to automatically output Boost_ERROR_REASON here as + # it could be quite lengthy and somewhat imposing in it's requests + # Since Boost is not always a required dependency we'll leave this + # up to the end-user. + if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) + message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") + else() + message(STATUS "Could NOT find Boost") + endif() + endif() + endif(Boost_FIND_REQUIRED) + endif() # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view MARK_AS_ADVANCED(Boost_INCLUDE_DIR diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index f615e0d24..34fcb9710 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -222,8 +222,7 @@ # James Bigler, NVIDIA Corp (nvidia.com - jbigler) # Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html # -# Copyright (c) 2008-2009 -# NVIDIA Corp. +# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. # # Copyright (c) 2007-2009 # Scientific Computing and Imaging Institute, University of Utah @@ -1028,6 +1027,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) ${main_dep} DEPENDS ${CUDA_NVCC_DEPEND} DEPENDS ${custom_target_script} + # Make sure the output directory exists before trying to write to it. + COMMAND ${CMAKE_COMMAND} -E make_directory "${generated_file_path}" COMMAND ${CMAKE_COMMAND} ARGS -D verbose:BOOL=${verbose_output} ${ccbin_flags} diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index 19e47d57b..7fce167c2 100755 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -1,8 +1,7 @@ # James Bigler, NVIDIA Corp (nvidia.com - jbigler) # Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html # -# Copyright (c) 2008-2009 -# NVIDIA Corp. +# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. # # Copyright (c) 2007-2009 # Scientific Computing and Imaging Institute, University of Utah diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake index b41dd63da..2518c6852 100644 --- a/Modules/FindCUDA/parse_cubin.cmake +++ b/Modules/FindCUDA/parse_cubin.cmake @@ -1,8 +1,7 @@ # James Bigler, NVIDIA Corp (nvidia.com - jbigler) # Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html # -# Copyright (c) 2008-2009 -# NVIDIA Corp. +# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. # # Copyright (c) 2007-2009 # Scientific Computing and Imaging Institute, University of Utah diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 9baca161a..4a9a7d4d6 100755 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -1,7 +1,6 @@ # James Bigler, NVIDIA Corp (nvidia.com - jbigler) # -# Copyright (c) 2008-2009 -# NVIDIA Corp. +# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. # # This code is licensed under the MIT License. See the FindCUDA.cmake script # for the text of the license. @@ -151,12 +150,6 @@ cuda_execute_process( COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}" ) -# Make sure the output directory is present -cuda_execute_process( - "Creating output directory: ${generated_file_path}" - COMMAND "${CMAKE_COMMAND}" -E make_directory "${generated_file_path}" - ) - # Generate the dependency file cuda_execute_process( "Generating dependency file: ${NVCC_generated_dependency_file}" diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index b9df0653e..068ee75d8 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -26,23 +26,23 @@ # where and are the first parameters of # respectively FLEX_TARGET and BISON_TARGET macros. # -#==================================================================== -# Example: +# ==================================================================== +# Example: # -# find_package(BISON) -# find_package(FLEX) +# find_package(BISON) +# find_package(FLEX) # -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp -# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp) -# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp +# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp) +# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) # -# include_directories(${CMAKE_CURRENT_BINARY_DIR}) -# add_executable(Foo -# Foo.cc -# ${BISON_MyParser_OUTPUTS} -# ${FLEX_MyScanner_OUTPUTS} -# ) -#==================================================================== +# include_directories(${CMAKE_CURRENT_BINARY_DIR}) +# add_executable(Foo +# Foo.cc +# ${BISON_MyParser_OUTPUTS} +# ${FLEX_MyScanner_OUTPUTS} +# ) +# ==================================================================== #============================================================================= # Copyright 2009 Kitware, Inc. diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index a70823fb8..72ab51162 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -40,11 +40,10 @@ IF (NOT WIN32) SET(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER}) ENDIF (NOT WIN32) -FIND_PATH(GNUTLS_INCLUDE_DIR gnutls.h +FIND_PATH(GNUTLS_INCLUDE_DIR gnutls/gnutls.h HINTS ${PC_GNUTLS_INCLUDEDIR} ${PC_GNUTLS_INCLUDE_DIRS} - PATH_SUFFIXES gnutls ) FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls @@ -53,13 +52,15 @@ FIND_LIBRARY(GNUTLS_LIBRARY NAMES gnutls libgnutls ${PC_GNUTLS_LIBRARY_DIRS} ) +MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) + # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR) -MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) - -SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) -SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) +IF(GNUTLS_FOUND) + SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY}) + SET(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR}) +ENDIF() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index f7d43c92e..6e6b802dd 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -69,6 +69,7 @@ #============================================================================= # Copyright 2006-2009 Kitware, Inc. +# Copyright 2006 Enrico Scholz # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -80,30 +81,6 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -# Copyright (C) 2006 Enrico Scholz -# -# Redistribution and use, with or without modification, are permitted -# provided that the following conditions are met: -# -# 1. Redistributions must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ### Common stuff #### set(PKG_CONFIG_VERSION 1) set(PKG_CONFIG_FOUND 0) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 21344775b..1cd59e781 100755 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -11,20 +11,20 @@ # PROTOBUF_INCLUDE_DIR - The include directory for protocol buffers # PROTOBUF_PROTOC_EXECUTABLE - The protoc compiler # -#==================================================================== -# Example: +# ==================================================================== +# Example: # -# find_package(Protobuf REQUIRED) -# include_directories(${PROTOBUF_INCLUDE_DIRS}) +# find_package(Protobuf REQUIRED) +# include_directories(${PROTOBUF_INCLUDE_DIRS}) # -# include_directories(${CMAKE_CURRENT_BINARY_DIR}) -# PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS foo.proto) -# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) -# target_link_libraries(bar ${PROTOBUF_LIBRARY}) +# include_directories(${CMAKE_CURRENT_BINARY_DIR}) +# PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS foo.proto) +# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) +# target_link_libraries(bar ${PROTOBUF_LIBRARY}) # # NOTE: You may need to link against pthreads, depending # on the platform. -#==================================================================== +# ==================================================================== # # PROTOBUF_GENERATE_CPP (public function) # SRCS = Variable to define with autogenerated @@ -33,7 +33,7 @@ # header files # ARGN = proto files # -#==================================================================== +# ==================================================================== #============================================================================= diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 46c337f17..d2f2f9013 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -138,7 +138,7 @@ FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY # qt 3 should prefer QTDIR over the PATH FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc moc-qt3 + NAMES moc-qt3 moc HINTS $ENV{QTDIR}/bin PATHS @@ -160,7 +160,8 @@ IF(QT_MOC_EXECUTABLE) ENDIF(QT_MOC_EXECUTABLE) # qt 3 should prefer QTDIR over the PATH -FIND_PROGRAM(QT_UIC_EXECUTABLE uic +FIND_PROGRAM(QT_UIC_EXECUTABLE + NAMES uic-qt3 uic HINTS $ENV{QTDIR}/bin PATHS diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 8fb95ee24..0688e53a5 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -14,6 +14,14 @@ # add_executable(myexe main.cpp) # target_link_libraries(myexe ${QT_LIBRARIES}) # +# The minimum required version can be specified using the standard find_package()-syntax +# (see example above). +# For compatibility with older versions of FindQt4.cmake it is also possible to +# set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the +# find_package(Qt4) command. +# If both are used, the version used in the find_package() command overrides the +# one from QT_MIN_VERSION. +# # 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: @@ -90,18 +98,21 @@ # for all listed interface xml files # the name will be automatically determined from the name of the xml file # -# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] ) +# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname]) # create a dbus adaptor (header and implementation file) from the xml file # describing the interface, and add it to the list of sources. The adaptor # forwards the calls to a parent class, defined in parentheader and named # parentclassname. The name of the generated files will be -# adaptor.{cpp,h} where basename is the basename of the xml file. +# adaptor.{cpp,h} where basename defaults to the basename of the xml file. +# If is provided, then it will be used as the classname of the +# adaptor itself. # -# macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] ) +# macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...) # generate the xml interface file from the given header. # If the optional argument interfacename is omitted, the name of the # interface file is constructed from the basename of the header with # the suffix .xml appended. +# Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help" # # macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... # ts_files ... OPTIONS ...) @@ -162,6 +173,9 @@ # QT_PHONON_FOUND True if phonon was found. # QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found. # +# QT_MAC_USE_COCOA For Mac OS X, its whether Cocoa or Carbon is used. +# In general, this should not be used, but its useful +# when having platform specific code. # # QT_DEFINITIONS Definitions to use when compiling code that uses Qt. # You do not need to use this if you include QT_USE_FILE. @@ -326,27 +340,27 @@ SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) # macro for asking qmake to process pro files MACRO(QT_QUERY_QMAKE outvar invar) IF(QT_QMAKE_EXECUTABLE) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro - "message(CMAKE_MESSAGE<$$${invar}>)") - - # Invoke qmake with the tmp.pro program to get the desired - # information. Use the same variable for both stdout and stderr - # to make sure we get the output on all platforms. - EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake - OUTPUT_VARIABLE _qmake_query_output - RESULT_VARIABLE _qmake_result - ERROR_VARIABLE _qmake_query_output ) - - FILE(REMOVE_RECURSE - "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") - - IF(_qmake_result) - MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}") - ELSE(_qmake_result) - STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") - ENDIF(_qmake_result) + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro + "message(CMAKE_MESSAGE<$$${invar}>)") + + # Invoke qmake with the tmp.pro program to get the desired + # information. Use the same variable for both stdout and stderr + # to make sure we get the output on all platforms. + EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} + WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake + OUTPUT_VARIABLE _qmake_query_output + RESULT_VARIABLE _qmake_result + ERROR_VARIABLE _qmake_query_output ) + + FILE(REMOVE_RECURSE + "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") + + IF(_qmake_result) + MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}") + ELSE(_qmake_result) + STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") + ENDIF(_qmake_result) ENDIF(QT_QMAKE_EXECUTABLE) ENDMACRO(QT_QUERY_QMAKE) @@ -406,17 +420,15 @@ 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 ) + # 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 + 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\"") @@ -431,27 +443,26 @@ 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 ) + # Support finding *exactly* a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 EXACT ) + 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_INSTALLED_VERSION_TOO_NEW TRUE) + SET(QT4_QMAKE_FOUND 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( Qt4_FIND_VERSION_EXACT ) ENDIF (qt_version_tmp) ENDIF (QT_QMAKE_EXECUTABLE) @@ -487,38 +498,38 @@ IF (QT4_QMAKE_FOUND) ENDIF (APPLE) # ask qmake for the binary dir - IF ((QT_LIBRARY_DIR AND NOT QT_BINARY_DIR) OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_BINS" OUTPUT_VARIABLE qt_bins ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_bins}" qt_bins) SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) - ENDIF ((QT_LIBRARY_DIR AND NOT QT_BINARY_DIR) OR QT_QMAKE_CHANGED) + ENDIF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) # ask qmake for the include dir - IF ((QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR) OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_HEADERS" OUTPUT_VARIABLE qt_headers ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_headers}" qt_headers) SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "" FORCE) - ENDIF ((QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR) OR QT_QMAKE_CHANGED) + ENDIF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the documentation directory - IF ((QT_LIBRARY_DIR AND NOT QT_DOC_DIR) OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_DOCS" OUTPUT_VARIABLE qt_doc_dir ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_doc_dir}" qt_doc_dir) SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE) - ENDIF ((QT_LIBRARY_DIR AND NOT QT_DOC_DIR) OR QT_QMAKE_CHANGED) + ENDIF (QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED) # ask qmake for the mkspecs directory - IF ((QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR) OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QMAKE_MKSPECS" OUTPUT_VARIABLE qt_mkspecs_dirs ) @@ -531,27 +542,27 @@ IF (QT4_QMAKE_FOUND) FIND_PATH(QT_MKSPECS_DIR qconfig.pri PATHS ${qt_mkspecs_dirs} DOC "The location of the Qt mkspecs containing qconfig.pri" NO_DEFAULT_PATH ) - ENDIF ((QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR) OR QT_QMAKE_CHANGED) + ENDIF (QT_LIBRARY_DIR AND NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the plugins directory - IF ((QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR) OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_PLUGINS" OUTPUT_VARIABLE qt_plugins_dir ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_plugins_dir}" qt_plugins_dir) SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins" FORCE) - ENDIF ((QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR) OR QT_QMAKE_CHANGED) + ENDIF (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) # ask qmake for the translations directory - IF ((QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR) OR QT_QMAKE_CHANGED) + IF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_TRANSLATIONS" OUTPUT_VARIABLE qt_translations_dir ) # make sure we have / and not \ as qmake gives on windows FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir) SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE) - ENDIF ((QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR) OR QT_QMAKE_CHANGED) + ENDIF (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED) ######################################## # @@ -657,7 +668,7 @@ IF (QT4_QMAKE_FOUND) MESSAGE( FATAL_ERROR "Could NOT find QtCore header") ENDIF(Qt4_FIND_REQUIRED) ENDIF( NOT QT_INCLUDE_DIR) - + # Make variables changeble to the advanced user MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_INCLUDE_DIR QT_DOC_DIR QT_MKSPECS_DIR QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) @@ -724,9 +735,9 @@ IF (QT4_QMAKE_FOUND) SET(QT_EDITION_DESKTOPLIGHT 1) ENDIF("${QT_EDITION}" MATCHES "DesktopLight") - - + + # find the libraries FOREACH(QT_MODULE ${QT_MODULES}) STRING(TOUPPER ${QT_MODULE} _upper_qt_module) @@ -865,10 +876,13 @@ IF (QT4_QMAKE_FOUND) _QT4_ADJUST_LIB_VARS(QTXMLPATTERNS) _QT4_ADJUST_LIB_VARS(PHONON) _QT4_ADJUST_LIB_VARS(QTCLUCENE) - _QT4_ADJUST_LIB_VARS(QTMOTIF) _QT4_ADJUST_LIB_VARS(QTSCRIPTTOOLS) + # platform dependent libraries + IF(Q_WS_X11) + _QT4_ADJUST_LIB_VARS(QTMOTIF) + ENDIF(Q_WS_X11) IF(WIN32) _QT4_ADJUST_LIB_VARS(QTMAIN) _QT4_ADJUST_LIB_VARS(QAXSERVER) @@ -1018,7 +1032,12 @@ IF (QT4_QMAKE_FOUND) GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) FOREACH(_current ${_inc_DIRS}) - SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") + IF("${_current}" MATCHES ".framework/?$") + STRING(REGEX REPLACE "/[^/]+.framework" "" framework_path "${_current}") + SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") + ELSE("${_current}" MATCHES ".framework/?$") + SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") + ENDIF("${_current}" MATCHES ".framework/?$") ENDFOREACH(_current ${_inc_DIRS}) GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) @@ -1067,6 +1086,7 @@ IF (QT4_QMAKE_FOUND) MACRO (QT4_GENERATE_MOC infile outfile ) + # get include dirs and flags QT4_GET_MOC_FLAGS(moc_flags) GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) QT4_CREATE_MOC_COMMAND(${abs_infile} ${outfile} "${moc_flags}" "") @@ -1174,8 +1194,9 @@ IF (QT4_QMAKE_FOUND) ENDMACRO(QT4_ADD_DBUS_INTERFACES) - MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName ) - SET(_customName "${ARGV1}") + MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) + QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN}) + GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE) GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) @@ -1186,13 +1207,13 @@ IF (QT4_QMAKE_FOUND) ENDIF (_customName) ADD_CUSTOM_COMMAND(OUTPUT ${_target} - COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} -o ${_target} ${_in_file} + COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target} DEPENDS ${_in_file} ) ENDMACRO(QT4_GENERATE_DBUS_INTERFACE) - MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename ) + MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE) SET(_optionalBasename "${ARGV4}") @@ -1253,6 +1274,7 @@ IF (QT4_QMAKE_FOUND) IF(_match) FOREACH (_current_MOC_INC ${_match}) STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) IF(EXISTS ${_abs_PATH}/${_basename}.hpp) SET(_header ${_abs_PATH}/${_basename}.hpp) @@ -1343,7 +1365,7 @@ IF (QT4_QMAKE_FOUND) QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET( QT4_FOUND "YES" ) INCLUDE(FindPackageMessage) - FIND_PACKAGE_MESSAGE(Qt4 "Found Qt-Version ${QTVERSION}" + FIND_PACKAGE_MESSAGE(Qt4 "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})" "[${QT_LIBRARY_DIR}][${QT_INCLUDE_DIR}][${QT_MOC_EXECUTABLE}][${QT_UIC_EXECUTABLE}][${QT_RCC_EXECUTABLE}]") ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) @@ -1497,12 +1519,21 @@ IF (QT4_QMAKE_FOUND) ENDIF(QT_QCONFIG MATCHES "system-zlib") ## openssl - IF(QT_QCONFIG MATCHES "openssl" AND NOT Q_WS_WIN) - FIND_PACKAGE(OpenSSL) - IF(OPENSSL_LIBRARIES) - SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_LIBRARIES) - ENDIF(QT_QCONFIG MATCHES "openssl" AND NOT Q_WS_WIN) + IF(NOT Q_WS_WIN) + SET(_QT_NEED_OPENSSL 0) + IF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") + SET(_QT_NEED_OPENSSL 1) + ENDIF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") + IF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") + SET(_QT_NEED_OPENSSL 1) + ENDIF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") + IF(_QT_NEED_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_LIBRARIES) + SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_LIBRARIES) + ENDIF(_QT_NEED_OPENSSL) + ENDIF(NOT Q_WS_WIN) ## dbus IF(QT_QCONFIG MATCHES "dbus") diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index fce10bc08..69e18742e 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -40,32 +40,41 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) +# Assume not found. +SET(VTK_FOUND 0) + +# VTK 4.0 did not provide VTKConfig.cmake. +IF("${VTK_FIND_VERSION}" VERSION_LESS 4.1) + SET(_VTK_40_ALLOW 1) + IF(VTK_FIND_VERSION) + SET(_VTK_40_ONLY 1) + ENDIF() +ENDIF() + # Construct consitent error messages for use below. -SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation. For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") +SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") +IF(_VTK_40_ALLOW) + SET(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") +ENDIF() SET(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") -# Search only if the location is not already known. -IF(NOT VTK_DIR) - # Get the system search path as a list. - IF(UNIX) - STRING(REGEX MATCHALL "[^:]+" VTK_DIR_SEARCH1 "$ENV{PATH}") - ELSE(UNIX) - STRING(REGEX REPLACE "\\\\" "/" VTK_DIR_SEARCH1 "$ENV{PATH}") - ENDIF(UNIX) - STRING(REGEX REPLACE "/;" ";" VTK_DIR_SEARCH2 "${VTK_DIR_SEARCH1}") +# Check whether VTK 4.0 has already been found. +IF(_VTK_40_ALLOW AND VTK_DIR) + IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) + SET(VTK_FOUND 1) + INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. + ENDIF() +ENDIF() - # Construct a set of paths relative to the system search path. - SET(VTK_DIR_SEARCH "") - FOREACH(dir ${VTK_DIR_SEARCH2}) - SET(VTK_DIR_SEARCH ${VTK_DIR_SEARCH} - ${dir}/../lib/vtk-5.4 - ${dir}/../lib/vtk-5.2 - ${dir}/../lib/vtk-5.1 - ${dir}/../lib/vtk-5.0 - ${dir}/../lib/vtk - ) - ENDFOREACH(dir) +# Use the Config mode of the find_package() command to find VTKConfig. +# If this succeeds (possibly because VTK_DIR is already set), the +# command will have already loaded VTKConfig.cmake and set VTK_FOUND. +IF(NOT _VTK_40_ONLY AND NOT VTK_FOUND) + FIND_PACKAGE(VTK QUIET NO_MODULE) +ENDIF() +# Special search for VTK 4.0. +IF(_VTK_40_ALLOW AND NOT VTK_DIR) # Old scripts may set these directories in the CMakeCache.txt file. # They can tell us where to find VTKConfig.cmake. SET(VTK_DIR_SEARCH_LEGACY "") @@ -77,22 +86,16 @@ IF(NOT VTK_DIR) ${VTK_INSTALL_PATH}/lib/vtk) ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - # - # Look for an installation or build tree. - # - FIND_PATH(VTK_DIR UseVTK.cmake - # Support legacy cache files. - ${VTK_DIR_SEARCH_LEGACY} - - # Look for an environment variable VTK_DIR. - $ENV{VTK_DIR} + # Look for UseVTK.cmake in build trees or under /include/vtk. + FIND_PATH(VTK_DIR + NAMES UseVTK.cmake + PATH_SUFFIXES vtk-4.0 vtk + HINTS $ENV{VTK_DIR} - # Look in places relative to the system executable search path. - ${VTK_DIR_SEARCH} + PATHS - # Look in standard UNIX install locations. - /usr/local/lib/vtk - /usr/lib/vtk + # Support legacy cache files. + ${VTK_DIR_SEARCH_LEGACY} # Read from the CMakeSetup registry entries. It is likely that # VTK will have been recently built. @@ -109,34 +112,18 @@ IF(NOT VTK_DIR) # Help the user find it if we cannot. DOC "The ${VTK_DIR_DESCRIPTION}" - ) -ENDIF(NOT VTK_DIR) - -# If VTK was found, load the configuration file to get the rest of the -# settings. -IF(VTK_DIR) - # Make sure the VTKConfig.cmake file exists in the directory provided. - IF(EXISTS ${VTK_DIR}/VTKConfig.cmake) - - # We found VTK. Load the settings. - SET(VTK_FOUND 1) - INCLUDE(${VTK_DIR}/VTKConfig.cmake) + ) - ELSE(EXISTS ${VTK_DIR}/VTKConfig.cmake) - IF(EXISTS ${VTK_DIR}/UseVTK.cmake) - # We found VTK 4.0 (UseVTK.cmake exists, but not VTKConfig.cmake). + IF(VTK_DIR) + IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) SET(VTK_FOUND 1) - # Load settings for VTK 4.0. - INCLUDE(UseVTKConfig40) - ELSE(EXISTS ${VTK_DIR}/UseVTK.cmake) - # We did not find VTK. - SET(VTK_FOUND 0) - ENDIF(EXISTS ${VTK_DIR}/UseVTK.cmake) - ENDIF(EXISTS ${VTK_DIR}/VTKConfig.cmake) -ELSE(VTK_DIR) - # We did not find VTK. - SET(VTK_FOUND 0) -ENDIF(VTK_DIR) + INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. + ELSE() + # We found the wrong version. Pretend we did not find it. + SET(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) + ENDIF() + ENDIF() +ENDIF() #----------------------------------------------------------------------------- IF(VTK_FOUND) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index 8402940e0..d014d9ac8 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -25,8 +25,10 @@ set(global_symbols my_sub # VisualAge my_sub_ # GNU, Intel, HP, SunPro, MIPSpro my_sub__ # GNU g77 + MY_SUB # Intel on Windows mysub # VisualAge mysub_ # GNU, Intel, HP, SunPro, MIPSpro + MYSUB # Intel on Windows ${FortranCInterface_GLOBAL_SYMBOLS} ) list(REMOVE_DUPLICATES global_symbols) @@ -41,9 +43,11 @@ set(module_symbols __mymodule__mysub # GNU 4.2 my_module$my_sub # HP my_module_mp_my_sub_ # Intel + MY_MODULE_mp_MY_SUB # Intel on Windows my_module_my_sub_ # PGI mymodule$mysub # HP mymodule_mp_mysub_ # Intel + MYMODULE_mp_MYSUB # Intel on Windows mymodule_mysub_ # PGI ${FortranCInterface_MODULE_SYMBOLS} ) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 99b3a9020..c18104dc8 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -705,10 +705,10 @@ Section "-Core installation" Push "$INSTALL_DESKTOP" Call ConditionalAddToRegisty -@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ - !insertmacro MUI_STARTMENU_WRITE_END +@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ + SectionEnd Section "-Add to path" diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake index 554945edf..7be331ea8 100644 --- a/Modules/Platform/Linux-Intel-C.cmake +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -1,6 +1,8 @@ INCLUDE(Platform/Linux-Intel) IF(XIAR) - SET(CMAKE_C_CREATE_STATIC_LIBRARY + # INTERPROCEDURAL_OPTIMIZATION + SET(CMAKE_C_COMPILE_OPTIONS_IPO -ipo) + SET(CMAKE_C_CREATE_STATIC_LIBRARY_IPO "${XIAR} cr " "${XIAR} -s ") ENDIF(XIAR) diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake index faa19e3e0..cedb19638 100644 --- a/Modules/Platform/Linux-Intel-CXX.cmake +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -1,6 +1,8 @@ INCLUDE(Platform/Linux-Intel) IF(XIAR) - SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + # INTERPROCEDURAL_OPTIMIZATION + SET(CMAKE_CXX_COMPILE_OPTIONS_IPO -ipo) + SET(CMAKE_CXX_CREATE_STATIC_LIBRARY_IPO "${XIAR} cr " "${XIAR} -s ") ENDIF(XIAR) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index 1db5ba645..27a98ed93 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,6 +1,8 @@ INCLUDE(Platform/Linux-Intel) IF(XIAR) - SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY + # INTERPROCEDURAL_OPTIMIZATION + SET(CMAKE_Fortran_COMPILE_OPTIONS_IPO -ipo) + SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY_IPO "${XIAR} cr " "${XIAR} -s ") ENDIF(XIAR) diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index 030f2c090..e7a67b6c4 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -1,11 +1,11 @@ if(NOT XIAR) - set(_intel_xair_hints) + set(_intel_xiar_hints) foreach(lang C CXX Fortran) if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}") get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH) - list(APPEND _intel_xair_hints ${_hint}) + list(APPEND _intel_xiar_hints ${_hint}) endif() endforeach() - find_program(XIAR NAMES xiar HINTS ${_intel_xair_hints}) + find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints}) mark_as_advanced(XIAR) endif(NOT XIAR) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 584d3346c..ea64b781d 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -1,3 +1,27 @@ + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# Block multiple inclusion because "CMakeCInformation.cmake" includes +# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module +# "CMakeSystemSpecificInformation.cmake" already included it. +# The extra inclusion is a work-around documented next to the include() +# call, so this can be removed when the work-around is removed. +IF(__UNIX_PATHS_INCLUDED) + RETURN() +ENDIF() +SET(__UNIX_PATHS_INCLUDED 1) + SET(UNIX 1) # also add the install directory of the running cmake to the search directories @@ -9,7 +33,7 @@ GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) # search types. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH # Standard - / /usr /usr/local + /usr/local / /usr # CMake install location "${_CMAKE_INSTALL_DIR}" diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake new file mode 100644 index 000000000..ebb74a11e --- /dev/null +++ b/Modules/Platform/Windows-Borland-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Borland) +__borland_language(C) diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake new file mode 100644 index 000000000..1260c0e90 --- /dev/null +++ b/Modules/Platform/Windows-Borland-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Borland) +__borland_language(CXX) diff --git a/Modules/Platform/Windows-Borland.cmake b/Modules/Platform/Windows-Borland.cmake new file mode 100644 index 000000000..7b7ae8493 --- /dev/null +++ b/Modules/Platform/Windows-Borland.cmake @@ -0,0 +1,121 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_BORLAND) + return() +endif() +set(__WINDOWS_BORLAND 1) + +SET(BORLAND 1) + +# Borland target type flags (bcc32 -h -t): +# -tW GUI App (implies -U__CONSOLE__) +# -tWC Console App (implies -D__CONSOLE__=1) +# -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) +# -tWM Enable threads (implies -D__MT__=1 -D_MT=1) +# -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) +# +# Notes: +# - The flags affect linking so we pass them to the linker. +# - The flags affect preprocessing so we pass them to the compiler. +# - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. +# - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. +set(_RTLDLL "-tWR -tW-") +set(_COMPILE_C "-c") +set(_COMPILE_CXX "-P -c") + +SET(CMAKE_LIBRARY_PATH_FLAG "-L") +SET(CMAKE_LINK_LIBRARY_FLAG "") + +SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") + +# uncomment these out to debug makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + +# Borland cannot handle + in the file name, so mangle object file name +SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") + +# extra flags for a win32 exe +SET(CMAKE_CREATE_WIN32_EXE "-tW" ) +# extra flags for a console app +SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) + +SET (CMAKE_BUILD_TYPE Debug CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") + +SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + +macro(__borland_language lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD") + + # compile a source file into an object file + # place outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_COMPILE_OBJECT + " ${_RTLDLL} ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" + ) + + set(CMAKE_${lang}_LINK_EXECUTABLE + " ${_RTLDLL} -e ${CMAKE_START_TEMP_FILE} ${CMAKE_END_TEMP_FILE}" + # "implib -c -w " + ) + + # place outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "cpp32 ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" + ) + # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not + + # Create a module library. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + " ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e ${CMAKE_END_TEMP_FILE}" + ) + + # Create an import library for another target. + set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY + "implib -c -w " + ) + + # Create a shared library. + # First create a module and then its import library. + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + ${CMAKE_${lang}_CREATE_SHARED_MODULE} + ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY} + ) + + # create a static library + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + "tlib ${CMAKE_START_TEMP_FILE}/p512 /a ${CMAKE_END_TEMP_FILE}" + ) + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "-tWM") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od") + set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib") +endmacro() diff --git a/Modules/Platform/Windows-bcc32.cmake b/Modules/Platform/Windows-bcc32.cmake deleted file mode 100644 index a2035c284..000000000 --- a/Modules/Platform/Windows-bcc32.cmake +++ /dev/null @@ -1,128 +0,0 @@ -# Borland shared library issues: -# When building dll's with borland, the run time dll c/c++ library from -# borland must be used. This is specified with the -tWR compiler option. -# This flag must be present during compilation of c and c++ files and -# for the linking of exe and dll files. But wait, there is more, -# the -tWR flag must come after the -tWD and -tWM flags, but before the -tWC flag. -# Order counts, so be careful! -# if building static, you don't want the -tWR flag as it will make your program -# depend on the borland run time dll. -# So, if a project has CMAKE_BUILD_SHARED on, then the -tWR flag is added all over, and -# it is left out if not. - -SET(CMAKE_LIBRARY_PATH_FLAG "-L") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(CMAKE_SHARED_BUILD_CXX_FLAGS "-tWR") -SET(CMAKE_SHARED_BUILD_C_FLAGS "-tWR") -SET(BORLAND 1) - -SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") - -# uncomment these out to debug makefiles -#SET(CMAKE_START_TEMP_FILE "") -#SET(CMAKE_END_TEMP_FILE "") -#SET(CMAKE_VERBOSE_MAKEFILE 1) - -# Borland cannot handle + in the file name, so mangle object file name -SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") - -# Create an import library for another target. -SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY - "implib -c -w " - ) - -# Create a C++ module library. -SET(CMAKE_CXX_CREATE_SHARED_MODULE - " ${CMAKE_START_TEMP_FILE}-e -tWD -tWR ${CMAKE_END_TEMP_FILE}" -) - -# Create a C++ shared library. -# First create a module and then its import library. -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - ${CMAKE_CXX_CREATE_SHARED_MODULE} - ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) - -# Create an import library for another target. -SET(CMAKE_C_CREATE_IMPORT_LIBRARY ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) - -# Create a C module library. -SET(CMAKE_C_CREATE_SHARED_MODULE - " ${CMAKE_START_TEMP_FILE}-e -tWD -tWR ${CMAKE_END_TEMP_FILE}" -) - -# Create a C shared library. -# First create a module and then its import library. -SET(CMAKE_C_CREATE_SHARED_LIBRARY - ${CMAKE_C_CREATE_SHARED_MODULE} - ${CMAKE_C_CREATE_IMPORT_LIBRARY}) - -# create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "tlib ${CMAKE_START_TEMP_FILE}/p512 /a ${CMAKE_END_TEMP_FILE}") - -# create a C static library -SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) - -# compile a C++ file into an object file -# place outside the response file because Borland refuses -# to parse quotes from the response file. -SET(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE}-DWIN32 -P -o -c ${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -# place outside the response file because Borland refuses -# to parse quotes from the response file. -SET(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE}-DWIN32 -o -c ${CMAKE_END_TEMP_FILE}") - - -SET(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_START_TEMP_FILE}-e ${CMAKE_END_TEMP_FILE}" -# "implib -c -w " - ) - - -SET(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_START_TEMP_FILE} -e ${CMAKE_END_TEMP_FILE}" -# "implib -c -w " - ) - -SET (CMAKE_BUILD_TYPE Debug CACHE STRING - "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") - -# extra flags for a win32 exe -SET(CMAKE_CREATE_WIN32_EXE "-tW -tWM" ) -# extra flags for a console app -SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) - -SET (CMAKE_CXX_FLAGS_INIT "-tWM") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-Od -v") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-Od") -SET (CMAKE_C_FLAGS_INIT "-tWM") -SET (CMAKE_C_FLAGS_DEBUG_INIT "-Od -v") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") -SET (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-Od") - -SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - -SET (CMAKE_C_STANDARD_LIBRARIES_INIT "import32.lib") -SET (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# preprocess C and CXX files -# place outside the response file because Borland refuses -# to parse quotes from the response file. -SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE - "cpp32 ${CMAKE_START_TEMP_FILE}-DWIN32 -o -c ${CMAKE_END_TEMP_FILE}") -SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - "cpp32 ${CMAKE_START_TEMP_FILE}-DWIN32 -o -P -c ${CMAKE_END_TEMP_FILE}") -# Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake index 6ba372b4c..2f1ef2913 100644 --- a/Modules/Platform/Windows-icl.cmake +++ b/Modules/Platform/Windows-icl.cmake @@ -8,7 +8,7 @@ ELSE(CMAKE_VERBOSE_MAKEFILE) ENDIF(CMAKE_VERBOSE_MAKEFILE) # create a shared C++ library SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /dll ${CMAKE_END_TEMP_FILE}") + "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) @@ -35,12 +35,18 @@ SET(CMAKE_C_COMPILE_OBJECT SET(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -E ${CMAKE_END_TEMP_FILE}") SET(CMAKE_COMPILE_RESOURCE "rc /fo ") SET(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index 00e3afa12..8c67175c2 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -1,3 +1,27 @@ + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# Block multiple inclusion because "CMakeCInformation.cmake" includes +# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module +# "CMakeSystemSpecificInformation.cmake" already included it. +# The extra inclusion is a work-around documented next to the include() +# call, so this can be removed when the work-around is removed. +IF(__WINDOWS_PATHS_INCLUDED) + RETURN() +ENDIF() +SET(__WINDOWS_PATHS_INCLUDED 1) + # Add the program-files folder(s) to the list of installation # prefixes. # diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake index b14514acc..ff050dec1 100644 --- a/Modules/Platform/kFreeBSD.cmake +++ b/Modules/Platform/kFreeBSD.cmake @@ -1,12 +1,2 @@ # kFreeBSD looks just like Linux. -SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") -SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") - -INCLUDE(Platform/UnixPaths) +INCLUDE(Platform/Linux) diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake index f8089e5ae..6581d07b1 100644 --- a/Modules/TestForANSIForScope.cmake +++ b/Modules/TestForANSIForScope.cmake @@ -1,5 +1,5 @@ # - Check for ANSI for scope support -# Check if the compiler supports std:: on stl classes. +# Check if the compiler restricts the scope of variables declared in a for-init-statement to the loop body. # CMAKE_NO_ANSI_FOR_SCOPE - holds result # diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake index 2ce2a5576..f62f3a4db 100644 --- a/Modules/TestForANSIStreamHeaders.cmake +++ b/Modules/TestForANSIStreamHeaders.cmake @@ -1,5 +1,5 @@ # - Test for compiler support of ANSI stream headers iostream, etc. -# check if we they have the standard ansi stream files (without the .h) +# check if the compiler supports the standard ANSI iostream header (without the .h) # CMAKE_NO_ANSI_STREAM_HEADERS - defined by the results # diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake index 959c9df9c..4c8b11b97 100644 --- a/Modules/TestForSSTREAM.cmake +++ b/Modules/TestForSSTREAM.cmake @@ -1,5 +1,5 @@ -# # - Test for std:: namespace support -# check if the compiler supports std:: on stl classes +# - Test for compiler support of ANSI sstream header +# check if the compiler supports the standard ANSI sstream header # CMAKE_NO_ANSI_STRING_STREAM - defined by the results # diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 7c8405e9c..6224b4070 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -390,8 +390,6 @@ int cmCPackGenerator::InstallProjectViaInstallScript( { const char* cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPT"); - std::string currentWorkingDirectory = - cmSystemTools::GetCurrentWorkingDirectory(); if ( cmakeScripts && *cmakeScripts ) { cmCPackLogger(cmCPackLog::LOG_OUTPUT, @@ -460,8 +458,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); const char* cmakeGenerator = this->GetOption("CPACK_CMAKE_GENERATOR"); - std::string currentWorkingDirectory = - cmSystemTools::GetCurrentWorkingDirectory(); if ( cmakeProjects && *cmakeProjects ) { if ( !cmakeGenerator ) diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 11058c9a3..a3b575939 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -149,8 +149,21 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName, cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress disk image using command: " << dmgCmd.str().c_str() << std::endl); - bool res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, this->GeneratorVerbose, 0); + // since we get random dashboard failures with this one + // try running it more than once + int numTries = 4; + bool res; + while(numTries > 0) + { + res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, + &retVal, 0, + this->GeneratorVerbose, 0); + if(res && retVal) + { + numTries = -1; + } + numTries--; + } if ( !res || retVal ) { cmGeneratedFileStream ofs(tmpFile.c_str()); diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index befbc9489..9333131f9 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -321,8 +321,19 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, << "\" \"" << outFileName << "\""; std::string output; int retVal = 1; - bool res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, this->GeneratorVerbose, 0); + int numTries = 4; + bool res; + while(numTries > 0) + { + res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, + &retVal, 0, this->GeneratorVerbose, + 0); + if(res && retVal) + { + numTries = -1; + } + numTries--; + } if ( !res || retVal ) { cmGeneratedFileStream ofs(tmpFile.c_str()); diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 3ca0e53ce..1c56d81a9 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -176,12 +176,12 @@ int cmCPackTGZ_Data_Close(void *client_data) int n; uLong x = mydata->CRC; for (n = 0; n < 4; n++) { - buffer[n] = (int)(x & 0xff); + buffer[n] = static_cast(x & 0xff); x >>= 8; } x = mydata->ZLibStream.total_in; for (n = 0; n < 4; n++) { - buffer[n+4] = (int)(x & 0xff); + buffer[n+4] = static_cast(x & 0xff); x >>= 8; } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d93da07b8..0095bbccb 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -596,8 +596,8 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os) std::vector::iterator it; // only report the first 50 warnings and first 50 errors - unsigned short numErrorsAllowed = this->MaxErrors; - unsigned short numWarningsAllowed = this->MaxWarnings; + int numErrorsAllowed = this->MaxErrors; + int numWarningsAllowed = this->MaxWarnings; std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory"); // make sure the source dir is in the correct case on windows // via a call to collapse full path. diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index b6e10bfe1..c2135aa62 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -361,9 +361,6 @@ int cmCTestCoverageHandler::ProcessHandler() cmSystemTools::ConvertToUnixSlashes(sourceDir); cmSystemTools::ConvertToUnixSlashes(binaryDir); - std::string asfGlob = sourceDir + "/*"; - std::string abfGlob = binaryDir + "/*"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl); cmCTestCoverageHandlerContainer cont; @@ -1590,13 +1587,13 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( std::string shortFileName = this->CTest->GetShortPathToFile(file.c_str()); - float cper = percentBranch + percentFunction; + float cper = static_cast(percentBranch + percentFunction); if(totalBranches > 0) { cper /= 2.0f; } percent_coverage += cper; - float cmet = percentFunction + percentBranch; + float cmet = static_cast(percentFunction + percentBranch); if(totalBranches > 0) { cmet /= 2.0f; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 7ab9caca4..63dfe7e1c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -81,7 +81,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler); testRun->SetIndex(test); testRun->SetTestProperties(this->Properties[test]); - if(testRun->StartTest()) + if(testRun->StartTest(this->Total)) { this->RunningTests.insert(testRun); } @@ -251,7 +251,8 @@ bool cmCTestMultiProcessHandler::CheckOutput() this->TestRunningMap[test] = false; this->RunningTests.erase(p); this->WriteCheckpoint(test); - this->WriteCostData(test, p->GetTestResults().ExecutionTime); + this->WriteCostData(test, static_cast( + p->GetTestResults().ExecutionTime)); this->RunningCount -= GetProcessorsUsed(test); delete p; } @@ -276,7 +277,7 @@ void cmCTestMultiProcessHandler::ReadCostData() cmSystemTools::SplitString(line.c_str(), ' '); int index = atoi(parts[0].c_str()); - float cost = atof(parts[1].c_str()); + float cost = static_cast(atof(parts[1].c_str())); if(this->Properties[index] && this->Properties[index]->Cost == 0) { this->Properties[index]->Cost = cost; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index ffc257a7f..982beb340 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -297,9 +297,11 @@ void cmCTestRunTest::MemCheckPostProcess() //---------------------------------------------------------------------- // Starts the execution of a test. Returns once it has started -bool cmCTestRunTest::StartTest() +bool cmCTestRunTest::StartTest(size_t total) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Start " + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8) + << "Start " + << std::setw(getNumWidth(total)) << this->TestProperties->Index << ": " << this->TestProperties->Name << std::endl); this->ComputeArguments(); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index aeffbb802..bfeda209a 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -46,7 +46,7 @@ public: bool CheckOutput(); //launch the test process, return whether it started correctly - bool StartTest(); + bool StartTest(size_t total); //capture and report the test results bool EndTest(size_t completed, size_t total, bool started); //Called by ctest -N to log the command string diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2ad2e37f3..3572b1145 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -574,16 +574,16 @@ int cmCTestTestHandler::ProcessHandler() } } - float percent = float(passed.size()) * 100.0f / total; + float percent = float(passed.size()) * 100.0f / float(total); if ( failed.size() > 0 && percent > 99) { percent = 99; } - + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << static_cast(percent + .5) << "% tests passed, " - << failed.size() << " tests failed out of " - << total << std::endl); + << failed.size() << " tests failed out of " + << total << std::endl); if(this->CTest->GetLabelSummary()) { this->PrintLabelSummary(); @@ -596,7 +596,7 @@ int cmCTestTestHandler::ProcessHandler() if (failed.size()) { cmGeneratedFileStream ofs; - cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "The following tests FAILED:" << std::endl); this->StartLogFile("TestsFailed", ofs); @@ -1982,7 +1982,7 @@ bool cmCTestTestHandler::SetTestsProperties( } if ( key == "COST" ) { - rtit->Cost = atof(val.c_str()); + rtit->Cost = static_cast(atof(val.c_str())); } if ( key == "RUN_SERIAL" ) { diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 854b91952..cd231ad90 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -920,7 +920,7 @@ void cmCursesMainForm::HandleInput() { if ( this->SearchString.size() < static_cast(x-10) ) { - this->SearchString += key; + this->SearchString += static_cast(key); } } else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC ) diff --git a/Source/QtDialog/CMake.desktop b/Source/QtDialog/CMake.desktop index 9568501b9..d1d4fb2f3 100644 --- a/Source/QtDialog/CMake.desktop +++ b/Source/QtDialog/CMake.desktop @@ -1,6 +1,5 @@ [Desktop Entry] Version=1.0 -Encoding=UTF-8 Name=CMake Comment=Cross-platform buildsystem Exec=cmake-gui %f diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index ea65f2d89..a3de4db43 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -342,7 +342,7 @@ void CMakeSetupDialog::finishConfigure(int err) void CMakeSetupDialog::finishGenerate(int err) { - this->enterState(ReadyGenerate); + this->enterState(ReadyConfigure); if(err != 0) { QMessageBox::critical(this, tr("Error"), diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index d0c28a8e7..942cb3fa7 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -149,10 +149,8 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, std::set dependencies; std::set scanned; - // Use reserve to allocate enough memory for both strings, + // Use reserve to allocate enough memory for tempPathStr // so that during the loops no memory is allocated or freed - std::string cacheKey; - cacheKey.reserve(4*1024); std::string tempPathStr; tempPathStr.reserve(4*1024); @@ -181,22 +179,8 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, } else { - // With GCC distribution of STL, assigning to a string directly - // throws away the internal buffer of the left-hand-side. We - // want to keep the pre-allocated buffer so we use C-style - // string assignment and then operator+=. We could call - // .clear() instead of assigning to an empty string but the - // method does not exist on some older compilers. - cacheKey = ""; - cacheKey += current.FileName; - - for(std::vector::const_iterator i = - this->IncludePath.begin(); i != this->IncludePath.end(); ++i) - { - cacheKey+=*i; - } std::map::iterator - headerLocationIt=this->HeaderLocationCache.find(cacheKey); + headerLocationIt=this->HeaderLocationCache.find(current.FileName); if (headerLocationIt!=this->HeaderLocationCache.end()) { fullName=headerLocationIt->second; @@ -214,16 +198,16 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj, } else { - tempPathStr += *i; - tempPathStr+="/"; - tempPathStr+=current.FileName; + tempPathStr += *i; + tempPathStr+="/"; + tempPathStr+=current.FileName; } // Look for the file in this location. if(cmSystemTools::FileExists(tempPathStr.c_str(), true)) { - fullName = tempPathStr; - HeaderLocationCache[cacheKey]=fullName; + fullName = tempPathStr; + HeaderLocationCache[current.FileName]=fullName; break; } } diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index ea07da46f..b42f2a95c 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -56,7 +56,18 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Full path to the listfile currently being processed.", "As CMake processes the listfiles in your project this " "variable will always be set to the one currently being " - "processed. See also CMAKE_PARENT_LIST_FILE.",false, + "processed. " + "The value has dynamic scope. " + "When CMake starts processing commands in a source file " + "it sets this variable to the location of the file. " + "When CMake finishes processing commands from the file it " + "restores the previous value. " + "Therefore the value of the variable inside a macro or " + "function is the file invoking the bottom-most entry on " + "the call stack, not the file containing the macro or " + "function definition." + "\n" + "See also CMAKE_PARENT_LIST_FILE.",false, "Variables that Provide Information"); cm->DefineProperty diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index c01e22046..763fdd849 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -540,7 +540,7 @@ bool cmELFInternalImpl::LoadDynamicSection() // Allocate the dynamic section entries. ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex]; - int n = sec.sh_size / sec.sh_entsize; + int n = static_cast(sec.sh_size / sec.sh_entsize); this->DynamicSectionEntries.resize(n); // Read each entry. @@ -592,7 +592,7 @@ unsigned long cmELFInternalImpl::GetDynamicEntryPosition(int j) return 0; } ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex]; - return sec.sh_offset + sec.sh_entsize*j; + return static_cast(sec.sh_offset + sec.sh_entsize*j); } //---------------------------------------------------------------------------- diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index a70ca7511..abe6bc9f6 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -531,6 +531,13 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) return false; } + // At least one compiler (Portland Group Fortran) produces binaries + // with some extra characters in strings. + char extra[256]; // = {}; // some compilers do not like this + memset(extra, 0, sizeof(extra)); + extra[0x0c] = 1; // FF (form feed) + extra[0x14] = 1; // DC4 (device control 4) + // Parse strings out of the file. int output_size = 0; std::vector strings; @@ -585,7 +592,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) { // Ignore CR character to make output always have UNIX newlines. } - else if((c >= 0x20 && c < 0x7F) || c == '\t' || c == '\f' || + else if((c >= 0x20 && c < 0x7F) || c == '\t' || extra[c] || (c == '\n' && newline_consume)) { // This is an ASCII character that may be part of a string. diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 165dbc2cc..7dbbf6da0 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -736,7 +736,7 @@ bool cmFindPackageCommand::HandlePackageMode() } // Try to load the config file if the directory is known - bool cachedDirectoryOk = false; + bool fileFound = false; if(!cmSystemTools::IsOff(def)) { // Get the directory from the variable value. @@ -754,25 +754,30 @@ bool cmFindPackageCommand::HandlePackageMode() if (this->FindConfigFile(dir, file)) { this->FileFound = file; - cachedDirectoryOk = true; + fileFound = true; } def = this->Makefile->GetDefinition(this->Variable.c_str()); } // Search for the config file if it is not already found. - if(cmSystemTools::IsOff(def) || !cachedDirectoryOk) + if(cmSystemTools::IsOff(def) || !fileFound) { - this->FindConfig(); + fileFound = this->FindConfig(); def = this->Makefile->GetDefinition(this->Variable.c_str()); } + // Sanity check. + if(fileFound && this->FileFound.empty()) + { + this->Makefile->IssueMessage( + cmake::INTERNAL_ERROR, "fileFound is true but FileFound is empty!"); + fileFound = false; + } + // If the directory for the config file was found, try to read the file. bool result = true; bool found = false; - // in the following test FileFound should never be empty if def is valid - // but I don't want to put an assert() in there now, in case this still - // makes it into 2.6.3 - if(!cmSystemTools::IsOff(def) && (!this->FileFound.empty())) + if(fileFound) { // Set the version variables before loading the config file. // It may override them. @@ -886,7 +891,7 @@ bool cmFindPackageCommand::HandlePackageMode() } //---------------------------------------------------------------------------- -void cmFindPackageCommand::FindConfig() +bool cmFindPackageCommand::FindConfig() { // Compute the set of search prefixes. this->ComputePrefixes(); @@ -938,9 +943,11 @@ void cmFindPackageCommand::FindConfig() "The directory containing a CMake configuration file for "; help += this->Name; help += "."; + // We force the value since we do not get here if it was already set. this->Makefile->AddCacheDefinition(this->Variable.c_str(), init.c_str(), help.c_str(), - cmCacheManager::PATH); + cmCacheManager::PATH, true); + return found; } //---------------------------------------------------------------------------- diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 139ca9bff..63f411161 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -73,7 +73,7 @@ private: void AddFindDefinition(const char* var, const char* val); void RestoreFindDefinitions(); bool HandlePackageMode(); - void FindConfig(); + bool FindConfig(); bool FindPrefixedConfig(); bool FindFrameworkConfig(); bool FindAppBundleConfig(); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 25e760237..4734c5097 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1953,6 +1953,11 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) { cmTarget* target = &l->second; + if(this->IsRootOnlyTarget(target) && + target->GetMakefile() != root->GetMakefile()) + { + continue; + } // put the target in the set of original targets originalTargets.insert(target); // Get the set of targets that depend on target @@ -1961,6 +1966,13 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, } } +//---------------------------------------------------------------------------- +bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) +{ + return (target->GetType() == cmTarget::GLOBAL_TARGET || + strcmp(target->GetName(), this->GetAllTargetName()) == 0); +} + //---------------------------------------------------------------------------- void cmGlobalGenerator::AddTargetDepends(cmTarget* target, TargetDependSet& projectTargets) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5a01bd29f..c9d07906b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -265,6 +265,7 @@ protected: virtual void GetTargetSets(TargetDependSet& projectTargets, TargetDependSet& originalTargets, cmLocalGenerator* root, GeneratorVector const&); + virtual bool IsRootOnlyTarget(cmTarget* target); void AddTargetDepends(cmTarget* target, TargetDependSet& projectTargets); void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 9a7c74486..783db2194 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -213,27 +213,10 @@ void cmGlobalVisualStudio6Generator } else { - bool skip = false; - // if it is a global target or the check build system target - // or the all_build target - // then only use the one that is for the root - if(target->GetType() == cmTarget::GLOBAL_TARGET - || !strcmp(target->GetName(), this->GetAllTargetName())) - { - if(target->GetMakefile() != root->GetMakefile()) - { - skip = true; - } - } - // if not skipping the project then write it into the - // solution - if(!skip) - { - std::string dspname = GetVS6TargetName(target->GetName()); - std::string dir = target->GetMakefile()->GetStartOutputDirectory(); - dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); - this->WriteProject(fout, dspname.c_str(), dir.c_str(), *target); - } + std::string dspname = GetVS6TargetName(target->GetName()); + std::string dir = target->GetMakefile()->GetStartOutputDirectory(); + dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); + this->WriteProject(fout, dspname.c_str(), dir.c_str(), *target); } } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index f2f3e988b..dbe9aed11 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -289,34 +289,16 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( } else { - bool skip = false; - // if it is a global target or the check build system target - // or the all_build target - // then only use the one that is for the root - if(target->GetType() == cmTarget::GLOBAL_TARGET - || !strcmp(target->GetName(), CMAKE_CHECK_BUILD_SYSTEM_TARGET) - || !strcmp(target->GetName(), this->GetAllTargetName())) + const char *vcprojName = + target->GetProperty("GENERATOR_FILE_NAME"); + if(vcprojName) { - if(target->GetMakefile() != root->GetMakefile()) - { - skip = true; - } - } - // if not skipping the project then write it into the - // solution - if(!skip) - { - const char *vcprojName = - target->GetProperty("GENERATOR_FILE_NAME"); - if(vcprojName) - { - cmMakefile* tmf = target->GetMakefile(); - std::string dir = tmf->GetStartOutputDirectory(); - dir = root->Convert(dir.c_str(), - cmLocalGenerator::START_OUTPUT); - this->WriteProject(fout, vcprojName, dir.c_str(), - *target); - } + cmMakefile* tmf = target->GetMakefile(); + std::string dir = tmf->GetStartOutputDirectory(); + dir = root->Convert(dir.c_str(), + cmLocalGenerator::START_OUTPUT); + this->WriteProject(fout, vcprojName, dir.c_str(), + *target); } } } @@ -633,6 +615,13 @@ cmGlobalVisualStudio7Generator } } +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio7Generator::IsRootOnlyTarget(cmTarget* target) +{ + return (this->cmGlobalVisualStudioGenerator::IsRootOnlyTarget(target) || + strcmp(target->GetName(), CMAKE_CHECK_BUILD_SYSTEM_TARGET) == 0); +} + bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, cmTarget* target) { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 363489ef9..73302bcc3 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -133,6 +133,7 @@ protected: std::string ConvertToSolutionPath(const char* path); + virtual bool IsRootOnlyTarget(cmTarget* target); bool IsPartOfDefaultBuild(const char* project, cmTarget* target); std::vector Configurations; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f217a35c6..d2c75b2d6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2646,18 +2646,18 @@ void cmGlobalXCodeGenerator { osxArch = "$(ARCHS_STANDARD_32_64_BIT)"; } - else if(this->XcodeVersion <= 25) + else if(this->XcodeVersion == 31) + { + osxArch = "$(ARCHS_STANDARD_32_BIT)"; + } + else if(this->XcodeVersion <= 30) { -#ifdef __i386 - osxArch = "i386"; -#endif #ifdef __ppc__ osxArch = "ppc"; #endif - } - else - { - osxArch = "$(ARCHS_STANDARD_32_BIT)"; +#ifdef __i386 + osxArch = "i386"; +#endif } buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 297053158..2ff794573 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -172,7 +172,10 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( return Binary; } - fgets(buf, 1024, inFile); + if(!fgets(buf, 1024, inFile)) + { + buf[0] = 0; + } fclose(inFile); FileType type = Binary; unsigned int minLineLength = 0; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 81be2126d..b51fabbd8 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -269,10 +269,9 @@ namespace if (cmSystemTools::IsOff(def)) { cmPolicies* policies = makefile->GetPolicies(); - errorString = "You have used a variable or argument named \"" + errorString = "A variable or argument named \"" + newArg - + "\" in a conditional statement. Please be aware of issues " - + "related to policy CMP0012. " + + "\" appears in a conditional statement. " + policies->GetPolicyWarning(cmPolicies::CMP0012); status = cmake::AUTHOR_WARNING; } @@ -285,10 +284,9 @@ namespace if (!cmSystemTools::IsOff(def)) { cmPolicies* policies = makefile->GetPolicies(); - errorString = "You have used a variable or argument named \"" + errorString = "A variable or argument named \"" + newArg - + "\" in a conditional statement. Please be aware of issues " - + "related to policy CMP0012. " + + "\" appears in a conditional statement. " + policies->GetPolicyWarning(cmPolicies::CMP0012); status = cmake::AUTHOR_WARNING; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ee5595753..c4ee5c793 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1951,15 +1951,6 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, flagsVar += "_FLAGS"; this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); } - - // Add flags specific to shared builds. - if(cmSystemTools::IsOn(this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) - { - flagsVar = "CMAKE_SHARED_BUILD_"; - flagsVar += lang; - flagsVar += "_FLAGS"; - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); - } } //---------------------------------------------------------------------------- @@ -2082,6 +2073,26 @@ void cmLocalGenerator::AppendDefines(std::string& defines, } } +//---------------------------------------------------------------------------- +void cmLocalGenerator::AppendFeatureOptions( + std::string& flags, const char* lang, const char* feature) +{ + std::string optVar = "CMAKE_"; + optVar += lang; + optVar += "_COMPILE_OPTIONS_"; + optVar += feature; + if(const char* optionList = this->Makefile->GetDefinition(optVar.c_str())) + { + std::vector options; + cmSystemTools::ExpandListArgument(optionList, options); + for(std::vector::const_iterator oi = options.begin(); + oi != options.end(); ++oi) + { + this->AppendFlags(flags, this->EscapeForShell(oi->c_str()).c_str()); + } + } +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConstructComment(const cmCustomCommand& cc, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 840e5d31f..d2082e422 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -149,6 +149,10 @@ public: void AppendDefines(std::string& defines, const char* defines_list, const char* lang); + /** Lookup and append options associated with a particular feature. */ + void AppendFeatureOptions(std::string& flags, const char* lang, + const char* feature); + /** Translate a dependency as given in CMake code to the name to appear in a generated build file. If the given name is that of a CMake target it will be transformed to the real output diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7aa1202bc..88c8c7b6f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -810,7 +810,7 @@ void cmMakefile::ConfigureFinalPass() for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end(); l++) { - l->second.AnalyzeLibDependencies(*this); + l->second.FinishConfigure(); } } @@ -1642,57 +1642,6 @@ void cmMakefile::AddDefinition(const char* name, const char* value) #endif } -//---------------------------------------------------------------------------- -void cmMakefile::UseCacheDefinition(cmCacheManager::CacheIterator const& it) -{ - // Check for a local definition that might hide the cache value. - const char* name = it.GetName(); - const char* def = this->Internal->VarStack.top().Get(name); - if(!def) - { - return; - } - - // If the visible value will change then check policy CMP0015. - const char* cache = it.GetValue(); - if(strcmp(def, cache) != 0) - { - cmOStringStream e; - switch (this->GetPolicyStatus(cmPolicies::CMP0015)) - { - case cmPolicies::WARN: - e << "Local variable \"" << name << "\" is set to\n" - << " " << def << "\n" - << "but the CACHE entry of the same name is set to\n" - << " " << cache << "\n" - << "The local variable is hiding the cache value." - << "\n" - << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0015); - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); - case cmPolicies::OLD: - // OLD behavior is to leave local definition. - return; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - e << "Local variable \"" << name << "\" is set to\n" - << " " << def << "\n" - << "but the CACHE entry of the same name is set to\n" - << " " << cache << "\n" - << "This command is removing the local variable to expose " - << "the cache value." - << "\n" - << this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0015); - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - case cmPolicies::NEW: - // NEW behavior is to remove local definition (done below). - break; - } - } - - // Remove the local definition to make the cache value visible. - this->RemoveDefinition(name); -} - void cmMakefile::AddCacheDefinition(const char* name, const char* value, const char* doc, @@ -1719,7 +1668,10 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value, cmSystemTools::ExpandListArgument(val, files); for ( cc = 0; cc < files.size(); cc ++ ) { - files[cc] = cmSystemTools::CollapseFullPath(files[cc].c_str()); + if(!cmSystemTools::IsOff(files[cc].c_str())) + { + files[cc] = cmSystemTools::CollapseFullPath(files[cc].c_str()); + } if ( cc > 0 ) { nvalue += ";"; @@ -3311,6 +3263,31 @@ bool cmMakefile::GetPropertyAsBool(const char* prop) return cmSystemTools::IsOn(this->GetProperty(prop)); } +//---------------------------------------------------------------------------- +const char* cmMakefile::GetFeature(const char* feature, const char* config) +{ + // TODO: Define accumulation policy for features (prepend, append, replace). + // Currently we always replace. + if(config && *config) + { + std::string featureConfig = feature; + featureConfig += "_"; + featureConfig += cmSystemTools::UpperCase(config); + if(const char* value = this->GetProperty(featureConfig.c_str())) + { + return value; + } + } + if(const char* value = this->GetProperty(feature)) + { + return value; + } + if(cmLocalGenerator* parent = this->LocalGenerator->GetParent()) + { + return parent->GetMakefile()->GetFeature(feature, config); + } + return 0; +} cmTarget* cmMakefile::FindTarget(const char* name) { @@ -3529,6 +3506,19 @@ void cmMakefile::DefineProperties(cmake *cm) "during dependency scanning to match include files that should " "be followed. See the include_regular_expression command.", false); + cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION", cmProperty::DIRECTORY, + "Enable interprocedural optimization for targets in a directory.", + "If set to true, enables interprocedural optimizations " + "if they are known to be supported by the compiler."); + + cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION_", cmProperty::DIRECTORY, + "Per-configuration interprocedural optimization for a directory.", + "This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. " + "If set, this property overrides the generic property " + "for the named configuration."); + cm->DefineProperty ("VARIABLES", cmProperty::DIRECTORY, "List of variables defined in the current directory.", diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 485d9e24d..63f81b827 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -285,11 +285,6 @@ public: cmCacheManager::CacheEntryType type, bool force = false); - /** - * Update the variable scope to make the cache definition visible. - */ - void UseCacheDefinition(cmCacheManager::CacheIterator const& it); - /** * Add bool variable definition to the build. */ @@ -793,6 +788,8 @@ public: const char *GetProperty(const char *prop, cmProperty::ScopeType scope); bool GetPropertyAsBool(const char *prop); + const char* GetFeature(const char* feature, const char* config); + // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index c7213a66c..a20c91721 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -199,11 +199,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string flags; std::string linkFlags; - // Add flags to deal with shared libraries. Any library being - // linked in might be shared, so always use shared flags for an - // executable. - this->LocalGenerator->AddSharedFlags(linkFlags, linkLanguage, true); - // Add flags to create an executable. this->LocalGenerator-> AddConfigVariableFlags(linkFlags, "CMAKE_EXE_LINKER_FLAGS", @@ -231,9 +226,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) (linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str())); } - // Add language-specific flags. - this->LocalGenerator - ->AddLanguageFlags(flags, linkLanguage, this->ConfigName); + // Add language feature flags. + this->AddFeatureFlags(flags, linkLanguage); // Add target-specific linker flags. this->LocalGenerator->AppendFlags diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 9162b4c52..4070a3bfc 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -113,6 +113,12 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() } linkRuleVar += "_CREATE_STATIC_LIBRARY"; + if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && + this->Makefile->GetDefinition((linkRuleVar+"_IPO").c_str())) + { + linkRuleVar += "_IPO"; + } + std::string extraFlags; this->LocalGenerator->AppendFlags (extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS")); @@ -671,9 +677,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.TargetInstallNameDir = install_name_dir.c_str(); } } + + // Add language feature flags. std::string langFlags; - this->LocalGenerator - ->AddLanguageFlags(langFlags, linkLanguage, this->ConfigName); + this->AddFeatureFlags(langFlags, linkLanguage); + // remove any language flags that might not work with the // particular os if(forbiddenFlagVar) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index edfae8720..c4f1d322a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -291,10 +291,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty(defPropName.c_str()), lang); - // Add language-specific flags. - this->LocalGenerator - ->AddLanguageFlags(flags, lang, - this->LocalGenerator->ConfigurationName.c_str()); + // Add language feature flags. + this->AddFeatureFlags(flags, lang); // Fortran-specific flags computed for this target. if(*l == "Fortran") @@ -578,9 +576,6 @@ cmMakefileTargetGenerator sourceFile = this->Convert(sourceFile.c_str(), cmLocalGenerator::NONE, cmLocalGenerator::SHELL); - std::string objectFile = this->Convert(obj.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); // Construct the build message. std::vector no_commands; @@ -1762,3 +1757,29 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) this->ModuleDefinitionFile.c_str())); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } + +//---------------------------------------------------------------------------- +const char* cmMakefileTargetGenerator::GetFeature(const char* feature) +{ + return this->Target->GetFeature(feature, this->ConfigName); +} + +//---------------------------------------------------------------------------- +bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature) +{ + return cmSystemTools::IsOn(this->GetFeature(feature)); +} + +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::AddFeatureFlags( + std::string& flags, const char* lang + ) +{ + // Add language-specific flags. + this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); + + if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) + { + this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); + } +} diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 6878e0643..4ee2b39b6 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -220,6 +220,13 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); + // Add language feature flags. + void AddFeatureFlags(std::string& flags, const char* lang); + + // Feature query methods. + const char* GetFeature(const char* feature); + bool GetFeatureAsBool(const char* feature); + //================================================================== // Convenience routines that do nothing more than forward to // implementaitons diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index c3ec2660a..af9d94bcf 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -53,7 +53,6 @@ bool cmOptionCommand if ( it.GetType() != cmCacheManager::UNINITIALIZED ) { it.SetProperty("HELPSTRING", args[1].c_str()); - this->Makefile->UseCacheDefinition(it); return true; } if ( it.GetValue() ) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index ffba3cb1b..0d35b6567 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -359,17 +359,19 @@ cmPolicies::cmPolicies() this->DefinePolicy( CMP0012, "CMP0012", "The if() command can recognize named boolean constants.", - "In CMake versions prior to 2.6.5 the only boolean constants were 0 " + "In CMake versions 2.6.4 and lower the only boolean constants were 0 " "and 1. Other boolean constants such as true, false, yes, no, " "on, off, y, n, notfound, ignore (all case insensitive) were recognized " - "in some cases but not all. In later versions of cmake these values are " + "in some cases but not all. " + "For example, the code \"if(TRUE)\" might have evaluated as false. " + "In later versions of cmake these values are " "treated as boolean constants more consistently and should not be used " "as variable names. " "The OLD behavior for this policy is to allow variables to have names " "such as true and to dereference them. " "The NEW behavior for this policy is to treat strings like true as a " "boolean constant.", - 2,6,5, cmPolicies::WARN); + 2,8,0, cmPolicies::WARN); this->DefinePolicy( CMP0013, "CMP0013", @@ -380,13 +382,13 @@ cmPolicies::cmPolicies() "overwritten in the build tree and could lead to strange behavior. " "CMake 2.6.4 and above explicitly detect duplicate binary directories. " "CMake 2.6.4 always considers this case an error. " - "In CMake 2.6.5 and above this policy determines whether or not " + "In CMake 2.8.0 and above this policy determines whether or not " "the case is an error. " "The OLD behavior for this policy is to allow duplicate binary " "directories. " "The NEW behavior for this policy is to disallow duplicate binary " "directories with an error.", - 2,6,5, cmPolicies::WARN); + 2,8,0, cmPolicies::WARN); this->DefinePolicy( CMP0014, "CMP0014", @@ -399,37 +401,6 @@ cmPolicies::cmPolicies() "The OLD behavior for this policy is to silently ignore the problem. " "The NEW behavior for this policy is to report an error.", 2,8,0, cmPolicies::WARN); - - this->DefinePolicy( - CMP0015, "CMP0015", - "The set() CACHE mode and option() command make the cache value visible.", - "In CMake 2.6 and below the CACHE mode of the set() command and the " - "option() command did not expose the value from the named cache entry " - "if it was already set both in the cache and as a local variable. " - "This led to subtle differences between first and later configurations " - "because a conflicting local variable would be overridden only when the " - "cache value was first created. " - "For example, the code\n" - " set(x 1)\n" - " set(before ${x})\n" - " set(x 2 CACHE STRING \"X\")\n" - " set(after ${x})\n" - " message(STATUS \"${before},${after}\")\n" - "would print \"1,2\" on the first run and \"1,1\" on future runs." - "\n" - "CMake 2.8.0 and above prefer to expose the cache value in all cases by " - "removing the local variable definition, but this changes behavior in " - "subtle cases when the local variable has a different value than that " - "exposed from the cache. " - "The example above will always print \"1,2\"." - "\n" - "This policy determines whether the commands should always expose the " - "cache value. " - "The OLD behavior for this policy is to leave conflicting local " - "variable values untouched and hide the true cache value. " - "The NEW behavior for this policy is to always expose the cache value.", - 2,8,0, cmPolicies::WARN); - } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index be3b44a2d..cf808bd4c 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -50,7 +50,6 @@ public: CMP0012, // Strong handling of boolean constants CMP0013, // Duplicate binary directories not allowed CMP0014, // Input directories must have CMakeLists.txt - CMP0015, // set(CACHE) and option() make CACHE value visible // Always the last entry. Useful mostly to avoid adding a comma // the last policy when adding a new one. diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 20246d734..86ecebe64 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -53,7 +53,7 @@ static void cmScriptGeneratorEncodeConfig(const char* config, if(*c >= 'a' && *c <= 'z') { result += "["; - result += *c + ('A' - 'a'); + result += static_cast(*c + 'A' - 'a'); result += *c; result += "]"; } @@ -61,7 +61,7 @@ static void cmScriptGeneratorEncodeConfig(const char* config, { result += "["; result += *c; - result += *c + ('a' - 'A'); + result += static_cast(*c + 'a' - 'A'); result += "]"; } else diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 7ff6869c9..5fcbdba0a 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -155,7 +155,6 @@ bool cmSetCommand // or the makefile if(cache && type != cmCacheManager::INTERNAL && !force) { - this->Makefile->UseCacheDefinition(it); return true; } } diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 609106ca4..2990d241a 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -64,10 +64,8 @@ public: " set( \n" " [[CACHE [FORCE]] | PARENT_SCOPE])\n" "Within CMake sets to the value . is expanded" - " before is set to it. If CACHE is present and " - "is not yet in the cache, then is put in the cache. If it is " - "already in the cache, is assigned the value stored in the " - "cache. If CACHE is present, also and are " + " before is set to it. If CACHE is present, then the " + " is put in the cache. and are then " "required. is used by the CMake GUI to choose a widget with " "which the user sets a value. The value for may be one of\n" " FILEPATH = File chooser dialog.\n" diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 134f9eabf..2313853bd 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -381,7 +381,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) { std::string e = "sub-command REGEX, mode REPLACE: Unknown escape \""; e += replace.substr(r, 2); - e += "\"in replace-expression."; + e += "\" in replace-expression."; this->SetError(e.c_str()); return false; } @@ -559,7 +559,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector const& { if(args.size() < 5) { - this->SetError("sub-command REPLACE requires four arguments."); + this->SetError("sub-command REPLACE requires at least four arguments."); return false; } @@ -586,7 +586,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector const& { if(args.size() != 5) { - this->SetError("sub-command REPLACE requires four arguments."); + this->SetError("sub-command SUBSTRING requires four arguments."); return false; } @@ -647,7 +647,7 @@ bool cmStringCommand::HandleStripCommand( { if(args.size() != 3) { - this->SetError("sub-command LENGTH requires two arguments."); + this->SetError("sub-command STRIP requires two arguments."); return false; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index bf829810a..219c1efce 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -338,7 +338,7 @@ bool cmSystemTools::IsOn(const char* val) for(std::basic_string::iterator c = v.begin(); c != v.end(); c++) { - *c = toupper(*c); + *c = static_cast(toupper(*c)); } return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y"); } @@ -371,7 +371,7 @@ bool cmSystemTools::IsOff(const char* val) for(std::basic_string::iterator c = v.begin(); c != v.end(); c++) { - *c = toupper(*c); + *c = static_cast(toupper(*c)); } return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" || v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE"); @@ -915,7 +915,10 @@ bool RunCommandViaPopen(const char* command, #endif return false; } - fgets(buffer, BUFFER_SIZE, cpipe); + if (!fgets(buffer, BUFFER_SIZE, cpipe)) + { + buffer[0] = 0; + } while(!feof(cpipe)) { if(verbose) @@ -923,8 +926,10 @@ bool RunCommandViaPopen(const char* command, cmSystemTools::Stdout(buffer); } output += buffer; - buffer[0] = 0; - fgets(buffer, BUFFER_SIZE, cpipe); + if(!fgets(buffer, BUFFER_SIZE, cpipe)) + { + buffer[0] = 0; + } } retVal = pclose(cpipe); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8510b5925..ccac68a56 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -55,6 +55,13 @@ public: { this->SourceFileFlagsConstructed = false; } + cmTargetInternals(cmTargetInternals const& r) + { + this->SourceFileFlagsConstructed = false; + // Only some of these entries are part of the object state. + // Others not copied here are result caches. + this->SourceEntries = r.SourceEntries; + } typedef cmTarget::SourceFileFlags SourceFileFlags; std::map SourceFlagsMap; bool SourceFileFlagsConstructed; @@ -420,6 +427,19 @@ void cmTarget::DefineProperties(cmake *cm) "CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a target is " "created."); + cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION", cmProperty::TARGET, + "Enable interprocedural optimization for a target.", + "If set to true, enables interprocedural optimizations " + "if they are known to be supported by the compiler."); + + cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION_", cmProperty::TARGET, + "Per-configuration interprocedural optimization for a target.", + "This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. " + "If set, this property overrides the generic property " + "for the named configuration."); + cm->DefineProperty ("LABELS", cmProperty::TARGET, "Specify a list of text labels associated with a target.", @@ -1014,6 +1034,27 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->Makefile->GetPolicyStatus(cmPolicies::CMP0008); } +//---------------------------------------------------------------------------- +void cmTarget::FinishConfigure() +{ + // Erase any cached link information that might have been comptued + // on-demand during the configuration. This ensures that build + // system generation uses up-to-date information even if other cache + // invalidation code in this source file is buggy. + this->ClearLinkMaps(); + + // Do old-style link dependency analysis. + this->AnalyzeLibDependencies(*this->Makefile); +} + +//---------------------------------------------------------------------------- +void cmTarget::ClearLinkMaps() +{ + this->Internal->LinkImplMap.clear(); + this->Internal->LinkInterfaceMap.clear(); + this->Internal->LinkClosureMap.clear(); +} + //---------------------------------------------------------------------------- cmListFileBacktrace const& cmTarget::GetBacktrace() const { @@ -1592,18 +1633,6 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, } } -//---------------------------------------------------------------------------- -void cmTarget::AddLinkLibrary(const std::string& lib, - LinkLibraryType llt) -{ - this->AddFramework(lib.c_str(), llt); - cmTarget::LibraryID tmp; - tmp.first = lib; - tmp.second = llt; - this->LinkLibraries.push_back(tmp); - this->OriginalLinkLibraries.push_back(tmp); -} - //---------------------------------------------------------------------------- bool cmTarget::NameResolvesToFramework(const std::string& libname) { @@ -1648,6 +1677,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, tmp.second = llt; this->LinkLibraries.push_back( tmp ); this->OriginalLinkLibraries.push_back(tmp); + this->ClearLinkMaps(); // Add the explicit dependency information for this target. This is // simply a set of libraries separated by ";". There should always @@ -1993,13 +2023,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) } this->Properties.SetProperty(prop, value, cmProperty::TARGET); - - // If imported information is being set, wipe out cached - // information. - if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0) - { - this->Internal->ImportInfoMap.clear(); - } + this->MaybeInvalidatePropertyCache(prop); } //---------------------------------------------------------------------------- @@ -2010,13 +2034,21 @@ void cmTarget::AppendProperty(const char* prop, const char* value) return; } this->Properties.AppendProperty(prop, value, cmProperty::TARGET); + this->MaybeInvalidatePropertyCache(prop); +} - // If imported information is being set, wipe out cached - // information. +//---------------------------------------------------------------------------- +void cmTarget::MaybeInvalidatePropertyCache(const char* prop) +{ + // Wipe wipe out maps caching information affected by this property. if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0) { this->Internal->ImportInfoMap.clear(); } + if(!this->IsImported() && strncmp(prop, "LINK_INTERFACE_", 15) == 0) + { + this->ClearLinkMaps(); + } } //---------------------------------------------------------------------------- @@ -2244,6 +2276,26 @@ void cmTarget::GetTargetVersion(bool soversion, } } +//---------------------------------------------------------------------------- +const char* cmTarget::GetFeature(const char* feature, const char* config) +{ + if(config && *config) + { + std::string featureConfig = feature; + featureConfig += "_"; + featureConfig += cmSystemTools::UpperCase(config); + if(const char* value = this->GetProperty(featureConfig.c_str())) + { + return value; + } + } + if(const char* value = this->GetProperty(feature)) + { + return value; + } + return this->Makefile->GetFeature(feature, config); +} + //---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const char* prop) { @@ -4309,12 +4361,12 @@ cmTargetInternalPointer::cmTargetInternalPointer() //---------------------------------------------------------------------------- cmTargetInternalPointer -::cmTargetInternalPointer(cmTargetInternalPointer const&) +::cmTargetInternalPointer(cmTargetInternalPointer const& r) { // Ideally cmTarget instances should never be copied. However until // we can make a sweep to remove that, this copy constructor avoids // allowing the resources (Internals) to be copied. - this->Pointer = new cmTargetInternals; + this->Pointer = new cmTargetInternals(*r.Pointer); } //---------------------------------------------------------------------------- @@ -4332,7 +4384,7 @@ cmTargetInternalPointer::operator=(cmTargetInternalPointer const& r) // we can make a sweep to remove that, this copy constructor avoids // allowing the resources (Internals) to be copied. cmTargetInternals* oldPointer = this->Pointer; - this->Pointer = new cmTargetInternals; + this->Pointer = new cmTargetInternals(*r.Pointer); delete oldPointer; return *this; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e0e258d99..66e3f3df0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -183,9 +183,6 @@ public: const char *target, const char* lib, LinkLibraryType llt); - void AddLinkLibrary(const std::string& lib, - LinkLibraryType llt); - void MergeLinkLibraries( cmMakefile& mf, const char* selfname, const LinkLibraryVectorType& libs ); @@ -222,7 +219,8 @@ public: ///! Get the utilities used by this target std::setconst& GetUtilities() const { return this->Utilities; } - void AnalyzeLibDependencies( const cmMakefile& mf ); + /** Finalize the target at the end of the Configure step. */ + void FinishConfigure(); ///! Set/Get a property of this target file void SetProperty(const char *prop, const char *value); @@ -232,6 +230,8 @@ public: bool GetPropertyAsBool(const char *prop); void CheckProperty(const char* prop, cmMakefile* context); + const char* GetFeature(const char* feature, const char* config); + bool IsImported() const {return this->IsImportedTarget;} /** The link interface specifies transitive library dependencies and @@ -490,6 +490,8 @@ private: const LibraryID& lib, DependencyMap& dep_map); + void AnalyzeLibDependencies( const cmMakefile& mf ); + const char* GetSuffixVariableInternal(bool implib); const char* GetPrefixVariableInternal(bool implib); std::string GetFullNameInternal(const char* config, bool implib); @@ -565,6 +567,10 @@ private: LinkImplementation& impl); void ComputeLinkClosure(const char* config, LinkClosure& lc); + void ClearLinkMaps(); + + void MaybeInvalidatePropertyCache(const char* prop); + // The cmMakefile instance that owns this target. This should // always be set. cmMakefile* Makefile; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cdee8d272..48a0e8300 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1276,7 +1276,10 @@ int cmake::ExecuteCMakeCommand(std::vector& args) int count; if (countFile) { - fscanf(countFile,"%i",&count); + if (1!=fscanf(countFile,"%i",&count)) + { + cmSystemTools::Message("Could not read from count file."); + } fclose(countFile); } else @@ -1318,7 +1321,10 @@ int cmake::ExecuteCMakeCommand(std::vector& args) } else { - fscanf(progFile,"%i",&count); + if (1!=fscanf(progFile,"%i",&count)) + { + cmSystemTools::Message("Could not read from progress file."); + } fclose(progFile); } unsigned int i; @@ -1469,7 +1475,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) std::string homeOutDir; std::string startOutDir; std::string depInfo; - bool color = true; + bool color = false; if(args.size() >= 8) { // Full signature: @@ -1487,11 +1493,12 @@ int cmake::ExecuteCMakeCommand(std::vector& args) startOutDir = args[6]; depInfo = args[7]; if(args.size() >= 9 && - args[8].length() > 8 && + args[8].length() >= 8 && args[8].substr(0, 8) == "--color=") { // Enable or disable color based on the switch value. - color = cmSystemTools::IsOn(args[8].substr(8).c_str()); + color = (args[8].size() == 8 || + cmSystemTools::IsOn(args[8].substr(8).c_str())); } } else diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx index 4173413e5..cd427cb40 100644 --- a/Source/cmakewizard.cxx +++ b/Source/cmakewizard.cxx @@ -28,8 +28,10 @@ void cmakewizard::AskUser(const char* key, printf("Current Value: %s\n", iter.GetValue()); printf("New Value (Enter to keep current value): "); char buffer[4096]; - buffer[0] = 0; - fgets(buffer, sizeof(buffer)-1, stdin); + if(!fgets(buffer, sizeof(buffer)-1, stdin)) + { + buffer[0] = 0; + } if(strlen(buffer) > 0) { @@ -65,8 +67,10 @@ bool cmakewizard::AskAdvanced() { printf("Would you like to see advanced options? [No]:"); char buffer[4096]; - buffer[0] = 0; - fgets(buffer, sizeof(buffer)-1, stdin); + if(!fgets(buffer, sizeof(buffer)-1, stdin)) + { + buffer[0] = 0; + } if(buffer[0]) { if(buffer[0] == 'y' || buffer[0] == 'Y') diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 391a2c5da..23d396f71 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -242,6 +242,8 @@ protected: // For Mac bool ParseSysCtl(); + void CallSwVers(); + void TrimNewline(kwsys_stl::string&); kwsys_stl::string ExtractValueFromSysCtl(const char* word); kwsys_stl::string SysCtlBuffer; @@ -3006,13 +3008,13 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha if(buffer[i] == ' ' || buffer[i] == '\t') { break; - } + } if(buffer[i] != '\n' && buffer[i] != '\r') { kwsys_stl::string val = value; value = buffer[i]; value += val; - } + } } return value; } @@ -3356,6 +3358,12 @@ bool SystemInformationImplementation::QueryOSInformation() WSACleanup( ); } this->Hostname = name; + + const char* arch = getenv("PROCESSOR_ARCHITECTURE"); + if(arch) + { + this->OSPlatform = arch; + } #else @@ -3369,12 +3377,64 @@ bool SystemInformationImplementation::QueryOSInformation() this->OSVersion = unameInfo.version; this->OSPlatform = unameInfo.machine; } +#ifdef __APPLE__ + this->CallSwVers(); +#endif #endif return true; } +void SystemInformationImplementation::CallSwVers() +{ +#ifdef __APPLE__ + kwsys_stl::string output; + kwsys_stl::vector args; + args.clear(); + + args.push_back("sw_vers"); + args.push_back("-productName"); + args.push_back(0); + output = this->RunProcess(args); + this->TrimNewline(output); + this->OSName = output; + args.clear(); + + args.push_back("sw_vers"); + args.push_back("-productVersion"); + args.push_back(0); + output = this->RunProcess(args); + this->TrimNewline(output); + this->OSRelease = output; + args.clear(); + + args.push_back("sw_vers"); + args.push_back("-buildVersion"); + args.push_back(0); + output = this->RunProcess(args); + this->TrimNewline(output); + this->OSVersion = output; +#endif +} + +void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output) +{ + // remove \r + kwsys_stl::string::size_type pos=0; + while((pos = output.find("\r", pos)) != kwsys_stl::string::npos) + { + output.erase(pos); + } + + // remove \n + pos = 0; + while((pos = output.find("\n", pos)) != kwsys_stl::string::npos) + { + output.erase(pos); + } +} + /** Return true if the machine is 64 bits */ bool SystemInformationImplementation::Is64Bits() { diff --git a/Templates/cygwin-package.sh.in b/Templates/cygwin-package.sh.in index 989446c58..8482e7e4d 100755 --- a/Templates/cygwin-package.sh.in +++ b/Templates/cygwin-package.sh.in @@ -1,3 +1,5 @@ +#!/bin/sh + # this is a sample shell script used for building a cmake # based project for a cygwin setup package. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4fdd2865f..f21efd7ad 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -108,6 +108,7 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(PreOrder PreOrder) ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) + ADD_TEST_MACRO(IPO COnly/COnly) ADD_TEST_MACRO(NewlineArgs NewlineArgs) ADD_TEST_MACRO(SetLang SetLang) ADD_TEST_MACRO(ExternalOBJ ExternalOBJ) @@ -485,6 +486,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel SET(COMPILER_IS_COMO 1) ENDIF(CMAKE_BASE_NAME MATCHES "^como$") IF(NOT COMPILER_IS_COMO) + SET(COMPLEX_TEST_CMAKELIB 1) + IF(CMAKE_TEST_DIFFERENT_GENERATOR OR CMAKE_TEST_SYSTEM_LIBRARIES) + SET(COMPLEX_TEST_CMAKELIB 0) + ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR OR CMAKE_TEST_SYSTEM_LIBRARIES) + IF(BORLAND) + SET(COMPLEX_TEST_CMAKELIB 0) + ENDIF(BORLAND) ADD_TEST(complex ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Complex" @@ -496,8 +504,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" --build-options - -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR} - -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES} + -DCOMPLEX_TEST_CMAKELIB:BOOL=${COMPLEX_TEST_CMAKELIB} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --test-command complex ) @@ -512,8 +519,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" --build-options - -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR} - -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES} + -DCOMPLEX_TEST_CMAKELIB:BOOL=${COMPLEX_TEST_CMAKELIB} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --test-command complex) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") @@ -1311,6 +1317,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel ) ENDIF(NOT EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt") + ADD_TEST(CMakeWizardTest ${CMAKE_CMAKE_COMMAND} + -D build_dir:STRING=${CMAKE_CURRENT_BINARY_DIR}/CMakeWizardTest + -D source_dir:STRING=${CMAKE_CURRENT_SOURCE_DIR}/Tutorial/Step3 + -D CMAKE_CTEST_COMMAND:STRING=${CMAKE_CTEST_COMMAND} + -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeWizardTest.cmake) ENDIF(BUILD_TESTING) SUBDIRS(CMakeTests) diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 34ac12c44..456e2e9ae 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -22,6 +22,14 @@ AddCMakeTest(ConfigureFile "") AddCMakeTest(SeparateArguments "") AddCMakeTest(ImplicitLinkInfo "") AddCMakeTest(ModuleNotices "") +AddCMakeTest(String "") +AddCMakeTest(Math "") +AddCMakeTest(CMakeMinimumRequired "") + +SET(EndStuff_PreArgs + "-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest" + ) +AddCMakeTest(EndStuff "${EndStuff_PreArgs}") SET(GetPrerequisites_PreArgs "-DCTEST_CONFIGURATION_TYPE:STRING=\\\${CTEST_CONFIGURATION_TYPE}" diff --git a/Tests/CMakeTests/CMakeMinimumRequiredTest.cmake.in b/Tests/CMakeTests/CMakeMinimumRequiredTest.cmake.in new file mode 100644 index 000000000..b83a779bb --- /dev/null +++ b/Tests/CMakeTests/CMakeMinimumRequiredTest.cmake.in @@ -0,0 +1,18 @@ +# Execute each test listed in: +# +set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/CMakeMinimumRequiredTestScript.cmake") +set(number_of_tests_expected 8) + +include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") +execute_all_script_tests(${scriptname} number_of_tests_executed) + +# And verify that number_of_tests_executed is at least as many as we know +# about as of this writing... +# +message(STATUS "scriptname='${scriptname}'") +message(STATUS "number_of_tests_executed='${number_of_tests_executed}'") +message(STATUS "number_of_tests_expected='${number_of_tests_expected}'") + +if(number_of_tests_executed LESS number_of_tests_expected) + message(FATAL_ERROR "error: some test cases were skipped") +endif() diff --git a/Tests/CMakeTests/CMakeMinimumRequiredTestScript.cmake b/Tests/CMakeTests/CMakeMinimumRequiredTestScript.cmake new file mode 100644 index 000000000..d434d2901 --- /dev/null +++ b/Tests/CMakeTests/CMakeMinimumRequiredTestScript.cmake @@ -0,0 +1,31 @@ +message(STATUS "testname='${testname}'") + +if(testname STREQUAL empty) # pass + cmake_minimum_required() + +elseif(testname STREQUAL bogus) # fail + cmake_minimum_required(BOGUS) + +elseif(testname STREQUAL no_version) # fail + cmake_minimum_required(VERSION) + +elseif(testname STREQUAL no_version_before_fatal_error) # fail + cmake_minimum_required(VERSION FATAL_ERROR) + +elseif(testname STREQUAL bad_version) # fail + cmake_minimum_required(VERSION 2.blah.blah) + +elseif(testname STREQUAL worse_version) # fail + cmake_minimum_required(VERSION blah.blah.blah) + +elseif(testname STREQUAL future_version) # fail + math(EXPR major "${CMAKE_MAJOR_VERSION} + 1") + cmake_minimum_required(VERSION ${major}.2.1) + +elseif(testname STREQUAL unknown_arg) # fail + cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.0.0 SILLY) + +else() # fail + message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") + +endif() diff --git a/Tests/CMakeTests/EndStuffTest.cmake.in b/Tests/CMakeTests/EndStuffTest.cmake.in new file mode 100644 index 000000000..de5dd5073 --- /dev/null +++ b/Tests/CMakeTests/EndStuffTest.cmake.in @@ -0,0 +1,18 @@ +# Execute each test listed in: +# +set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/EndStuffTestScript.cmake") +set(number_of_tests_expected 9) + +include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") +execute_all_script_tests(${scriptname} number_of_tests_executed) + +# And verify that number_of_tests_executed is at least as many as we know +# about as of this writing... +# +message(STATUS "scriptname='${scriptname}'") +message(STATUS "number_of_tests_executed='${number_of_tests_executed}'") +message(STATUS "number_of_tests_expected='${number_of_tests_expected}'") + +if(number_of_tests_executed LESS number_of_tests_expected) + message(FATAL_ERROR "error: some test cases were skipped") +endif() diff --git a/Tests/CMakeTests/EndStuffTestScript.cmake b/Tests/CMakeTests/EndStuffTestScript.cmake new file mode 100644 index 000000000..9f4081801 --- /dev/null +++ b/Tests/CMakeTests/EndStuffTestScript.cmake @@ -0,0 +1,70 @@ +message(STATUS "testname='${testname}'") + +if(testname STREQUAL bad_else) # fail + file(WRITE "${dir}/${testname}.cmake" +"else() +") + execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" + RESULT_VARIABLE rv) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "${testname} failed") + endif() + +elseif(testname STREQUAL bad_elseif) # fail + file(WRITE "${dir}/${testname}.cmake" +"elseif() +") + execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" + RESULT_VARIABLE rv) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "${testname} failed") + endif() + +elseif(testname STREQUAL bad_endforeach) # fail + endforeach() + +elseif(testname STREQUAL bad_endfunction) # fail + endfunction() + +elseif(testname STREQUAL bad_endif) # fail + file(WRITE "${dir}/${testname}.cmake" +"cmake_minimum_required(VERSION 2.8) +endif() +") + execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" + RESULT_VARIABLE rv) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "${testname} failed") + endif() + +elseif(testname STREQUAL endif_low_min_version) # pass + file(WRITE "${dir}/${testname}.cmake" +"cmake_minimum_required(VERSION 1.2) +endif() +") + execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" + RESULT_VARIABLE rv) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "${testname} failed") + endif() + +elseif(testname STREQUAL endif_no_min_version) # pass + file(WRITE "${dir}/${testname}.cmake" +"endif() +") + execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" + RESULT_VARIABLE rv) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "${testname} failed") + endif() + +elseif(testname STREQUAL bad_endmacro) # fail + endmacro() + +elseif(testname STREQUAL bad_endwhile) # fail + endwhile() + +else() # fail + message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") + +endif() diff --git a/Tests/CMakeTests/ExecuteScriptTests.cmake b/Tests/CMakeTests/ExecuteScriptTests.cmake new file mode 100644 index 000000000..c71585a02 --- /dev/null +++ b/Tests/CMakeTests/ExecuteScriptTests.cmake @@ -0,0 +1,63 @@ +# This function calls the ${scriptname} file to execute one test case: +# +function(execute_one_script_test scriptname testname expected_result) + message("execute_one_script_test") + message("testname=[${testname}]") + + execute_process( + COMMAND ${CMAKE_COMMAND} + -D "dir:STRING=${dir}" + -D "testname:STRING=${testname}" + -P "${scriptname}" + OUTPUT_VARIABLE out + ERROR_VARIABLE err + RESULT_VARIABLE result + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + + message("out=[${out}]") + message("err=[${err}]") + + if(expected_result STREQUAL "fail") + # case expected to fail, result should be non-0... + # error if it's 0 + if("${result}" STREQUAL "0") + message(SEND_ERROR "script failed: testname='${testname}' [${result}] actually passed, but expected to fail...") + endif() + else() + # case expected to pass, result should be 0... + # error if it's non-0 + if(NOT "${result}" STREQUAL "0") + message(SEND_ERROR "script failed: testname='${testname}' [${result}] actually failed, but expected to pass...") + endif() + endif() + + message("") +endfunction() + + +# This function reads the script file and calls execute_one_script_test for +# each testname case listed in the script. To add new cases, simply edit the +# script file and add an elseif() clause that matches 'regex' below. +# +function(execute_all_script_tests scriptname result) + file(READ "${scriptname}" script) + + string(REPLACE ";" "\\\\;" script "${script}") + string(REPLACE "\n" "E;" script "${script}") + + set(count 0) + set(regex "^ *(if|elseif) *\\( *testname +STREQUAL +\\\"*([^\\\"\\)]+)\\\"* *\\) *# *(fail|pass) *E$") + + foreach(line ${script}) + if(line MATCHES "${regex}") + math(EXPR count "${count} + 1") + string(REGEX REPLACE "${regex}" "\\2" testname "${line}") + string(REGEX REPLACE "${regex}" "\\3" expected_result "${line}") + execute_one_script_test(${scriptname} ${testname} ${expected_result}) + endif() + endforeach() + + set(${result} ${count} PARENT_SCOPE) +endfunction() diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index a549135fa..8231990a1 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -77,6 +77,14 @@ set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;p set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2") list(APPEND platforms linux64_pgf90) +# gcc dummy.c -v # in strange path +set(linux64_test1_text " +/this/might/match/as/a/linker/ld/but/it/is/not because the ld is not the last path component +${linux64_gcc_text}") +set(linux64_test1_libs "${linux64_gcc_libs}") +set(linux64_test1_dirs "${linux64_gcc_dirs}") +list(APPEND platforms linux64_test1) + #----------------------------------------------------------------------------- # Sun @@ -339,7 +347,7 @@ list(APPEND platforms msys_g77) # Test parsing for all above examples. foreach(p IN LISTS platforms) - cmake_parse_implicit_link_info("${${p}_text}" libs dirs) + cmake_parse_implicit_link_info("${${p}_text}" libs dirs log) foreach(v libs dirs) if(NOT "${${v}}" STREQUAL "${${p}_${v}}") @@ -349,6 +357,8 @@ foreach(p IN LISTS platforms) " [${${p}_${v}}]\n" "but got\n" " [${${v}}]\n" + "Parse log was:\n" + "${log}" ) endif() endforeach() diff --git a/Tests/CMakeTests/MathTest.cmake.in b/Tests/CMakeTests/MathTest.cmake.in new file mode 100644 index 000000000..91cd9220a --- /dev/null +++ b/Tests/CMakeTests/MathTest.cmake.in @@ -0,0 +1,18 @@ +# Execute each test listed in: +# +set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/MathTestScript.cmake") +set(number_of_tests_expected 4) + +include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") +execute_all_script_tests(${scriptname} number_of_tests_executed) + +# And verify that number_of_tests_executed is at least as many as we know +# about as of this writing... +# +message(STATUS "scriptname='${scriptname}'") +message(STATUS "number_of_tests_executed='${number_of_tests_executed}'") +message(STATUS "number_of_tests_expected='${number_of_tests_expected}'") + +if(number_of_tests_executed LESS number_of_tests_expected) + message(FATAL_ERROR "error: some test cases were skipped") +endif() diff --git a/Tests/CMakeTests/MathTestScript.cmake b/Tests/CMakeTests/MathTestScript.cmake new file mode 100644 index 000000000..1b7f8a6f3 --- /dev/null +++ b/Tests/CMakeTests/MathTestScript.cmake @@ -0,0 +1,18 @@ +message(STATUS "testname='${testname}'") + +if(testname STREQUAL empty) # fail + math() + +elseif(testname STREQUAL bogus) # fail + math(BOGUS) + +elseif(testname STREQUAL not_enough_args) # fail + math(EXPR x) + +elseif(testname STREQUAL cannot_parse) # fail + math(EXPR x "1 + 2 +") + +else() # fail + message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") + +endif() diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in new file mode 100644 index 000000000..54fee7f4c --- /dev/null +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -0,0 +1,18 @@ +# Execute each test listed in StringTestScript.cmake: +# +set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake") +set(number_of_tests_expected 52) + +include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") +execute_all_script_tests(${scriptname} number_of_tests_executed) + +# And verify that number_of_tests_executed is at least as many as we know +# about as of this writing... +# +message(STATUS "scriptname='${scriptname}'") +message(STATUS "number_of_tests_executed='${number_of_tests_executed}'") +message(STATUS "number_of_tests_expected='${number_of_tests_expected}'") + +if(number_of_tests_executed LESS number_of_tests_expected) + message(FATAL_ERROR "error: some test cases were skipped") +endif() diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake new file mode 100644 index 000000000..652d81b9d --- /dev/null +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -0,0 +1,192 @@ +message(STATUS "testname='${testname}'") + +if(testname STREQUAL empty) # fail + string() + +elseif(testname STREQUAL bogus) # fail + string(BOGUS) + +elseif(testname STREQUAL random) # pass + string(RANDOM r) + message(STATUS "r='${r}'") + +elseif(testname STREQUAL toupper_no_variable) # fail + string(TOUPPER) + +elseif(testname STREQUAL ascii_no_variable) # fail + string(ASCII) + +elseif(testname STREQUAL ascii_code_too_small) # fail + string(ASCII -1 bummer) + +elseif(testname STREQUAL ascii_code_too_large) # fail + string(ASCII 288 bummer) + +elseif(testname STREQUAL configure_no_input) # fail + string(CONFIGURE) + +elseif(testname STREQUAL configure_no_variable) # fail + string(CONFIGURE "this is @testname@") + +elseif(testname STREQUAL configure_escape_quotes) # pass + string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL configure_bogus) # fail + string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES BOGUS) + +elseif(testname STREQUAL regex_no_mode) # fail + string(REGEX) + +elseif(testname STREQUAL regex_match_not_enough_args) # fail + string(REGEX MATCH) + +elseif(testname STREQUAL regex_matchall_not_enough_args) # fail + string(REGEX MATCHALL) + +elseif(testname STREQUAL regex_replace_not_enough_args) # fail + string(REGEX REPLACE) + +elseif(testname STREQUAL regex_bogus_mode) # fail + string(REGEX BOGUS) + +elseif(testname STREQUAL regex_match_multiple_inputs) # pass + string(REGEX MATCH ".*" v input1 input2 input3 input4) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL regex_match_bad_regex) # fail + string(REGEX MATCH "(.*" v input) + +elseif(testname STREQUAL regex_match_empty_string) # fail + string(REGEX MATCH "x*" v "") + +elseif(testname STREQUAL regex_match_no_match) # pass + string(REGEX MATCH "xyz" v "abc") + message(STATUS "v='${v}'") + +elseif(testname STREQUAL regex_matchall_multiple_inputs) # pass + string(REGEX MATCHALL "input" v input1 input2 input3 input4) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL regex_matchall_bad_regex) # fail + string(REGEX MATCHALL "(.*" v input) + +elseif(testname STREQUAL regex_matchall_empty_string) # fail + string(REGEX MATCHALL "x*" v "") + +elseif(testname STREQUAL regex_replace_ends_with_backslash) # fail + string(REGEX REPLACE "input" "output\\" v input1 input2 input3 input4) + +elseif(testname STREQUAL regex_replace_ends_with_escaped_backslash) # pass + string(REGEX REPLACE "input" "output\\\\" v input1 input2 input3 input4) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL regex_replace_has_linefeed) # pass + string(REGEX REPLACE "input" "output\\n" v input1 input2 input3 input4) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL regex_replace_has_bogus_escape) # fail + string(REGEX REPLACE "input" "output\\a" v input1 input2 input3 input4) + +elseif(testname STREQUAL regex_replace_bad_regex) # fail + string(REGEX REPLACE "this (.*" "with that" v input) + +elseif(testname STREQUAL regex_replace_empty_string) # fail + string(REGEX REPLACE "x*" "that" v "") + +elseif(testname STREQUAL regex_replace_index_too_small) # fail + string(REGEX REPLACE "^this (.*)$" "with \\1 \\-1" v "this input") + +elseif(testname STREQUAL regex_replace_index_too_large) # fail + string(REGEX REPLACE "^this (.*)$" "with \\1 \\2" v "this input") + +elseif(testname STREQUAL compare_no_mode) # fail + string(COMPARE) + +elseif(testname STREQUAL compare_bogus_mode) # fail + string(COMPARE BOGUS) + +elseif(testname STREQUAL compare_not_enough_args) # fail + string(COMPARE EQUAL) + +elseif(testname STREQUAL replace_not_enough_args) # fail + string(REPLACE) + +elseif(testname STREQUAL replace_multiple_inputs) # pass + string(REPLACE "input" "output" v input1 input2 input3 input4) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL substring_not_enough_args) # fail + string(SUBSTRING) + +elseif(testname STREQUAL substring_begin_too_large) # fail + string(SUBSTRING "abcdefg" 25 100 v) + +elseif(testname STREQUAL substring_end_too_large) # fail + string(SUBSTRING "abcdefg" 1 100 v) + +elseif(testname STREQUAL substring_begin_less_than_zero) # fail + string(SUBSTRING "abcdefg" -2 4 v) + +elseif(testname STREQUAL substring_end_less_than_begin) # fail + string(SUBSTRING "abcdefg" 6 3 v) + +elseif(testname STREQUAL length_not_enough_args) # fail + string(LENGTH) + +elseif(testname STREQUAL strip_not_enough_args) # fail + string(STRIP) + +elseif(testname STREQUAL random_not_enough_args) # fail + string(RANDOM) + +elseif(testname STREQUAL random_3_args) # fail + string(RANDOM LENGTH 9) + +elseif(testname STREQUAL random_5_args) # fail + string(RANDOM LENGTH 9 ALPHABET "aceimnorsuvwxz") + +elseif(testname STREQUAL random_with_length) # pass + string(RANDOM LENGTH 9 v) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL random_with_alphabet) # pass + string(RANDOM ALPHABET "aceimnorsuvwxz" v) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL random_bad_length) # fail + string(RANDOM LENGTH 0 v) + +elseif(testname STREQUAL random_empty_alphabet) # pass + string(RANDOM ALPHABET "" v) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL random_with_length_and_alphabet) # pass + string(RANDOM LENGTH 9 ALPHABET "aceimnorsuvwxz" v) + message(STATUS "v='${v}'") + +elseif(testname STREQUAL random_with_various_alphabets) # pass + # small alphabet + string(RANDOM LENGTH 32 ALPHABET "ACGT" v) + message(STATUS "v='${v}'") + + # smaller alphabet + string(RANDOM LENGTH 32 ALPHABET "AB" v) + message(STATUS "v='${v}'") + + # smallest alphabet + string(RANDOM LENGTH 32 ALPHABET "Z" v) + message(STATUS "v='${v}'") + + # smallest length and alphabet + string(RANDOM LENGTH 1 ALPHABET "Q" v) + message(STATUS "v='${v}'") + + # alphabet of many colors - use all the crazy keyboard characters + string(RANDOM LENGTH 78 ALPHABET "~`!@#$%^&*()_-+={}[]\\|:\\;'\",.<>/?" v) + message(STATUS "v='${v}'") + +else() # fail + message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") + +endif() diff --git a/Tests/CMakeWizardTest.cmake b/Tests/CMakeWizardTest.cmake new file mode 100644 index 000000000..bcae8afeb --- /dev/null +++ b/Tests/CMakeWizardTest.cmake @@ -0,0 +1,52 @@ +message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") + +message(STATUS "build_dir='${build_dir}'") + +message(STATUS "source_dir='${source_dir}'") + + +execute_process(COMMAND ${CMAKE_COMMAND} -E + remove_directory ${build_dir} + TIMEOUT 5) + +execute_process(COMMAND ${CMAKE_COMMAND} -E + make_directory ${build_dir} + TIMEOUT 5) + +execute_process(COMMAND ${CMAKE_COMMAND} -E + copy_directory ${source_dir} ${build_dir}/src + TIMEOUT 5) + +execute_process(COMMAND ${CMAKE_COMMAND} -E + make_directory ${build_dir}/build + TIMEOUT 5) + +# This is enough to answer 32 questions with "the default answer is ok"... +# +file(WRITE ${build_dir}/input.txt + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") + + +message(STATUS "running wizard mode (cmake -i)...") + +execute_process(COMMAND ${CMAKE_COMMAND} -i ../src + INPUT_FILE ${build_dir}/input.txt + WORKING_DIRECTORY ${build_dir}/build + TIMEOUT 5 + ) + + +message(STATUS "building...") + +execute_process(COMMAND ${CMAKE_COMMAND} --build . + WORKING_DIRECTORY ${build_dir}/build + TIMEOUT 5 + ) + + +message(STATUS "testing...") + +execute_process(COMMAND ${CMAKE_CTEST_COMMAND} + WORKING_DIRECTORY ${build_dir}/build + TIMEOUT 5 + ) diff --git a/Tests/CTestTest/SmallAndFast/CMakeLists.txt b/Tests/CTestTest/SmallAndFast/CMakeLists.txt new file mode 100644 index 000000000..51aa887bf --- /dev/null +++ b/Tests/CTestTest/SmallAndFast/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) +project(SmallAndFast) + +include(CTest) + +add_executable(echoargs echoargs.c) + +add_test(test0 echoargs) +add_test(test1 echoargs 1) +add_test(test2 echoargs 1 2) diff --git a/Tests/CTestTest/SmallAndFast/echoargs.c b/Tests/CTestTest/SmallAndFast/echoargs.c new file mode 100644 index 000000000..6e17464f7 --- /dev/null +++ b/Tests/CTestTest/SmallAndFast/echoargs.c @@ -0,0 +1,11 @@ +#include + +int main(int argc, const char* argv[]) +{ + int i = 0; + for (; i flag recognition for VS. -if(MSVC) +if(MSVC OR "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") add_library(example_dll_2 SHARED example_dll_2.c) set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS /DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def") + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXAMPLE_DLL_2) set(example_dll_2 example_dll_2) endif() diff --git a/Tests/ModuleDefinition/example_exe.c b/Tests/ModuleDefinition/example_exe.c index 60cde6aae..c521b3a4c 100644 --- a/Tests/ModuleDefinition/example_exe.c +++ b/Tests/ModuleDefinition/example_exe.c @@ -1,5 +1,5 @@ extern int __declspec(dllimport) example_dll_function(void); -#ifdef _MSC_VER +#ifdef EXAMPLE_DLL_2 extern int __declspec(dllimport) example_dll_2_function(void); #endif int example_exe_function(void) { return 0; } @@ -7,7 +7,7 @@ int main(void) { return example_dll_function() + -#ifdef _MSC_VER +#ifdef EXAMPLE_DLL_2 example_dll_2_function() + #endif example_exe_function(); diff --git a/Tests/ModuleDefinition/example_mod_1.c b/Tests/ModuleDefinition/example_mod_1.c index 483f60e11..4e2f9ba1f 100644 --- a/Tests/ModuleDefinition/example_mod_1.c +++ b/Tests/ModuleDefinition/example_mod_1.c @@ -6,7 +6,7 @@ int __declspec(dllimport) example_exe_function(void); int __declspec(dllimport) example_dll_function(void); -#ifdef _MSC_VER +#ifdef EXAMPLE_DLL_2 int __declspec(dllimport) example_dll_2_function(void); #endif @@ -14,7 +14,7 @@ __declspec(dllexport) int MODULE_CCONV example_mod_1_function(int n) { return example_dll_function() + -#ifdef _MSC_VER +#ifdef EXAMPLE_DLL_2 example_dll_2_function() + #endif example_exe_function() + n; diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index 00c398049..d423cae30 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 2.6) PROJECT(PrecompiledHeader C) # Make sure the proper compiler is in use. -IF(NOT MSVC) - MESSAGE(FATAL_ERROR "The PrecompiledHeader test works only with MSVC") -ENDIF(NOT MSVC) +IF(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + MESSAGE(FATAL_ERROR "The PrecompiledHeader test works only with MSVC or Intel") +ENDIF() # Compute a custom name for the precompiled header. IF(CMAKE_CONFIGURATION_TYPES) diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index f154b6ff4..b4ec17c6b 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -117,8 +117,9 @@ if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) endif(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE) set(EXPR_OP1 "/") -if(NOT MSVC OR PP_NMAKE) - # MSVC cl: % +if((NOT MSVC OR PP_NMAKE) AND + NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + # MSVC cl, Intel icl: % # When the cl compiler is invoked from the command line then % must # be written %% (to distinguish from %ENV% syntax). However cl does # not seem to accept the syntax when it is invoked from inside a @@ -128,9 +129,14 @@ if(NOT MSVC OR PP_NMAKE) # line. Currently only NMake supports running cl with a response # file. Supporting other make tools would require CMake to generate # response files explicitly for each object file. + # + # When the icl compiler is invoked from the command line then % must + # be written just '%'. However nmake requires '%%' except when using + # response files. Currently we have no way to affect escaping based + # on whether flags go in a response file, so we just have to skip it. set(STRING_EXTRA "${STRING_EXTRA}%") set(EXPR_OP1 "%") -endif(NOT MSVC OR PP_NMAKE) +endif() # General: \" # Make tools do not reliably accept \\\" syntax: diff --git a/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt index d606ac03e..453a46332 100644 --- a/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt @@ -1,26 +1,17 @@ # first we add the executable that generates the table -add_executable(MakeTable MakeTable.cxx) - -get_target_property(MakeTableLocation MakeTable LOCATION) +# add the binary tree directory to the search path for include files +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +add_executable(MakeTable MakeTable.cxx ) # add the command to generate the source code add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h DEPENDS MakeTable - COMMAND ${MakeTableLocation} - ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h - ) - -set_source_files_properties ( - mysqrt.cxx PROPERTIES - OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) -# add the binary tree directory to the search path for include files -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) - # add the main library -add_library(MathFunctions mysqrt.cxx) +add_library(MathFunctions mysqrt.cxx ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) install (TARGETS MathFunctions DESTINATION bin) install (FILES MathFunctions.h DESTINATION include)