From 098160d5f2a1aa35d2f14c585dd87cefd8f56f41 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 09:59:04 -0500 Subject: [PATCH 0001/1029] Begin post-3.2 development --- Help/release/dev/0-sample-topic.rst | 7 +++++++ Help/release/index.rst | 2 ++ Source/CMakeVersion.cmake | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 000000000..e4cc01e23 --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index a058bc17e..45d0a692d 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8ffe8c4a4..a7d6c4be2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_PATCH 20150205) +#set(CMake_VERSION_RC 1) From 892b854f57f48381751b79bfc52048ea57bb0376 Mon Sep 17 00:00:00 2001 From: Gunther Laure Date: Mon, 26 Jan 2015 18:13:44 +0100 Subject: [PATCH 0002/1029] FindBoost: Search for debug and release libraries separately (#15364) Split Boost_LIBRARY_DIR into Boost_LIBRARY_DIR_[RELEASE,DEBUG] to allow libraries to be grouped into per-config directories. --- Modules/FindBoost.cmake | 160 +++++++++++++++++++++++++++------------- 1 file changed, 109 insertions(+), 51 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 99293c13c..466090b68 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -49,7 +49,8 @@ # and saves search results persistently in CMake cache entries:: # # Boost_INCLUDE_DIR - Directory containing Boost headers -# Boost_LIBRARY_DIR - Directory containing Boost libraries +# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries +# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries # Boost__LIBRARY_DEBUG - Component library debug variant # Boost__LIBRARY_RELEASE - Component library release variant # @@ -65,7 +66,8 @@ # using the above hints (excluding BOOST_INCLUDEDIR and # Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, # and the library name configuration settings below. It saves the -# library directory in Boost_LIBRARY_DIR and individual library +# library directories in Boost_LIBRARY_DIR_DEBUG and +# Boost_LIBRARY_DIR_RELEASE and individual library # locations in Boost__LIBRARY_DEBUG and Boost__LIBRARY_RELEASE. # When one changes settings used by previous searches in the same build # tree (excluding environment variables) this module discards previous @@ -118,6 +120,8 @@ # "/usr/lib/libboost_system.so". This does not # affect linking and should not be enabled unless # the user needs this information. +# Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and +# Boost_LIBRARY_DIR_DEBUG. # # On Visual Studio and Borland compilers Boost headers request automatic # linking to corresponding libraries. This requires matching libraries @@ -283,6 +287,14 @@ macro(_Boost_ADJUST_LIB_VARS basename) ) endmacro() +# Detect changes in used variables. +# Compares the current variable value with the last one. +# In short form: +# v != v_LAST -> CHANGED = 1 +# v is defined, v_LAST not -> CHANGED = 1 +# v is not defined, but v_LAST is -> CHANGED = 1 +# otherwise -> CHANGED = 0 +# CHANGED is returned in variable named ${changed_var} macro(_Boost_CHANGE_DETECT changed_var) set(${changed_var} 0) foreach(v ${ARGN}) @@ -305,23 +317,33 @@ macro(_Boost_CHANGE_DETECT changed_var) endforeach() endmacro() -macro(_Boost_FIND_LIBRARY var) +# +# Find the given library (var). +# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds +# +macro(_Boost_FIND_LIBRARY var build_type) + find_library(${var} ${ARGN}) if(${var}) - # If this is the first library found then save Boost_LIBRARY_DIR. - if(NOT Boost_LIBRARY_DIR) + # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. + if(NOT Boost_LIBRARY_DIR_${build_type}) get_filename_component(_dir "${${var}}" PATH) - set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE) endif() elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) - # Try component-specific hints but do not save Boost_LIBRARY_DIR. + # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) endif() - # If Boost_LIBRARY_DIR is known then search only there. - if(Boost_LIBRARY_DIR) - set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there. + if(Boost_LIBRARY_DIR_${build_type}) + set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}" + " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}") + endif() endif() endmacro() @@ -456,6 +478,16 @@ endfunction() # main. #------------------------------------------------------------------------------- + +# If the user sets Boost_LIBRARY_DIR, use it as the default for both +# configurations. +if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR) + set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}") +endif() +if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR) + set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}") +endif() + if(NOT DEFINED Boost_USE_MULTITHREADED) set(Boost_USE_MULTITHREADED TRUE) endif() @@ -846,49 +878,54 @@ endif() # ------------------------------------------------------------------------ # Begin finding boost libraries # ------------------------------------------------------------------------ -set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR) -_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR) -# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the -# location did. We will find a new one based on the new inputs. -if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED) - unset(Boost_LIBRARY_DIR CACHE) -endif() -if(Boost_LIBRARY_DIR) - set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) -else() - set(_boost_LIBRARY_SEARCH_DIRS "") - if(BOOST_LIBRARYDIR) - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR}) - elseif(_ENV_BOOST_LIBRARYDIR) - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR}) +foreach(c DEBUG RELEASE) + set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c}) + _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR) + # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the + # location did. We will find a new one based on the new inputs. + if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED) + unset(Boost_LIBRARY_DIR_${c} CACHE) endif() - if(BOOST_ROOT) - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) - elseif(_ENV_BOOST_ROOT) - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) - endif() - - list(APPEND _boost_LIBRARY_SEARCH_DIRS - ${Boost_INCLUDE_DIR}/lib - ${Boost_INCLUDE_DIR}/../lib - ${Boost_INCLUDE_DIR}/stage/lib - ) - if( Boost_NO_SYSTEM_PATHS ) - list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH) + # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value. + if(Boost_LIBRARY_DIR_${c}) + set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) else() - list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS - C:/boost/lib - C:/boost - /sw/local/lib + set(_boost_LIBRARY_SEARCH_DIRS_${c} "") + if(BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR}) + elseif(_ENV_BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR}) + endif() + + if(BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) + elseif(_ENV_BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) + endif() + + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib ) + if( Boost_NO_SYSTEM_PATHS ) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH) + else() + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS + C:/boost/lib + C:/boost + /sw/local/lib + ) + endif() endif() -endif() +endforeach() if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") + "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}" + "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") endif() # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES @@ -1002,10 +1039,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") endif() - # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}") + # if Boost_LIBRARY_DIR_RELEASE is not defined, + # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs + if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG) + list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG}) + endif() - _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") + + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE NAMES ${_boost_RELEASE_NAMES} HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} NAMES_PER_DIR @@ -1038,10 +1081,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") endif() - # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}") + # if Boost_LIBRARY_DIR_DEBUG is not defined, + # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs + if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE) + list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE}) + endif() - _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") + + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG NAMES ${_boost_DEBUG_NAMES} HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} NAMES_PER_DIR @@ -1067,7 +1116,16 @@ endif() # ------------------------------------------------------------------------ set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) -set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR}) +set(Boost_LIBRARY_DIRS) +if(Boost_LIBRARY_DIR_RELEASE) + list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE}) +endif() +if(Boost_LIBRARY_DIR_DEBUG) + list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG}) +endif() +if(Boost_LIBRARY_DIRS) + list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) +endif() # The above setting of Boost_FOUND was based only on the header files. # Update it for the requested component libraries. From 39e0aa5390964953e1462f0efed0058c172a0a26 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 10:57:34 -0500 Subject: [PATCH 0003/1029] Help: Add notes for topic 'FindBoost-per-config-libraries' --- Help/release/dev/FindBoost-per-config-libraries.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/FindBoost-per-config-libraries.rst diff --git a/Help/release/dev/FindBoost-per-config-libraries.rst b/Help/release/dev/FindBoost-per-config-libraries.rst new file mode 100644 index 000000000..e6ef70fcf --- /dev/null +++ b/Help/release/dev/FindBoost-per-config-libraries.rst @@ -0,0 +1,5 @@ +FindBoost-per-config-libraries +------------------------------ + +* The :module:`FindBoost` module now tracks the directories containing + libraries separately for RELEASE and DEBUG configurations. From 393a45e2e1fa2f0d9657d4a686257d828cd918e4 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Mon, 2 Feb 2015 17:07:04 -0700 Subject: [PATCH 0004/1029] CheckFortranCompilerFlag: Add module to check Fortran flag existence Copy the CheckCCompilerFlag module and replace 'C' with 'Fortran'. Also update the common patterns module to match some Fortran compiler messages. --- Help/manual/cmake-modules.7.rst | 1 + Help/module/CheckFortranCompilerFlag.rst | 1 + ...CMakeCheckCompilerFlagCommonPatterns.cmake | 5 +- Modules/CheckFortranCompilerFlag.cmake | 66 +++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 Help/module/CheckFortranCompilerFlag.rst create mode 100644 Modules/CheckFortranCompilerFlag.cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index db5601098..76058f91c 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -22,6 +22,7 @@ All Modules /module/CheckCXXSourceCompiles /module/CheckCXXSourceRuns /module/CheckCXXSymbolExists + /module/CheckFortranCompilerFlag /module/CheckFortranFunctionExists /module/CheckFortranSourceCompiles /module/CheckFunctionExists diff --git a/Help/module/CheckFortranCompilerFlag.rst b/Help/module/CheckFortranCompilerFlag.rst new file mode 100644 index 000000000..58bf6ec35 --- /dev/null +++ b/Help/module/CheckFortranCompilerFlag.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CheckFortranCompilerFlag.cmake diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 19b2bbcf3..3141d60b2 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -21,9 +21,9 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) set(${_VAR} - FAIL_REGEX "unrecognized .*option" # GNU + FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG FAIL_REGEX "unknown .*option" # Clang - FAIL_REGEX "ignoring unknown option" # MSVC + FAIL_REGEX "ignoring unknown option" # MSVC, Intel FAIL_REGEX "warning D9002" # MSVC, any lang FAIL_REGEX "option.*not supported" # Intel FAIL_REGEX "invalid argument .*option" # Intel @@ -35,6 +35,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "command option .* contains an incorrect subargument" # XL FAIL_REGEX "not supported in this configuration. ignored" # AIX FAIL_REGEX "File with unknown suffix passed to linker" # PGI + FAIL_REGEX "[Uu]nknown switch" # PGI FAIL_REGEX "WARNING: unknown flag:" # Open64 FAIL_REGEX "Incorrect command line option:" # Borland FAIL_REGEX "Warning: illegal option" # SunStudio 12 diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake new file mode 100644 index 000000000..53fd8d64d --- /dev/null +++ b/Modules/CheckFortranCompilerFlag.cmake @@ -0,0 +1,66 @@ +#.rst: +# CheckFortranCompilerFlag +# ------------------------ +# +# Check whether the Fortran compiler supports a given flag. +# +# CHECK_Fortran_COMPILER_FLAG( ) +# +# :: +# +# - the compiler flag +# - variable to store the result +# Will be created as an internal cache variable. +# +# This internally calls the check_fortran_source_compiles macro and +# sets CMAKE_REQUIRED_DEFINITIONS to . See help for +# CheckFortranSourceCompiles for a listing of variables that can +# otherwise modify the build. The result only tells that the compiler +# does not give an error message when it encounters the flag. If the +# flag has any effect or even a specific one is beyond the scope of +# this module. + +#============================================================================= +# Copyright 2015 Nicolas Bock +# Copyright 2006-2011 Kitware, Inc. +# Copyright 2006 Alexander Neundorf +# Copyright 2011 Matthias Kretz +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CheckFortranSourceCompiles) +include(CMakeCheckCompilerFlagCommonPatterns) + +macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT) + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + + # Normalize locale during test compilation. + set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) + foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS}) + set(_CheckFortranCompilerFlag_SAVED_${v} "$ENV{${v}}") + set(ENV{${v}} C) + endforeach() + CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckFortranCompilerFlag_COMMON_PATTERNS) + CHECK_Fortran_SOURCE_COMPILES(" program test\n stop\n end program" ${_RESULT} + # Some compilers do not fail with a bad flag + FAIL_REGEX "command line option .* is valid for .* but not for Fortran" # GNU + ${_CheckFortranCompilerFlag_COMMON_PATTERNS} + ) + foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS}) + set(ENV{${v}} ${_CheckFortranCompilerFlag_SAVED_${v}}) + unset(_CheckFortranCompilerFlag_SAVED_${v}) + endforeach() + unset(_CheckFortranCompilerFlag_LOCALE_VARS) + unset(_CheckFortranCompilerFlag_COMMON_PATTERNS) + + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") +endmacro () From 54e900abfbbddde560a853355b448e1b86681741 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 11:18:13 -0500 Subject: [PATCH 0005/1029] CheckFortranCompilerFlag: Add test case Extend the FortranOnly test with a case covering this module. --- Tests/FortranOnly/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index 1b2651dd7..9bf03033a 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -65,6 +65,13 @@ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n" "${err}") endif() + + unset(Fortran_BOGUS_FLAG CACHE) + include(CheckFortranCompilerFlag) + CHECK_Fortran_COMPILER_FLAG(-_this_is_not_a_flag_ Fortran_BOGUS_FLAG) + if (Fortran_BOGUS_FLAG) + message (SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed") + endif () endif() # Test generation of preprocessed sources. From 1814cf744ce69ab97ce4a8fe8183b4d4f7f75cf4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 11:18:41 -0500 Subject: [PATCH 0006/1029] Help: Add notes for topic 'add-CheckFortranCompilerFlag' --- Help/release/dev/add-CheckFortranCompilerFlag.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/add-CheckFortranCompilerFlag.rst diff --git a/Help/release/dev/add-CheckFortranCompilerFlag.rst b/Help/release/dev/add-CheckFortranCompilerFlag.rst new file mode 100644 index 000000000..718b53e9d --- /dev/null +++ b/Help/release/dev/add-CheckFortranCompilerFlag.rst @@ -0,0 +1,6 @@ +add-CheckFortranCompilerFlag +---------------------------- + +* The :module:`CheckFortranCompilerFlag` module was introduced + to check ``Fortran`` compiler flags, much like the + :module:`CheckCCompilerFlag` module already does for ``C``. From 421eadb45b48d40aa7d0b5e42a48df4ba94b9fc0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 29 Jan 2015 23:19:40 +0100 Subject: [PATCH 0007/1029] Remove use of cmsys_stl. It is not needed. --- Source/CPack/OSXScriptLauncher.cxx | 8 ++++---- Source/CPack/cmCPackNSISGenerator.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 4 ++-- Source/QtDialog/CMakeSetup.cxx | 6 +++--- Source/cmComputeLinkDepends.cxx | 6 +++--- Source/cmFileCommand.cxx | 4 ++-- Source/cmFindLibraryCommand.cxx | 4 ++-- Source/cmSystemTools.cxx | 2 +- Source/cmXMLSafe.cxx | 4 ++-- Source/cmXMLSafe.h | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index d9d623692..1d7afbd19 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -26,7 +26,7 @@ int main(int argc, char* argv[]) { //if ( cmsys::SystemTools::FileExists( - cmsys_stl::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory(); + std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory(); cmsys::ofstream ofs("/tmp/output.txt"); CFStringRef fileName; @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) //dispose of the CF variable CFRelease(scriptFileURL); - cmsys_stl::string fullScriptPath = reinterpret_cast(path); + std::string fullScriptPath = reinterpret_cast(path); delete [] path; @@ -75,10 +75,10 @@ int main(int argc, char* argv[]) return 1; } - cmsys_stl::string scriptDirectory = cmsys::SystemTools::GetFilenamePath( + std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath( fullScriptPath); ofs << fullScriptPath.c_str() << cmsys_ios::endl; - cmsys_stl::vector args; + std::vector args; args.push_back(fullScriptPath.c_str()); int cc; for ( cc = 1; cc < argc; ++ cc ) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 8f63ca20b..fe6cc956b 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -654,7 +654,7 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(const char* topdir, if (strcmp(dir.GetFile(static_cast(fileNum)),".") && strcmp(dir.GetFile(static_cast(fileNum)),"..")) { - cmsys_stl::string fullPath = topdir; + std::string fullPath = topdir; fullPath += "/"; fullPath += dir.GetFile(static_cast(fileNum)); if(cmsys::SystemTools::FileIsDirectory(fullPath) && diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 08b7c6610..1226d2274 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -2542,10 +2542,10 @@ bool cmCTestCoverageHandler::IntersectsFilter(LabelSet const& labels) } std::vector ids; - cmsys_stl::set_intersection + std::set_intersection (labels.begin(), labels.end(), this->LabelFilter.begin(), this->LabelFilter.end(), - cmsys_stl::back_inserter(ids)); + std::back_inserter(ids)); return !ids.empty(); } diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 82fa3a3a9..8a72a2479 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -149,10 +149,10 @@ int main(int argc, char** argv) QStringList args = app.arguments(); if(args.count() == 2) { - cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data()); + std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data()); // check if argument is a directory containing CMakeCache.txt - cmsys_stl::string buildFilePath = + std::string buildFilePath = cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str()); // check if argument is a CMakeCache.txt file @@ -163,7 +163,7 @@ int main(int argc, char** argv) } // check if argument is a directory containing CMakeLists.txt - cmsys_stl::string srcFilePath = + std::string srcFilePath = cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str()); if(cmSystemTools::FileExists(buildFilePath.c_str())) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 32d5cd3d2..fa1bbccea 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -669,7 +669,7 @@ void cmComputeLinkDepends::InferDependencies() for(++i; i != sets->end(); ++i) { DependSet intersection; - cmsys_stl::set_intersection + std::set_intersection (common.begin(), common.end(), i->begin(), i->end(), std::inserter(intersection, intersection.begin())); common = intersection; @@ -689,10 +689,10 @@ void cmComputeLinkDepends::CleanConstraintGraph() { // Sort the outgoing edges for each graph node so that the // original order will be preserved as much as possible. - cmsys_stl::sort(i->begin(), i->end()); + std::sort(i->begin(), i->end()); // Make the edge list unique. - EdgeList::iterator last = cmsys_stl::unique(i->begin(), i->end()); + EdgeList::iterator last = std::unique(i->begin(), i->end()); i->erase(last, i->end()); } } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 579e7156e..8b893bc7a 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -71,7 +71,7 @@ static std::string fix_file_url_windows(const std::string& url) std::string ret = url; if(strncmp(url.c_str(), "file://", 7) == 0) { - cmsys_stl::wstring wurl = cmsys::Encoding::ToWide(url); + std::wstring wurl = cmsys::Encoding::ToWide(url); if(!wurl.empty()) { int mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, @@ -1843,7 +1843,7 @@ bool cmFileCopier::InstallDirectory(const char* source, if(!(strcmp(dir.GetFile(fileNum), ".") == 0 || strcmp(dir.GetFile(fileNum), "..") == 0)) { - cmsys_stl::string fromPath = source; + std::string fromPath = source; fromPath += "/"; fromPath += dir.GetFile(fileNum); std::string toPath = destination; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 78f0e9e52..c499f6154 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -195,12 +195,12 @@ struct cmFindLibraryHelper void RegexFromList(std::string& out, std::vector const& in); size_type GetPrefixIndex(std::string const& prefix) { - return cmsys_stl::find(this->Prefixes.begin(), this->Prefixes.end(), + return std::find(this->Prefixes.begin(), this->Prefixes.end(), prefix) - this->Prefixes.begin(); } size_type GetSuffixIndex(std::string const& suffix) { - return cmsys_stl::find(this->Suffixes.begin(), this->Suffixes.end(), + return std::find(this->Suffixes.begin(), this->Suffixes.end(), suffix) - this->Suffixes.begin(); } bool HasValidSuffix(std::string const& name); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e9735ed41..b07dd78b8 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2695,7 +2695,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, } if(se_count == 2 && se[1]->IndexInSection < se[0]->IndexInSection) { - cmsys_stl::swap(se[0], se[1]); + std::swap(se[0], se[1]); } // Get the size of the dynamic section header. diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx index 72fdc3466..99f562519 100644 --- a/Source/cmXMLSafe.cxx +++ b/Source/cmXMLSafe.cxx @@ -28,7 +28,7 @@ cmXMLSafe::cmXMLSafe(const char* s): } //---------------------------------------------------------------------------- -cmXMLSafe::cmXMLSafe(cmsys_stl::string const& s): +cmXMLSafe::cmXMLSafe(std::string const& s): Data(s.c_str()), Size(static_cast(s.length())), DoQuotes(true) @@ -43,7 +43,7 @@ cmXMLSafe& cmXMLSafe::Quotes(bool b) } //---------------------------------------------------------------------------- -cmsys_stl::string cmXMLSafe::str() +std::string cmXMLSafe::str() { cmsys_ios::ostringstream ss; ss << *this; diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h index cba9f390d..c23a90c38 100644 --- a/Source/cmXMLSafe.h +++ b/Source/cmXMLSafe.h @@ -24,7 +24,7 @@ public: /** Construct with the data to be written. This assumes the data will exist for the duration of this object's life. */ cmXMLSafe(const char* s); - cmXMLSafe(cmsys_stl::string const& s); + cmXMLSafe(std::string const& s); /** Specify whether to escape quotes too. This is needed when writing the content of an attribute value. By default quotes @@ -32,7 +32,7 @@ public: cmXMLSafe& Quotes(bool b = true); /** Get the escaped data as a string. */ - cmsys_stl::string str(); + std::string str(); private: char const* Data; unsigned long Size; From 5fc53f1edb2d003595ef224b31a805c3af0dc0e6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 24 Jan 2015 18:12:48 +0100 Subject: [PATCH 0008/1029] cmLocalGenerator: Replace loop with find_first_not_of --- Source/cmLocalGenerator.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7ca7684c4..9109db490 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3204,11 +3204,7 @@ cmLocalGenerator std::string ssin = sin; // Avoid full paths by removing leading slashes. - std::string::size_type pos = 0; - for(;pos < ssin.size() && ssin[pos] == '/'; ++pos) - { - } - ssin = ssin.substr(pos); + ssin.erase(0, ssin.find_first_not_of("/")); // Avoid full paths by removing colons. cmSystemTools::ReplaceString(ssin, ":", "_"); From bd990c803b40e1532cab6b29c75414ca6f30e782 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 17:10:03 +0100 Subject: [PATCH 0009/1029] Remove use of ExpandSourceListArguments. By now, it is only an expensive copy. --- Source/cmCPluginAPI.cxx | 7 +++---- Source/cmFLTKWrapUICommand.cxx | 7 ++----- Source/cmInstallFilesCommand.cxx | 7 ++----- Source/cmQTWrapCPPCommand.cxx | 10 +++------- Source/cmQTWrapUICommand.cxx | 10 +++------- 5 files changed, 13 insertions(+), 28 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index d0dc30a6a..691d80d7e 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -438,15 +438,14 @@ void CCONV cmExpandSourceListArguments(void *arg, char ***resArgv, unsigned int startArgumentIndex) { - cmMakefile *mf = static_cast(arg); + (void)arg; + (void)startArgumentIndex; std::vector result; - std::vector args2; int i; for (i = 0; i < numArgs; ++i) { - args2.push_back(args[i]); + result.push_back(args[i]); } - mf->ExpandSourceListArguments(args2, result, startArgumentIndex); int resargc = static_cast(result.size()); char **resargv = 0; if (resargc) diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index f7d824347..488beaad4 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -31,9 +31,6 @@ bool cmFLTKWrapUICommand // get parameter for the command this->Target = args[0]; // Target that will use the generated files - std::vector newArgs; - this->Makefile->ExpandSourceListArguments(args,newArgs, 1); - // get the list of GUI files from which .cxx and .h will be generated std::string outputDirectory = this->Makefile->GetCurrentOutputDirectory(); @@ -45,8 +42,8 @@ bool cmFLTKWrapUICommand this->Makefile->AddIncludeDirectories( outputDirectories ); } - for(std::vector::iterator i = (newArgs.begin() + 1); - i != newArgs.end(); i++) + for(std::vector::const_iterator i = (args.begin() + 1); + i != args.end(); i++) { cmSourceFile *curr = this->Makefile->GetSource(*i); // if we should use the source GUI diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 06a78e5a6..85e5345b8 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -15,9 +15,9 @@ // cmExecutableCommand bool cmInstallFilesCommand -::InitialPass(std::vector const& argsIn, cmExecutionStatus &) +::InitialPass(std::vector const& args, cmExecutionStatus &) { - if(argsIn.size() < 2) + if(args.size() < 2) { this->SetError("called with incorrect number of arguments"); return false; @@ -27,9 +27,6 @@ bool cmInstallFilesCommand this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->EnableInstallTarget(); - std::vector args; - this->Makefile->ExpandSourceListArguments(argsIn, args, 2); - this->Destination = args[0]; if((args.size() > 1) && (args[1] == "FILES")) diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index a984260d6..878562c99 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -12,19 +12,15 @@ #include "cmQTWrapCPPCommand.h" // cmQTWrapCPPCommand -bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, +bool cmQTWrapCPPCommand::InitialPass(std::vector const& args, cmExecutionStatus &) { - if(argsIn.size() < 3 ) + if(args.size() < 3 ) { this->SetError("called with incorrect number of arguments"); return false; } - // This command supports source list inputs for compatibility. - std::vector args; - this->Makefile->ExpandSourceListArguments(argsIn, args, 2); - // Get the moc executable to run in the custom command. const char* moc_exe = this->Makefile->GetRequiredDefinition("QT_MOC_EXECUTABLE"); @@ -35,7 +31,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, this->Makefile->GetSafeDefinition(sourceList); // Create a rule for all sources listed. - for(std::vector::iterator j = (args.begin() + 2); + for(std::vector::const_iterator j = (args.begin() + 2); j != args.end(); ++j) { cmSourceFile *curr = this->Makefile->GetSource(*j); diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index dce59efa1..9b92b1eea 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -12,19 +12,15 @@ #include "cmQTWrapUICommand.h" // cmQTWrapUICommand -bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, +bool cmQTWrapUICommand::InitialPass(std::vector const& args, cmExecutionStatus &) { - if(argsIn.size() < 4 ) + if(args.size() < 4 ) { this->SetError("called with incorrect number of arguments"); return false; } - // This command supports source list inputs for compatibility. - std::vector args; - this->Makefile->ExpandSourceListArguments(argsIn, args, 3); - // Get the uic and moc executables to run in the custom commands. const char* uic_exe = this->Makefile->GetRequiredDefinition("QT_UIC_EXECUTABLE"); @@ -40,7 +36,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, this->Makefile->GetSafeDefinition(sourceList); // Create rules for all sources listed. - for(std::vector::iterator j = (args.begin() + 3); + for(std::vector::const_iterator j = (args.begin() + 3); j != args.end(); ++j) { cmSourceFile *curr = this->Makefile->GetSource(*j); From 3f3db74413fc6b0afe4aa484c0ada2d5271ef0ba Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 14:26:57 +0100 Subject: [PATCH 0010/1029] cmMakefile: Remove ExpandSourceListArguments. --- Source/cmMakefile.cxx | 13 ------------- Source/cmMakefile.h | 11 ----------- 2 files changed, 24 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ba914e151..e709b9fbd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3576,19 +3576,6 @@ void cmMakefile::EnableLanguage(std::vector const & lang, optional); } -void cmMakefile::ExpandSourceListArguments( - std::vector const& arguments, - std::vector& newargs, unsigned int /* start */) const -{ - // now expand the args - unsigned int i; - for(i = 0; i < arguments.size(); ++i) - { - // List expansion will have been done already. - newargs.push_back(arguments[i]); - } -} - int cmMakefile::TryCompile(const std::string& srcdir, const std::string& bindir, const std::string& projectName, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index bff8c1288..5f2248569 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -599,17 +599,6 @@ public: */ void AddSystemIncludeDirectories(const std::set &incs); - /** Expand out any arguements in the vector that have ; separated - * strings into multiple arguements. A new vector is created - * containing the expanded versions of all arguments in argsIn. - * This method differes from the one in cmSystemTools in that if - * the CmakeLists file is version 1.2 or earlier it will check for - * source lists being used without ${} around them - */ - void ExpandSourceListArguments(std::vector const& argsIn, - std::vector& argsOut, - unsigned int startArgumentIndex) const; - /** Get a cmSourceFile pointer for a given source name, if the name is * not found, then a null pointer is returned. */ From 69ac6d27555cd4819d0c7f40e4471c6f885e23ab Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 16:29:59 -0500 Subject: [PATCH 0011/1029] bootstrap: Enable color Makefile output Build the needed infrastructure during bootstrap in order to allow "cmake -E cmake_echo_color" to be used unconditionally during generation. --- Source/cmLocalUnixMakefileGenerator3.cxx | 10 +--------- Source/cmSystemTools.cxx | 4 +--- Source/cmSystemTools.h | 2 -- Source/cmcmd.cxx | 11 ++--------- bootstrap | 9 ++++++--- 5 files changed, 10 insertions(+), 26 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fbf214036..72d4ef072 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -27,10 +27,10 @@ #ifdef CMAKE_BUILD_WITH_CMAKE # include "cmDependsFortran.h" # include "cmDependsJava.h" -# include #endif #include +#include #include @@ -1351,7 +1351,6 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, { // Choose the color for the text. std::string color_name; -#ifdef CMAKE_BUILD_WITH_CMAKE if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile) { // See cmake::ExecuteEchoColor in cmake.cxx for these options. @@ -1377,9 +1376,6 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, break; } } -#else - (void)color; -#endif // Echo one line at a time. std::string line; @@ -1617,14 +1613,10 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, targetName = targetName.substr(0, targetName.length()-4); std::string message = "Scanning dependencies of target "; message += targetName; -#ifdef CMAKE_BUILD_WITH_CMAKE cmSystemTools::MakefileColorEcho( cmsysTerminal_Color_ForegroundMagenta | cmsysTerminal_Color_ForegroundBold, message.c_str(), true, color); -#else - fprintf(stdout, "%s\n", message.c_str()); -#endif return this->ScanDependencies(dir.c_str(), validDependencies); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e9735ed41..ec3d846c3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -27,10 +27,10 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmArchiveWrite.h" # include -# include #endif #include #include +#include #if defined(_WIN32) # include @@ -2284,7 +2284,6 @@ std::string const& cmSystemTools::GetCMakeRoot() } //---------------------------------------------------------------------------- -#if defined(CMAKE_BUILD_WITH_CMAKE) void cmSystemTools::MakefileColorEcho(int color, const char* message, bool newline, bool enabled) { @@ -2314,7 +2313,6 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message, fprintf(stdout, "%s%s", message, newline? "\n" : ""); } } -#endif //---------------------------------------------------------------------------- bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 361f42e60..c59ae96b8 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -428,11 +428,9 @@ public: static std::string const& GetCMakeCursesCommand(); static std::string const& GetCMakeRoot(); -#if defined(CMAKE_BUILD_WITH_CMAKE) /** Echo a message in color using KWSys's Terminal cprintf. */ static void MakefileColorEcho(int color, const char* message, bool newLine, bool enabled); -#endif /** Try to guess the soname of a shared library. */ static bool GuessLibrarySOName(std::string const& fullPath, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 28fcd27f7..6b04d260e 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -18,12 +18,12 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. -# include #endif #include #include #include +#include #if defined(CMAKE_HAVE_VS_GENERATORS) #include "cmCallVisualStudioMacro.h" @@ -753,12 +753,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { return cmcmd::VisualStudioLink(args, 2); } -#ifdef CMAKE_BUILD_WITH_CMAKE // Internal CMake color makefile support. else if (args[1] == "cmake_echo_color") { return cmcmd::ExecuteEchoColor(args); } +#ifdef CMAKE_BUILD_WITH_CMAKE else if (args[1] == "cmake_autogen" && args.size() >= 4) { cmQtAutoGenerators autogen; @@ -987,7 +987,6 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) } //---------------------------------------------------------------------------- -#ifdef CMAKE_BUILD_WITH_CMAKE int cmcmd::ExecuteEchoColor(std::vector& args) { // The arguments are @@ -1073,12 +1072,6 @@ int cmcmd::ExecuteEchoColor(std::vector& args) return 0; } -#else -int cmcmd::ExecuteEchoColor(std::vector&) -{ - return 1; -} -#endif //---------------------------------------------------------------------------- int cmcmd::ExecuteLinkScript(std::vector& args) diff --git a/bootstrap b/bootstrap index a88eb6a1c..8e22bee9e 100755 --- a/bootstrap +++ b/bootstrap @@ -333,13 +333,15 @@ if ${cmake_system_mingw}; then EncodingC \ ProcessWin32 \ String \ - System" + System \ + Terminal" else KWSYS_C_SOURCES="\ EncodingC \ ProcessUNIX \ String \ - System" + System \ + Terminal" fi KWSYS_CXX_SOURCES="\ @@ -362,7 +364,8 @@ KWSYS_FILES="\ String.h \ String.hxx \ System.h \ - SystemTools.hxx" + SystemTools.hxx \ + Terminal.h" KWSYS_IOS_FILES=" fstream \ From 3f73531d4e415c9c6182e162028eb146922d3c90 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 6 Feb 2015 00:01:16 -0500 Subject: [PATCH 0012/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a7d6c4be2..ee2953383 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150205) +set(CMake_VERSION_PATCH 20150206) #set(CMake_VERSION_RC 1) From 8521fdf56e4908676c28c6bbdda3f1fb2284d3d7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 16:48:16 -0500 Subject: [PATCH 0013/1029] Makefile: Fix output during parallel builds (#12991) Replace use of separate "cmake -E cmake_progress_report" and "cmake -E cmake_echo_color" commands to report the progress and message portions of build output lines with --progress-* options to the latter to print everything with a single command. The line buffering of the stdout FILE stream should cause the whole line to be printed with one atomic write. This will avoid inter-mixing of line-wise messages from different processes during a parallel build. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 43 ++++---- Source/cmLocalUnixMakefileGenerator3.cxx | 23 ++++- Source/cmLocalUnixMakefileGenerator3.h | 5 +- Source/cmMakefileTargetGenerator.cxx | 36 ++++--- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmcmd.cxx | 117 ++++++++++++++-------- 6 files changed, 133 insertions(+), 93 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5f1bb831d..e0ccaa99d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -779,29 +779,24 @@ cmGlobalUnixMakefileGenerator3 localName += "/all"; depends.clear(); - std::string progressDir = - lg->GetMakefile()->GetHomeOutputDirectory(); - progressDir += cmake::GetCMakeFilesDirectory(); + cmLocalUnixMakefileGenerator3::EchoProgress progress; + progress.Dir = lg->GetMakefile()->GetHomeOutputDirectory(); + progress.Dir += cmake::GetCMakeFilesDirectory(); + { + std::ostringstream progressArg; + const char* sep = ""; + std::vector& progFiles = + this->ProgressMap[gtarget->Target].Marks; + for (std::vector::iterator i = progFiles.begin(); + i != progFiles.end(); ++i) { - std::ostringstream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; - // all target counts - progCmd << lg->Convert(progressDir, - cmLocalGenerator::FULL, - cmLocalGenerator::SHELL); - progCmd << " "; - std::vector& progFiles = - this->ProgressMap[gtarget->Target].Marks; - for (std::vector::iterator i = progFiles.begin(); - i != progFiles.end(); ++i) - { - progCmd << " " << *i; - } - commands.push_back(progCmd.str()); + progressArg << sep << *i; + sep = ","; } - progressDir = "Built target "; - progressDir += name; - lg->AppendEcho(commands,progressDir.c_str()); + progress.Arg = progressArg.str(); + } + lg->AppendEcho(commands, "Built target " + name, + cmLocalUnixMakefileGenerator3::EchoNormal, &progress); this->AppendGlobalTargetDepends(depends,*gtarget->Target); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", @@ -819,15 +814,13 @@ cmGlobalUnixMakefileGenerator3 // Write the rule. commands.clear(); - progressDir = lg->GetMakefile()->GetHomeOutputDirectory(); - progressDir += cmake::GetCMakeFilesDirectory(); { // TODO: Convert the total progress count to a make variable. std::ostringstream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # in target - progCmd << lg->Convert(progressDir, + progCmd << lg->Convert(progress.Dir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // @@ -843,7 +836,7 @@ cmGlobalUnixMakefileGenerator3 { std::ostringstream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << lg->Convert(progressDir, + progCmd << lg->Convert(progress.Dir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " 0"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 72d4ef072..c60a9c740 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1346,8 +1346,9 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, - const char* text, - EchoColor color) + std::string const& text, + EchoColor color, + EchoProgress const* progress) { // Choose the color for the text. std::string color_name; @@ -1380,7 +1381,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, // Echo one line at a time. std::string line; line.reserve(200); - for(const char* c = text;; ++c) + for(const char* c = text.c_str();; ++c) { if(*c == '\n' || *c == '\0') { @@ -1389,7 +1390,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, { // Add a command to echo this line. std::string cmd; - if(color_name.empty()) + if(color_name.empty() && !progress) { // Use the native echo command. cmd = "@echo "; @@ -1400,6 +1401,17 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, // Use cmake to echo the text in color. cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) "; cmd += color_name; + if (progress) + { + cmd += "--progress-dir="; + cmd += this->Convert(progress->Dir, + cmLocalGenerator::FULL, + cmLocalGenerator::SHELL); + cmd += " "; + cmd += "--progress-num="; + cmd += progress->Arg; + cmd += " "; + } cmd += this->EscapeForShell(line); } commands.push_back(cmd); @@ -1408,6 +1420,9 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, // Reset the line to emtpy. line = ""; + // Progress appears only on first line. + progress = 0; + // Terminate on end-of-string. if(*c == '\0') { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7c8e27f49..1ff5e7fea 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -184,8 +184,9 @@ public: // append an echo command enum EchoColor { EchoNormal, EchoDepend, EchoBuild, EchoLink, EchoGenerate, EchoGlobal }; - void AppendEcho(std::vector& commands, const char* text, - EchoColor color = EchoNormal); + struct EchoProgress { std::string Dir; std::string Arg; }; + void AppendEcho(std::vector& commands, std::string const& text, + EchoColor color = EchoNormal, EchoProgress const* = 0); /** Get whether the makefile is to have color. */ bool GetColorMakefile() const { return this->ColorMakefile; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7ed0c106a..20207f50b 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -618,16 +618,19 @@ cmMakefileTargetGenerator std::vector commands; // add in a progress call if needed - this->AppendProgress(commands); + this->NumberOfProgressActions++; if(!this->NoRuleMessages) { + cmLocalUnixMakefileGenerator3::EchoProgress progress; + this->MakeEchoProgress(progress); std::string buildEcho = "Building "; buildEcho += lang; buildEcho += " object "; buildEcho += relativeObj; this->LocalGenerator->AppendEcho - (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild); + (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild, + &progress); } std::string targetOutPathReal; @@ -1200,12 +1203,15 @@ void cmMakefileTargetGenerator if(!comment.empty()) { // add in a progress call if needed - this->AppendProgress(commands); + this->NumberOfProgressActions++; if(!this->NoRuleMessages) { + cmLocalUnixMakefileGenerator3::EchoProgress progress; + this->MakeEchoProgress(progress); this->LocalGenerator ->AppendEcho(commands, comment.c_str(), - cmLocalUnixMakefileGenerator3::EchoGenerate); + cmLocalUnixMakefileGenerator3::EchoGenerate, + &progress); } } @@ -1263,22 +1269,14 @@ void cmMakefileTargetGenerator //---------------------------------------------------------------------------- void -cmMakefileTargetGenerator::AppendProgress(std::vector& commands) +cmMakefileTargetGenerator +::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const { - this->NumberOfProgressActions++; - if(this->NoRuleMessages) - { - return; - } - std::string progressDir = this->Makefile->GetHomeOutputDirectory(); - progressDir += cmake::GetCMakeFilesDirectory(); - std::ostringstream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; - progCmd << this->LocalGenerator->Convert(progressDir, - cmLocalGenerator::FULL, - cmLocalGenerator::SHELL); - progCmd << " $(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; - commands.push_back(progCmd.str()); + progress.Dir = this->Makefile->GetHomeOutputDirectory(); + progress.Dir += cmake::GetCMakeFilesDirectory(); + std::ostringstream progressArg; + progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; + progress.Arg = progressArg.str(); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index e31e0863a..b072cfaea 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -109,7 +109,7 @@ protected: void GenerateExtraOutput(const char* out, const char* in, bool symbolic = false); - void AppendProgress(std::vector& commands); + void MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress&) const; // write out the variable that lists the objects for this target void WriteObjectsVariable(std::string& variableName, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 6b04d260e..5260cb0e8 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -534,48 +534,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Command to report progress for a build else if (args[1] == "cmake_progress_report" && args.size() >= 3) { - std::string dirName = args[2]; - dirName += "/Progress"; - std::string fName; - FILE *progFile; - - // read the count - fName = dirName; - fName += "/count.txt"; - progFile = cmsys::SystemTools::Fopen(fName,"r"); - int count = 0; - if (!progFile) - { - return 0; - } - else - { - if (1!=fscanf(progFile,"%i",&count)) - { - cmSystemTools::Message("Could not read from progress file."); - } - fclose(progFile); - } - unsigned int i; - for (i = 3; i < args.size(); ++i) - { - fName = dirName; - fName += "/"; - fName += args[i]; - progFile = cmsys::SystemTools::Fopen(fName,"w"); - if (progFile) - { - fprintf(progFile,"empty"); - fclose(progFile); - } - } - int fileNum = static_cast - (cmsys::Directory::GetNumberOfFilesInDirectory(dirName)); - if (count > 0) - { - // print the progress - fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count); - } + // This has been superseded by cmake_echo_color --progress-* + // options. We leave it here to avoid errors if somehow this + // is invoked by an existing makefile without regenerating. return 0; } @@ -986,6 +947,65 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) #endif } +//---------------------------------------------------------------------------- +static void cmcmdProgressReport(std::string const& dir, + std::string const& num) +{ + std::string dirName = dir; + dirName += "/Progress"; + std::string fName; + FILE *progFile; + + // read the count + fName = dirName; + fName += "/count.txt"; + progFile = cmsys::SystemTools::Fopen(fName,"r"); + int count = 0; + if (!progFile) + { + return; + } + else + { + if (1!=fscanf(progFile,"%i",&count)) + { + cmSystemTools::Message("Could not read from progress file."); + } + fclose(progFile); + } + const char* last = num.c_str(); + for(const char* c = last;; ++c) + { + if (*c == ',' || *c == '\0') + { + if (c != last) + { + fName = dirName; + fName += "/"; + fName.append(last, c-last); + progFile = cmsys::SystemTools::Fopen(fName,"w"); + if (progFile) + { + fprintf(progFile,"empty"); + fclose(progFile); + } + } + if(*c == '\0') + { + break; + } + last = c + 1; + } + } + int fileNum = static_cast + (cmsys::Directory::GetNumberOfFilesInDirectory(dirName)); + if (count > 0) + { + // print the progress + fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count); + } +} + //---------------------------------------------------------------------------- int cmcmd::ExecuteEchoColor(std::vector& args) { @@ -996,6 +1016,7 @@ int cmcmd::ExecuteEchoColor(std::vector& args) bool enabled = true; int color = cmsysTerminal_Color_Normal; bool newline = true; + std::string progressDir; for(unsigned int i=2; i < args.size(); ++i) { if(args[i].find("--switch=") == 0) @@ -1014,6 +1035,18 @@ int cmcmd::ExecuteEchoColor(std::vector& args) } } } + else if(cmHasLiteralPrefix(args[i], "--progress-dir=")) + { + progressDir = args[i].substr(15); + } + else if(cmHasLiteralPrefix(args[i], "--progress-num=")) + { + if (!progressDir.empty()) + { + std::string const& progressNum = args[i].substr(15); + cmcmdProgressReport(progressDir, progressNum); + } + } else if(args[i] == "--normal") { color = cmsysTerminal_Color_Normal; From 9924486f8a979bf937c8fd7749aaf37c1bd762e1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 11:01:48 -0500 Subject: [PATCH 0014/1029] Xcode: Refactor generation of per-language compiler flags --- Source/cmGlobalXCodeGenerator.cxx | 140 +++++++++++++++--------------- 1 file changed, 69 insertions(+), 71 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cd0dcc6aa..7b2ac8e49 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1743,7 +1743,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, return; } - std::string flags; std::string defFlags; bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) || (target.GetType() == cmTarget::MODULE_LIBRARY)); @@ -1752,19 +1751,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, (target.GetType() == cmTarget::EXECUTABLE) || shared); - std::string lang = target.GetLinkerLanguage(configName); - std::string cflags; - if(!lang.empty()) + // Compute the compilation flags for each language. + std::set languages; + target.GetLanguages(languages, configName); + std::map cflags; + for (std::set::iterator li = languages.begin(); + li != languages.end(); ++li) { - // for c++ projects get the c flags as well - if(lang == "CXX") - { - this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName); - this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target, - "C", configName); - this->CurrentLocalGenerator-> - AddCompileOptions(cflags, &target, "C", configName); - } + std::string const& lang = *li; + std::string& flags = cflags[lang]; // Add language-specific flags. this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); @@ -1779,13 +1774,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CurrentLocalGenerator-> AddCompileOptions(flags, &target, lang, configName); } - else if(binary) - { + + std::string lang = target.GetLinkerLanguage(configName); + if(binary && lang.empty()) + { cmSystemTools::Error ("CMake can not determine linker language for target: ", target.GetName().c_str()); return; - } + } // Add define flags this->CurrentLocalGenerator-> @@ -2178,53 +2175,58 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, buildSettings->AddAttribute("HEADER_SEARCH_PATHS", dirs.CreateList()); } - std::string oflagc = this->ExtractFlag("-O", cflags); + + bool same_gflags = true; + std::map gflags; + std::string const* last_gflag = 0; char optLevel[2]; optLevel[0] = '0'; optLevel[1] = 0; - if(oflagc.size() == 3) + + // Minimal map of flags to build settings. + for (std::set::iterator li = languages.begin(); + li != languages.end(); ++li) { - optLevel[0] = oflagc[2]; - } - if(oflagc.size() == 2) - { - optLevel[0] = '1'; - } - std::string oflag = this->ExtractFlag("-O", flags); - if(oflag.size() == 3) - { - optLevel[0] = oflag[2]; - } - if(oflag.size() == 2) - { - optLevel[0] = '1'; - } - std::string gflagc = this->ExtractFlag("-g", cflags); - // put back gdwarf-2 if used since there is no way - // to represent it in the gui, but we still want debug yes - if(gflagc == "-gdwarf-2") - { - cflags += " "; - cflags += gflagc; - } - std::string gflag = this->ExtractFlag("-g", flags); - if(gflag == "-gdwarf-2") - { - flags += " "; - flags += gflag; + std::string& flags = cflags[*li]; + std::string& gflag = gflags[*li]; + std::string oflag = this->ExtractFlag("-O", flags); + if(oflag.size() == 3) + { + optLevel[0] = oflag[2]; + } + if(oflag.size() == 2) + { + optLevel[0] = '1'; + } + gflag = this->ExtractFlag("-g", flags); + // put back gdwarf-2 if used since there is no way + // to represent it in the gui, but we still want debug yes + if(gflag == "-gdwarf-2") + { + flags += " "; + flags += gflag; + } + if (last_gflag && *last_gflag != gflag) + { + same_gflags = false; + } + last_gflag = &gflag; } + const char* debugStr = "YES"; - // We can't set the Xcode flag differently depending on the language, - // so put them back in this case. - if( (lang == "CXX") && gflag != gflagc ) + if (!same_gflags) { - cflags += " "; - cflags += gflagc; - flags += " "; - flags += gflag; + // We can't set the Xcode flag differently depending on the language, + // so put them back in this case. + for (std::set::iterator li = languages.begin(); + li != languages.end(); ++li) + { + cflags[*li] += " "; + cflags[*li] += gflags[*li]; + } debugStr = "NO"; } - if( gflag == "-g0" || gflag.size() == 0 ) + else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0")) { debugStr = "NO"; } @@ -2239,24 +2241,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString("NO")); buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN", this->CreateString("NO")); - if(lang == "CXX") + for (std::set::iterator li = languages.begin(); + li != languages.end(); ++li) { - flags += " "; - flags += defFlags; - buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", - this->CreateString(flags.c_str())); - cflags += " "; - cflags += defFlags; - buildSettings->AddAttribute("OTHER_CFLAGS", - this->CreateString(cflags.c_str())); - - } - else - { - flags += " "; - flags += defFlags; - buildSettings->AddAttribute("OTHER_CFLAGS", - this->CreateString(flags.c_str())); + std::string flags = cflags[*li] + " " + defFlags; + if (*li == "CXX") + { + buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", + this->CreateString(flags.c_str())); + } + else if (*li == "C") + { + buildSettings->AddAttribute("OTHER_CFLAGS", + this->CreateString(flags.c_str())); + } } // Add Fortran source format attribute if property is set. From de63ff489d25095e41deae724f499ea3df05b6cf Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 11:02:48 -0500 Subject: [PATCH 0015/1029] Xcode: Generate Intel Fortran compiler flags in project files --- Source/cmGlobalXCodeGenerator.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7b2ac8e49..063691061 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2250,6 +2250,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", this->CreateString(flags.c_str())); } + else if (*li == "Fortran") + { + buildSettings->AddAttribute("IFORT_OTHER_FLAGS", + this->CreateString(flags.c_str())); + } else if (*li == "C") { buildSettings->AddAttribute("OTHER_CFLAGS", From d2fe4c420370727c644432549b7a5ca9dfef3a28 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 10:31:08 -0500 Subject: [PATCH 0016/1029] cmGlobalXCodeGenerator: Rename variable 'lang' => 'llang' In CreateBuildSettings the variable holds the linker language. Use a more distinctive variable name. --- Source/cmGlobalXCodeGenerator.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 063691061..30ed13462 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1775,8 +1775,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, AddCompileOptions(flags, &target, lang, configName); } - std::string lang = target.GetLinkerLanguage(configName); - if(binary && lang.empty()) + std::string llang = target.GetLinkerLanguage(configName); + if(binary && llang.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -2001,7 +2001,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // in many ways as an application bundle, as far as // link flags go std::string createFlags = - this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS", + this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle"); if(!createFlags.empty()) { @@ -2029,7 +2029,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString("NO")); // Add the flags to create an executable. std::string createFlags = - this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", ""); + this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if(!createFlags.empty()) { extraLinkOptions += " "; @@ -2040,7 +2040,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { // Add the flags to create a module. std::string createFlags = - this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS", + this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle"); if(!createFlags.empty()) { @@ -2074,7 +2074,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { // Add the flags to create a shared library. std::string createFlags = - this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", lang, "_FLAGS", + this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS", "-dynamiclib"); if(!createFlags.empty()) { @@ -2091,7 +2091,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { // Add the flags to create an executable. std::string createFlags = - this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", ""); + this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if(!createFlags.empty()) { extraLinkOptions += " "; From d59913f001b6eb74f9baf8bad183dc83d5e7bcd1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 15:59:03 +0100 Subject: [PATCH 0017/1029] Take computation out of loop. --- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fbf214036..13c47c5cf 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2393,11 +2393,13 @@ void cmLocalUnixMakefileGenerator3 // On UNIX we must construct a single shell command to change // directory and build because make resets the directory between // each command. + std::string outputForExisting = + this->ConvertToOutputForExisting(tgtDir, relRetDir); std::vector::iterator i = commands.begin(); for (; i != commands.end(); ++i) { std::string cmd = cd_cmd; - cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); + cmd += outputForExisting; cmd += " && "; cmd += *i; *i = cmd; From d46c4f0727acb35963dfda579cd5c9efd63aab01 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:07:27 +0100 Subject: [PATCH 0018/1029] Extract a prefix variable from loop. --- Source/cmLocalUnixMakefileGenerator3.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 13c47c5cf..9a2186b58 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2395,14 +2395,11 @@ void cmLocalUnixMakefileGenerator3 // each command. std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir, relRetDir); + std::string prefix = cd_cmd + outputForExisting + " && "; std::vector::iterator i = commands.begin(); for (; i != commands.end(); ++i) { - std::string cmd = cd_cmd; - cmd += outputForExisting; - cmd += " && "; - cmd += *i; - *i = cmd; + *i = prefix + *i; } } } From a7fcc148bdfa5e9f2c6901b0de8192f5aa043741 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 16:01:54 +0100 Subject: [PATCH 0019/1029] Convert loop to algorithm. --- Source/cmLocalUnixMakefileGenerator3.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9a2186b58..785d0caaa 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2396,10 +2396,7 @@ void cmLocalUnixMakefileGenerator3 std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir, relRetDir); std::string prefix = cd_cmd + outputForExisting + " && "; - std::vector::iterator i = commands.begin(); - for (; i != commands.end(); ++i) - { - *i = prefix + *i; - } + std::transform(commands.begin(), commands.end(), commands.begin(), + std::bind1st(std::plus(), prefix)); } } From 39622c995c189b4e22dfdc0e9aa29c8fce5eac17 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 24 Jan 2015 18:18:56 +0100 Subject: [PATCH 0020/1029] Convert while loop to member insert. --- Source/cmAddLibraryCommand.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index db2f6fb0e..edf82bdbc 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -435,11 +435,7 @@ bool cmAddLibraryCommand cmSystemTools::Message(msg.c_str() ,"Warning"); } - while (s != args.end()) - { - srclists.push_back(*s); - ++s; - } + srclists.insert(srclists.end(), s, args.end()); this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll); From 71d47115d009983665d6db4b25ea0ef40464f365 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 24 Jan 2015 18:21:56 +0100 Subject: [PATCH 0021/1029] Use insert member instead of back_inserter. --- Source/cmTarget.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 98cb75c81..ef42b38d6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5919,8 +5919,7 @@ cmTarget::GetCompatibleInterfaces(std::string const& config) const { \ std::vector props; \ cmSystemTools::ExpandListArgument(prop, props); \ - std::copy(props.begin(), props.end(), \ - std::inserter(compat.Props##x, compat.Props##x.begin())); \ + compat.Props##x.insert(props.begin(), props.end()); \ } CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool) CM_READ_COMPATIBLE_INTERFACE(STRING, String) From 74c4d9d27aece9a619eaab330ad23cf4b0de2b19 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:35:26 +0100 Subject: [PATCH 0022/1029] Take a size check outside of an inner loop. --- Source/cmSetTargetPropertiesCommand.cxx | 10 +++++----- Source/cmSetTestsPropertiesCommand.cxx | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index aeb8077f7..9a7fab2b6 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -35,15 +35,15 @@ bool cmSetTargetPropertiesCommand doingFiles = false; // now loop through the rest of the arguments, new style ++j; + if (std::distance(j, args.end()) % 2 != 0) + { + this->SetError("called with incorrect number of arguments."); + return false; + } while (j != args.end()) { propertyPairs.push_back(*j); ++j; - if(j == args.end()) - { - this->SetError("called with incorrect number of arguments."); - return false; - } propertyPairs.push_back(*j); ++j; } diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index e66d13d4c..032c78ea7 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -36,15 +36,15 @@ bool cmSetTestsPropertiesCommand doingFiles = false; // now loop through the rest of the arguments, new style ++j; + if (std::distance(j, args.end()) % 2 != 0) + { + this->SetError("called with incorrect number of arguments."); + return false; + } while (j != args.end()) { propertyPairs.push_back(*j); ++j; - if(j == args.end()) - { - this->SetError("called with incorrect number of arguments."); - return false; - } propertyPairs.push_back(*j); ++j; } From 63f584b618b3381ad93c901f691191acd48329a7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:36:59 +0100 Subject: [PATCH 0023/1029] Replace while loop with member insert. --- Source/cmSetTargetPropertiesCommand.cxx | 9 +-------- Source/cmSetTestsPropertiesCommand.cxx | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index 9a7fab2b6..e41a0ca35 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -40,14 +40,7 @@ bool cmSetTargetPropertiesCommand this->SetError("called with incorrect number of arguments."); return false; } - while (j != args.end()) - { - propertyPairs.push_back(*j); - ++j; - propertyPairs.push_back(*j); - ++j; - } - // break out of the loop because j is already == end + propertyPairs.insert(propertyPairs.end(), j, args.end()); break; } else if (doingFiles) diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 032c78ea7..d079a19a4 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -41,14 +41,7 @@ bool cmSetTestsPropertiesCommand this->SetError("called with incorrect number of arguments."); return false; } - while (j != args.end()) - { - propertyPairs.push_back(*j); - ++j; - propertyPairs.push_back(*j); - ++j; - } - // break out of the loop because j is already == end + propertyPairs.insert(propertyPairs.end(), j, args.end()); break; } else if (doingFiles) From 683fafea088c26658283da3bdf05277aaa1a3cee Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 16:01:07 +0100 Subject: [PATCH 0024/1029] Replace a loop with std::transform. --- Source/cmake.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 652e45105..875dbbd55 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2731,11 +2731,10 @@ std::vector const& cmake::GetDebugConfigs() { // Expand the specified list and convert to upper-case. cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); - for(std::vector::iterator i = this->DebugConfigs.begin(); - i != this->DebugConfigs.end(); ++i) - { - *i = cmSystemTools::UpperCase(*i); - } + std::transform(this->DebugConfigs.begin(), + this->DebugConfigs.end(), + this->DebugConfigs.begin(), + cmSystemTools::UpperCase); } // If no configurations were specified, use a default list. if(this->DebugConfigs.empty()) From 69dbe51b08bd6b4564d031d78034633f55ed4593 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 16:02:46 +0100 Subject: [PATCH 0025/1029] Replace loop with algorithm. --- Source/cmTarget.cxx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ef42b38d6..f0bdea7d6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1153,15 +1153,11 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType( // Check if any entry in the list matches this configuration. std::string configUpper = cmSystemTools::UpperCase(config); - for(std::vector::const_iterator i = debugConfigs.begin(); - i != debugConfigs.end(); ++i) + if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) != + debugConfigs.end()) { - if(*i == configUpper) - { - return cmTarget::DEBUG; - } + return cmTarget::DEBUG; } - // The current configuration is not a debug configuration. return cmTarget::OPTIMIZED; } From 94e993a0c170cf84da9ddb026dfec9d8d99304e0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 21:34:01 +0100 Subject: [PATCH 0026/1029] cmComputeLinkDepends: Remove temporary iterator copy. --- Source/cmComputeLinkDepends.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index fa1bbccea..86526905a 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -692,8 +692,7 @@ void cmComputeLinkDepends::CleanConstraintGraph() std::sort(i->begin(), i->end()); // Make the edge list unique. - EdgeList::iterator last = std::unique(i->begin(), i->end()); - i->erase(last, i->end()); + i->erase(std::unique(i->begin(), i->end()), i->end()); } } From 6cd2ee9524e501a4ef9dc481b469b91f8f022dc9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 22:09:17 +0100 Subject: [PATCH 0027/1029] Replace loop with member algorithm. --- Source/cmLocalGenerator.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9109db490..bd9cb2667 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3642,14 +3642,13 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const { // Many compilers do not support -DNAME(arg)=sdf so we disable it. bool function_style = false; - for(const char* c = define.c_str(); *c && *c != '='; ++c) + + std::string::size_type pos = define.find_first_of("(="); + if (pos != std::string::npos) { - if(*c == '(') - { - function_style = true; - break; - } + function_style = define[pos] == '('; } + if(function_style) { std::ostringstream e; From 11093a03e064e1b7ef2d5db28845b5da7b934806 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 22:13:45 +0100 Subject: [PATCH 0028/1029] Replace temporary bool by inlining warning condition. --- Source/cmLocalGenerator.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bd9cb2667..7afe05fa3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3641,24 +3641,20 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4() bool cmLocalGenerator::CheckDefinition(std::string const& define) const { // Many compilers do not support -DNAME(arg)=sdf so we disable it. - bool function_style = false; - std::string::size_type pos = define.find_first_of("(="); if (pos != std::string::npos) { - function_style = define[pos] == '('; - } - - if(function_style) - { - std::ostringstream e; - e << "WARNING: Function-style preprocessor definitions may not be " - << "passed on the compiler command line because many compilers " - << "do not support it.\n" - << "CMake is dropping a preprocessor definition: " << define << "\n" - << "Consider defining the macro in a (configured) header file.\n"; - cmSystemTools::Message(e.str().c_str()); - return false; + if (define[pos] == '(') + { + std::ostringstream e; + e << "WARNING: Function-style preprocessor definitions may not be " + << "passed on the compiler command line because many compilers " + << "do not support it.\n" + << "CMake is dropping a preprocessor definition: " << define << "\n" + << "Consider defining the macro in a (configured) header file.\n"; + cmSystemTools::Message(e.str().c_str()); + return false; + } } // Many compilers do not support # in the value so we disable it. From 803317aab622e4f12e7d342be5bbb4f16b088efd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 23:50:42 +0100 Subject: [PATCH 0029/1029] cmSystemTools: Early return if size makes later comparison false. --- Source/cmSystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index b07dd78b8..bb007ef88 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -366,6 +366,10 @@ bool cmSystemTools::IsInternallyOn(const char* val) return false; } std::basic_string v = val; + if (v.size() > 4) + { + return false; + } for(std::basic_string::iterator c = v.begin(); c != v.end(); c++) From d8639733a42149ca1402dcae427f2142ab0cf037 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 23:52:50 +0100 Subject: [PATCH 0030/1029] cmSystemTools: Remove unnecessary comparison. We already know the string is uppercase. --- Source/cmSystemTools.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index bb007ef88..d3ab36b84 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -376,7 +376,7 @@ bool cmSystemTools::IsInternallyOn(const char* val) { *c = static_cast(toupper(*c)); } - return (v == "I_ON" || v == "i_on"); + return v == "I_ON"; } bool cmSystemTools::IsOn(const char* val) From 5fea6898346f30119b7f5272033b0713aca4c389 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 12 Jan 2015 21:05:34 +0100 Subject: [PATCH 0031/1029] cmStandardIncludes: Remove some VS6 workarounds. Added in commit v2.6.0~2824 (COMP: Fix warnings in system headers on VS6., 2006-08-29), but no longer needed. --- Source/cmStandardIncludes.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 646300d57..99e18684b 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -22,7 +22,6 @@ #ifdef _MSC_VER #pragma warning ( disable : 4786 ) #pragma warning ( disable : 4503 ) -#pragma warning ( disable : 4512 ) /* operator=() could not be generated */ #endif @@ -42,11 +41,6 @@ # include #endif -// Avoid warnings in system headers. -#if defined(_MSC_VER) -# pragma warning (push,1) -#endif - #include #include #include @@ -63,10 +57,6 @@ #include #include -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - // include the "c" string header #include #include From e848cc5074c402fe38bb19c831f0b71dc34ece73 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 12 Jan 2015 21:11:16 +0100 Subject: [PATCH 0032/1029] cmStandardIncludes: Remove deque include. Include it only where used. --- Source/CTest/cmCTestBuildHandler.h | 2 ++ Source/cmMakefile.h | 1 + Source/cmStandardIncludes.h | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index 09346f949..d13d5cf35 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -19,6 +19,8 @@ #include +#include + class cmMakefile; /** \class cmCTestBuildHandler diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index bff8c1288..110db245c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -35,6 +35,7 @@ #endif #include +#include class cmFunctionBlocker; class cmCommand; diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 99e18684b..180bd8dd5 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -55,7 +55,6 @@ #include #include #include -#include // include the "c" string header #include From af65da0aa97f20947f93ddcf9872d23d671f699b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 12 Jan 2015 21:17:55 +0100 Subject: [PATCH 0033/1029] cmStandardIncludes: Remove list include. Include it only where used. --- Source/CPack/cmCPackGenerator.cxx | 1 + Source/CTest/cmCTestGlobalVC.h | 2 ++ Source/CTest/cmCTestMultiProcessHandler.cxx | 1 + Source/CTest/cmCTestSVN.h | 2 ++ Source/cmCommands.h | 2 ++ Source/cmConditionEvaluator.h | 2 ++ Source/cmFileLockPool.h | 2 ++ Source/cmMakefile.cxx | 1 + Source/cmQtAutoGenerators.h | 2 ++ Source/cmStandardIncludes.h | 1 - Source/cmake.cxx | 2 ++ 11 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 1c670d20b..006239aac 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #if defined(__HAIKU__) #include diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index cb0d16560..29e0a61ec 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -14,6 +14,8 @@ #include "cmCTestVC.h" +#include + /** \class cmCTestGlobalVC * \brief Base class for handling globally-versioned trees * diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index f9e8a3cf8..f22312754 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -16,6 +16,7 @@ #include "cmSystemTools.h" #include #include +#include #include #include diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index c6548e3fb..17bf7cb6f 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -14,6 +14,8 @@ #include "cmCTestGlobalVC.h" +#include + /** \class cmCTestSVN * \brief Interaction with subversion command-line tool * diff --git a/Source/cmCommands.h b/Source/cmCommands.h index c56673fed..e90285386 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -13,6 +13,8 @@ #define cmCommands_h #include "cmStandardIncludes.h" +#include + class cmCommand; /** * Global function to return all compiled in commands. diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index 01624f92c..fcef23404 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -15,6 +15,8 @@ #include "cmCommand.h" #include "cmExpandedCommandArgument.h" +#include + class cmConditionEvaluator { public: diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h index baef3101f..f0614a37a 100644 --- a/Source/cmFileLockPool.h +++ b/Source/cmFileLockPool.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" +#include + class cmFileLockResult; class cmFileLock; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ba914e151..ff3e35da1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -38,6 +38,7 @@ #include #include +#include #include // for isspace #include diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 79fa5dfa8..f74e3c5b6 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -14,6 +14,8 @@ #ifndef cmQtAutoGenerators_h #define cmQtAutoGenerators_h +#include + class cmGlobalGenerator; class cmMakefile; diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 180bd8dd5..77b4f6298 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -53,7 +53,6 @@ #include #include #include -#include #include // include the "c" string header diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 652e45105..4b6af0afa 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -103,6 +103,8 @@ #include // struct stat +#include + static bool cmakeCheckStampFile(const char* stampName); static bool cmakeCheckStampList(const char* stampName); From c6ada8275b680e02f50a7aee1c02b0b184cadf83 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 16:39:00 -0500 Subject: [PATCH 0034/1029] Makefile: Print all color escape sequences before newline Ensure that the escape sequences do not leak across lines. --- Source/cmSystemTools.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ec3d846c3..f50d16c38 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2304,13 +2304,19 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message, if(enabled) { - cmsysTerminal_cfprintf(color | assumeTTY, stdout, "%s%s", - message, newline? "\n" : ""); + // Print with color. Delay the newline until later so that + // all color restore sequences appear before it. + cmsysTerminal_cfprintf(color | assumeTTY, stdout, "%s", message); } else { // Color is disabled. Print without color. - fprintf(stdout, "%s%s", message, newline? "\n" : ""); + fprintf(stdout, "%s", message); + } + + if(newline) + { + fprintf(stdout, "\n"); } } From 7bb50e4a31ad5a8a58fe60885014d431a887b27f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 19:07:24 -0500 Subject: [PATCH 0035/1029] Makefile: Add progress to link step messages --- Source/cmMakefileExecutableTargetGenerator.cxx | 6 +++++- Source/cmMakefileLibraryTargetGenerator.cxx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index d4036d29c..ab58cbdb7 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -171,15 +171,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) return; } + this->NumberOfProgressActions++; if(!this->NoRuleMessages) { + cmLocalUnixMakefileGenerator3::EchoProgress progress; + this->MakeEchoProgress(progress); // Add the link message. std::string buildEcho = "Linking "; buildEcho += linkLanguage; buildEcho += " executable "; buildEcho += targetOutPath; this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(), - cmLocalUnixMakefileGenerator3::EchoLink); + cmLocalUnixMakefileGenerator3::EchoLink, + &progress); } // Build a list of compiler flags and linker flags. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cdda36c52..84761cc73 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -341,8 +341,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->Convert(targetFullPathImport,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); + this->NumberOfProgressActions++; if(!this->NoRuleMessages) { + cmLocalUnixMakefileGenerator3::EchoProgress progress; + this->MakeEchoProgress(progress); // Add the link message. std::string buildEcho = "Linking "; buildEcho += linkLanguage; @@ -365,7 +368,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } buildEcho += targetOutPath.c_str(); this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(), - cmLocalUnixMakefileGenerator3::EchoLink); + cmLocalUnixMakefileGenerator3::EchoLink, + &progress); } const char* forbiddenFlagVar = 0; From ae775fe8041183030c69db1714c898b6e74f1284 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 19:07:56 -0500 Subject: [PATCH 0036/1029] Makefile: Change link step message color to bold green Avoid displaying red messages when no error has occurred. --- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c60a9c740..c4f7243c2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1367,7 +1367,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, color_name = "--green "; break; case EchoLink: - color_name = "--red --bold "; + color_name = "--green --bold "; break; case EchoGenerate: color_name = "--blue --bold "; From 63668954e002aa41ff0287aae22caeeacdc0c356 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 Feb 2015 19:16:45 -0500 Subject: [PATCH 0037/1029] Help: Add notes for topic 'makefile-progress-improvements' --- Help/release/dev/makefile-progress-improvements.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/makefile-progress-improvements.rst diff --git a/Help/release/dev/makefile-progress-improvements.rst b/Help/release/dev/makefile-progress-improvements.rst new file mode 100644 index 000000000..9cc970610 --- /dev/null +++ b/Help/release/dev/makefile-progress-improvements.rst @@ -0,0 +1,7 @@ +makefile-progress-improvements +------------------------------ + +* With Makefile generators, the build-time progress output has been improved. + It no longer mixes progress and build rule messages during parallel builds. + The link rule messages now have progress and are displayed as bold green + instead of bold red (since red is often associated with an error message). From 8b7e5e599616b6b805d87addc12050a6d6987429 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 7 Feb 2015 00:01:09 -0500 Subject: [PATCH 0038/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ee2953383..acb4882d0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150206) +set(CMake_VERSION_PATCH 20150207) #set(CMake_VERSION_RC 1) From d30036cfadb6f5ad927bf5f968f7e93472b50c45 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 8 Feb 2015 00:01:08 -0500 Subject: [PATCH 0039/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index acb4882d0..4747b4cfe 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150207) +set(CMake_VERSION_PATCH 20150208) #set(CMake_VERSION_RC 1) From 9bbfe76d2c899fdbb54eb92716aea7282d2f3cce Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 9 Feb 2015 00:01:09 -0500 Subject: [PATCH 0040/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4747b4cfe..6ac970523 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150208) +set(CMake_VERSION_PATCH 20150209) #set(CMake_VERSION_RC 1) From 220c427e84215b28ea1dd6de74e9dc6e81f7962e Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Mon, 9 Feb 2015 10:51:22 +0100 Subject: [PATCH 0041/1029] try_compile: Quote the content of CMAKE_MODULE_PATH to allow for spaces --- Source/cmCoreTryCompile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 5b5d6b69b..c4145536e 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -296,7 +296,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { - fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def); + fprintf(fout, "set(CMAKE_MODULE_PATH \"%s\")\n", def); } std::string projectLangs; From 1c3918ff0278715e2a4ec5929f75f7812003ee97 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 1 Feb 2015 17:38:59 +0100 Subject: [PATCH 0042/1029] RunCMake: Remove unneeded files. The default expectation of RunCMake tests is empty content, so there is no need to specify it. --- Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt | 1 - Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt | 1 - Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt | 1 - .../CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt | 1 - Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt | 1 - Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt | 1 - Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt | 1 - Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt | 1 - Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt | 1 - Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt | 1 - Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt | 1 - Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt | 1 - Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt | 1 - Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt | 1 - Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt | 1 - Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt | 1 - .../RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt | 1 - .../RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt | 1 - Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt | 1 - Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt | 1 - Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt | 1 - Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt | 1 - .../LinkImplementationFeatureCycleSolved-stderr.txt | 1 - Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt | 1 - Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt | 1 - Tests/RunCMake/File_Generate/GenerateSource-stderr.txt | 1 - .../File_Generate/OutputNameMatchesOtherSources-stderr.txt | 1 - Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt | 1 - Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt | 1 - .../GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt | 1 - Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt | 1 - .../LinkImplementationCycle3-stderr.txt | 1 - Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt | 1 - .../BinInInstallPrefix-CMP0052-OLD-stderr.txt | 1 - Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt | 1 - .../include_directories/InstallPrefixInInterface-stderr.txt | 1 - .../InstallToPrefixInSrcDirInSource-stderr.txt | 1 - .../InstallToPrefixInSrcDirOutOfSource-stderr.txt | 1 - .../SrcInInstallPrefix-CMP0052-OLD-stderr.txt | 1 - Tests/RunCMake/include_directories/export-NOWARN-stderr.txt | 1 - Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt | 1 - Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt | 1 - Tests/RunCMake/interface_library/genex_link-stderr.txt | 1 - Tests/RunCMake/interface_library/no_shared_libs-stderr.txt | 1 - Tests/RunCMake/message/nomessage-stderr.txt | 1 - Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt | 1 - Tests/RunCMake/project/CMP0048-NEW-stderr.txt | 1 - 57 files changed, 57 deletions(-) delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt delete mode 100644 Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt delete mode 100644 Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt delete mode 100644 Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt delete mode 100644 Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt delete mode 100644 Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt delete mode 100644 Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt delete mode 100644 Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt delete mode 100644 Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt delete mode 100644 Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt delete mode 100644 Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt delete mode 100644 Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt delete mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt delete mode 100644 Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt delete mode 100644 Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt delete mode 100644 Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt delete mode 100644 Tests/RunCMake/File_Generate/GenerateSource-stderr.txt delete mode 100644 Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt delete mode 100644 Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt delete mode 100644 Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt delete mode 100644 Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt delete mode 100644 Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt delete mode 100644 Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt delete mode 100644 Tests/RunCMake/include_directories/export-NOWARN-stderr.txt delete mode 100644 Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt delete mode 100644 Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/genex_link-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/no_shared_libs-stderr.txt delete mode 100644 Tests/RunCMake/message/nomessage-stderr.txt delete mode 100644 Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt delete mode 100644 Tests/RunCMake/project/CMP0048-NEW-stderr.txt diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0028/CMP0028-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0040/CMP0040-NEW-existing-target-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0043/CMP0043-NEW-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0029-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt b/Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/File_Generate/GenerateSource-stderr.txt b/Tests/RunCMake/File_Generate/GenerateSource-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/File_Generate/GenerateSource-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/File_Generate/WriteIfDifferent-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/LinkImplementationCycle3-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt b/Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/DirInInstallPrefix-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt b/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/include_directories/export-NOWARN-stderr.txt b/Tests/RunCMake/include_directories/export-NOWARN-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/include_directories/export-NOWARN-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/interface_library/genex_link-stderr.txt b/Tests/RunCMake/interface_library/genex_link-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/interface_library/genex_link-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt b/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/interface_library/no_shared_libs-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/message/nomessage-stderr.txt b/Tests/RunCMake/message/nomessage-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/message/nomessage-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt b/Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/no_install_prefix/with_install_prefix-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/project/CMP0048-NEW-stderr.txt b/Tests/RunCMake/project/CMP0048-NEW-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/project/CMP0048-NEW-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ From 68d29f519047aeef92a0ab8fef531010c311efaa Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 08:39:18 +0100 Subject: [PATCH 0043/1029] RunCMake: Allow specifying the directory to run tests in. --- Tests/RunCMake/CMakeLists.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 801655f81..2973fe913 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1,17 +1,28 @@ # See adjacent README.rst for documentation of this test infrastructure. macro(add_RunCMake_test test) + set(TEST_ARGS ${ARGN}) + if ("${ARGV1}" STREQUAL "TEST_DIR") + if ("${ARGV2}" STREQUAL "") + message(FATAL_ERROR "Invalid args") + endif() + set(Test_Dir ${ARGV2}) + list(REMOVE_AT TEST_ARGS 0) + list(REMOVE_AT TEST_ARGS 0) + else() + set(Test_Dir ${test}) + endif() add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} - -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} ${${test}_ARGS} - ${ARGN} - -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ${TEST_ARGS} + -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" ) endmacro() From c0d8e715915f65196353c09d86d4d34fe100437f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 08:41:06 +0100 Subject: [PATCH 0044/1029] RunCMake: Allow specifying the stderr file for a test. --- Tests/RunCMake/RunCMake.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 33b745dc8..6389ef4fb 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -18,7 +18,10 @@ function(run_cmake test) set(expect_result 0) endif() foreach(o out err) - if(EXISTS ${top_src}/${test}-std${o}.txt) + if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) + file(READ ${top_src}/${RunCMake-std${o}-file} expect_std${o}) + string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") + elseif(EXISTS ${top_src}/${test}-std${o}.txt) file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") else() From cc1520947608f5224a4fdfa94b5cb07e19e23600 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 30 Nov 2014 13:20:32 +0100 Subject: [PATCH 0045/1029] Tests: Split part of include_directories test to a generic location. The moved tests are related to paths in INTERFACE_INCLUDE_DIRECTORIES in general, and when exporting, and covering cases of the install location being within the build or source prefix etc. Other build properties containing paths should have similar tests, so this allows some parameterization while keeping the preparation of the various directory structures. --- Tests/RunCMake/CMakeLists.txt | 1 + .../BinInInstallPrefix-CMP0052-NEW-result.txt | 0 .../BinInInstallPrefix-CMP0052-NEW-stderr.txt | 2 +- .../BinInInstallPrefix-CMP0052-OLD-result.txt | 0 ...BinInInstallPrefix-CMP0052-WARN-result.txt | 0 ...BinInInstallPrefix-CMP0052-WARN-stderr.txt | 6 +- .../BinaryDirectoryInInterface-result.txt | 0 .../BinaryDirectoryInInterface-stderr.txt | 2 +- .../BinaryDirectoryInInterface.cmake | 0 Tests/RunCMake/IfacePaths/CMakeLists.txt | 6 + .../DirInInstallPrefix-result.txt | 0 .../DirInInstallPrefix.cmake | 0 .../InstallInBinDir-result.txt | 0 .../InstallInBinDir-stderr.txt | 2 +- .../InstallInSrcDir-result.txt | 0 .../InstallInSrcDir-stderr.txt | 2 +- .../InstallPrefixInInterface-result.txt | 0 .../InstallPrefixInInterface.cmake | 0 ...InstallToPrefixInSrcDirInSource-result.txt | 0 ...tallToPrefixInSrcDirOutOfSource-result.txt | 0 .../RelativePathInGenex-result.txt | 0 .../RelativePathInGenex-stderr.txt | 0 .../RelativePathInGenex.cmake | 0 .../RelativePathInInterface-result.txt | 0 .../RelativePathInInterface-stderr.txt | 0 .../RelativePathInInterface.cmake | 0 Tests/RunCMake/IfacePaths/RunCMakeTest.cmake | 143 ++++++++++++++++++ .../SourceDirectoryInInterface-result.txt | 0 .../SourceDirectoryInInterface-stderr.txt | 2 +- .../SourceDirectoryInInterface.cmake | 0 .../SrcInInstallPrefix-CMP0052-NEW-result.txt | 0 .../SrcInInstallPrefix-CMP0052-NEW-stderr.txt | 2 +- .../SrcInInstallPrefix-CMP0052-OLD-result.txt | 0 ...SrcInInstallPrefix-CMP0052-WARN-result.txt | 0 ...SrcInInstallPrefix-CMP0052-WARN-stderr.txt | 6 +- Tests/RunCMake/IfacePaths/empty.cpp | 0 .../export-NOWARN-result.txt | 0 .../export-NOWARN.cmake | 0 .../include_directories/CMakeLists.txt | 5 +- .../include_directories/RunCMakeTest.cmake | 141 ----------------- 40 files changed, 163 insertions(+), 157 deletions(-) rename Tests/RunCMake/{include_directories => IfacePaths}/BinInInstallPrefix-CMP0052-NEW-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinInInstallPrefix-CMP0052-NEW-stderr.txt (62%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinInInstallPrefix-CMP0052-OLD-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinInInstallPrefix-CMP0052-WARN-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinInInstallPrefix-CMP0052-WARN-stderr.txt (69%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinaryDirectoryInInterface-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinaryDirectoryInInterface-stderr.txt (67%) rename Tests/RunCMake/{include_directories => IfacePaths}/BinaryDirectoryInInterface.cmake (100%) create mode 100644 Tests/RunCMake/IfacePaths/CMakeLists.txt rename Tests/RunCMake/{include_directories => IfacePaths}/DirInInstallPrefix-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/DirInInstallPrefix.cmake (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallInBinDir-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallInBinDir-stderr.txt (68%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallInSrcDir-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallInSrcDir-stderr.txt (74%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallPrefixInInterface-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallPrefixInInterface.cmake (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallToPrefixInSrcDirInSource-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/InstallToPrefixInSrcDirOutOfSource-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/RelativePathInGenex-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/RelativePathInGenex-stderr.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/RelativePathInGenex.cmake (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/RelativePathInInterface-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/RelativePathInInterface-stderr.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/RelativePathInInterface.cmake (100%) create mode 100644 Tests/RunCMake/IfacePaths/RunCMakeTest.cmake rename Tests/RunCMake/{include_directories => IfacePaths}/SourceDirectoryInInterface-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/SourceDirectoryInInterface-stderr.txt (78%) rename Tests/RunCMake/{include_directories => IfacePaths}/SourceDirectoryInInterface.cmake (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/SrcInInstallPrefix-CMP0052-NEW-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/SrcInInstallPrefix-CMP0052-NEW-stderr.txt (72%) rename Tests/RunCMake/{include_directories => IfacePaths}/SrcInInstallPrefix-CMP0052-OLD-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/SrcInInstallPrefix-CMP0052-WARN-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/SrcInInstallPrefix-CMP0052-WARN-stderr.txt (75%) create mode 100644 Tests/RunCMake/IfacePaths/empty.cpp rename Tests/RunCMake/{include_directories => IfacePaths}/export-NOWARN-result.txt (100%) rename Tests/RunCMake/{include_directories => IfacePaths}/export-NOWARN.cmake (100%) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2973fe913..364573505 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -188,6 +188,7 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(IfacePaths) if(RPMBUILD) add_RunCMake_test(CPackRPM) diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-result.txt diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt similarity index 62% rename from Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt index f0adc9f39..09d225fb8 100644 --- a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" + ".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-result.txt diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-result.txt diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt similarity index 69% rename from Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt index 054bff595..6c3a122c5 100644 --- a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt @@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt: Directory: - ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" + ".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory of the install directory: - ".*Tests/RunCMake/include_directories/prefix" + ".*Tests/RunCMake/IfacePaths/prefix" however it is also a subdirectory of the build tree: - ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-WARN-build" + ".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-WARN-build" This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface-result.txt b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/BinaryDirectoryInInterface-result.txt rename to Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-result.txt diff --git a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt similarity index 67% rename from Tests/RunCMake/include_directories/BinaryDirectoryInInterface-stderr.txt rename to Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt index 0d4379eb0..cb2cba4d4 100644 --- a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface-stderr.txt +++ b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*RunCMake/include_directories/BinaryDirectoryInInterface-build/foo" + ".*RunCMake/IfacePaths/BinaryDirectoryInInterface-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake similarity index 100% rename from Tests/RunCMake/include_directories/BinaryDirectoryInInterface.cmake rename to Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake diff --git a/Tests/RunCMake/IfacePaths/CMakeLists.txt b/Tests/RunCMake/IfacePaths/CMakeLists.txt new file mode 100644 index 000000000..5cd4825e6 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +if(NOT TEST_FILE) + set(TEST_FILE ${RunCMake_TEST}.cmake) +endif() +include(${TEST_FILE}) diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix-result.txt b/Tests/RunCMake/IfacePaths/DirInInstallPrefix-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/DirInInstallPrefix-result.txt rename to Tests/RunCMake/IfacePaths/DirInInstallPrefix-result.txt diff --git a/Tests/RunCMake/include_directories/DirInInstallPrefix.cmake b/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake similarity index 100% rename from Tests/RunCMake/include_directories/DirInInstallPrefix.cmake rename to Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake diff --git a/Tests/RunCMake/include_directories/InstallInBinDir-result.txt b/Tests/RunCMake/IfacePaths/InstallInBinDir-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/InstallInBinDir-result.txt rename to Tests/RunCMake/IfacePaths/InstallInBinDir-result.txt diff --git a/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt similarity index 68% rename from Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt rename to Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt index 254fae15e..c71b37571 100644 --- a/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt +++ b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/include_directories/InstallInBinDir-build/foo" + ".*Tests/RunCMake/IfacePaths/InstallInBinDir-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt b/Tests/RunCMake/IfacePaths/InstallInSrcDir-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/InstallInSrcDir-result.txt rename to Tests/RunCMake/IfacePaths/InstallInSrcDir-result.txt diff --git a/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt similarity index 74% rename from Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt rename to Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt index 7be3044ad..526ef61bf 100644 --- a/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt +++ b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/include_directories/copy/foo" + ".*Tests/RunCMake/IfacePaths/copy/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt b/Tests/RunCMake/IfacePaths/InstallPrefixInInterface-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt rename to Tests/RunCMake/IfacePaths/InstallPrefixInInterface-result.txt diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake b/Tests/RunCMake/IfacePaths/InstallPrefixInInterface.cmake similarity index 100% rename from Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake rename to Tests/RunCMake/IfacePaths/InstallPrefixInInterface.cmake diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt b/Tests/RunCMake/IfacePaths/InstallToPrefixInSrcDirInSource-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt rename to Tests/RunCMake/IfacePaths/InstallToPrefixInSrcDirInSource-result.txt diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt b/Tests/RunCMake/IfacePaths/InstallToPrefixInSrcDirOutOfSource-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt rename to Tests/RunCMake/IfacePaths/InstallToPrefixInSrcDirOutOfSource-result.txt diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex-result.txt b/Tests/RunCMake/IfacePaths/RelativePathInGenex-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/RelativePathInGenex-result.txt rename to Tests/RunCMake/IfacePaths/RelativePathInGenex-result.txt diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex-stderr.txt b/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr.txt similarity index 100% rename from Tests/RunCMake/include_directories/RelativePathInGenex-stderr.txt rename to Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr.txt diff --git a/Tests/RunCMake/include_directories/RelativePathInGenex.cmake b/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake similarity index 100% rename from Tests/RunCMake/include_directories/RelativePathInGenex.cmake rename to Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake diff --git a/Tests/RunCMake/include_directories/RelativePathInInterface-result.txt b/Tests/RunCMake/IfacePaths/RelativePathInInterface-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/RelativePathInInterface-result.txt rename to Tests/RunCMake/IfacePaths/RelativePathInInterface-result.txt diff --git a/Tests/RunCMake/include_directories/RelativePathInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr.txt similarity index 100% rename from Tests/RunCMake/include_directories/RelativePathInInterface-stderr.txt rename to Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr.txt diff --git a/Tests/RunCMake/include_directories/RelativePathInInterface.cmake b/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake similarity index 100% rename from Tests/RunCMake/include_directories/RelativePathInInterface.cmake rename to Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake diff --git a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake new file mode 100644 index 000000000..4c9a7036e --- /dev/null +++ b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake @@ -0,0 +1,143 @@ +include(RunCMake) + +run_cmake(RelativePathInInterface) +run_cmake(RelativePathInGenex) +run_cmake(export-NOWARN) +run_cmake(SourceDirectoryInInterface) +run_cmake(BinaryDirectoryInInterface) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/DirInInstallPrefix/prefix") +run_cmake(DirInInstallPrefix) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/copy/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/copy/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" + "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" + COPYONLY +) +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" + ) +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") +run_cmake(InstallInSrcDir) +unset(RunCMake_TEST_SOURCE_DIR) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix" + "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" + ) +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build") +run_cmake(InstallInBinDir) +unset(RunCMake_TEST_BINARY_DIR) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/prefix/src/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/prefix/src/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" + "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" + COPYONLY +) + +foreach(policyStatus "" NEW OLD) + if (NOT "${policyStatus}" STREQUAL "") + set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) + else() + unset(policyOption) + set(policyStatus WARN) + endif() + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" + ) + # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run + # the test suite in-source properly. Otherwise the install directory would be + # a subdirectory or the source directory, which is allowed and tested separately + # below. + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") + run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) + unset(RunCMake_TEST_BINARY_DIR) + + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" + ) + run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) + unset(RunCMake_TEST_SOURCE_DIR) +endforeach() + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") +run_cmake(InstallPrefixInInterface) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/installToSrc/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/installToSrc/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" + "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" + COPYONLY +) +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" + ) +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc") +run_cmake(InstallToPrefixInSrcDirOutOfSource) +unset(RunCMake_TEST_SOURCE_DIR) + + +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc") +set(RunCMake_TEST_NO_CLEAN ON) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" + COPYONLY +) + +set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix" + "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" + ) +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") +run_cmake(InstallToPrefixInSrcDirInSource) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/include_directories/SourceDirectoryInInterface-result.txt b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/SourceDirectoryInInterface-result.txt rename to Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-result.txt diff --git a/Tests/RunCMake/include_directories/SourceDirectoryInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr.txt similarity index 78% rename from Tests/RunCMake/include_directories/SourceDirectoryInInterface-stderr.txt rename to Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr.txt index 9346b994f..97a94b15f 100644 --- a/Tests/RunCMake/include_directories/SourceDirectoryInInterface-stderr.txt +++ b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*RunCMake/include_directories/foo" + ".*RunCMake/IfacePaths/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake similarity index 100% rename from Tests/RunCMake/include_directories/SourceDirectoryInInterface.cmake rename to Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-result.txt diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt similarity index 72% rename from Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt index afa43e08d..ab95537bd 100644 --- a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/include_directories/prefix/src/foo" + ".*Tests/RunCMake/IfacePaths/prefix/src/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-result.txt diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-result.txt diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt similarity index 75% rename from Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt index 0b13fd899..23683e88c 100644 --- a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt @@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt: Directory: - ".*Tests/RunCMake/include_directories/prefix/src/foo" + ".*Tests/RunCMake/IfacePaths/prefix/src/foo" in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory of the install directory: - ".*Tests/RunCMake/include_directories/prefix" + ".*Tests/RunCMake/IfacePaths/prefix" however it is also a subdirectory of the source tree: - ".*Tests/RunCMake/include_directories/prefix/src" + ".*Tests/RunCMake/IfacePaths/prefix/src" This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/IfacePaths/empty.cpp b/Tests/RunCMake/IfacePaths/empty.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/include_directories/export-NOWARN-result.txt b/Tests/RunCMake/IfacePaths/export-NOWARN-result.txt similarity index 100% rename from Tests/RunCMake/include_directories/export-NOWARN-result.txt rename to Tests/RunCMake/IfacePaths/export-NOWARN-result.txt diff --git a/Tests/RunCMake/include_directories/export-NOWARN.cmake b/Tests/RunCMake/IfacePaths/export-NOWARN.cmake similarity index 100% rename from Tests/RunCMake/include_directories/export-NOWARN.cmake rename to Tests/RunCMake/IfacePaths/export-NOWARN.cmake diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt index 5cd4825e6..289710955 100644 --- a/Tests/RunCMake/include_directories/CMakeLists.txt +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -1,6 +1,3 @@ cmake_minimum_required(VERSION 3.0) project(${RunCMake_TEST} NONE) -if(NOT TEST_FILE) - set(TEST_FILE ${RunCMake_TEST}.cmake) -endif() -include(${TEST_FILE}) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index fa76f2435..3f624f850 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -3,148 +3,7 @@ include(RunCMake) run_cmake(NotFoundContent) run_cmake(DebugIncludes) run_cmake(TID-bad-target) -run_cmake(SourceDirectoryInInterface) -run_cmake(BinaryDirectoryInInterface) -run_cmake(RelativePathInInterface) run_cmake(ImportedTarget) -run_cmake(RelativePathInGenex) run_cmake(CMP0021) run_cmake(install_config) run_cmake(incomplete-genex) -run_cmake(export-NOWARN) - -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/DirInInstallPrefix/prefix") -run_cmake(DirInInstallPrefix) - -configure_file( - "${RunCMake_SOURCE_DIR}/CMakeLists.txt" - "${RunCMake_BINARY_DIR}/copy/CMakeLists.txt" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/empty.cpp" - "${RunCMake_BINARY_DIR}/copy/empty.cpp" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" - "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" - COPYONLY -) -set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix" - "-DTEST_FILE=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" - ) -set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") -run_cmake(InstallInSrcDir) -unset(RunCMake_TEST_SOURCE_DIR) - -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") -set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix" - "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" - ) -set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build") -run_cmake(InstallInBinDir) -unset(RunCMake_TEST_BINARY_DIR) - -configure_file( - "${RunCMake_SOURCE_DIR}/CMakeLists.txt" - "${RunCMake_BINARY_DIR}/prefix/src/CMakeLists.txt" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/empty.cpp" - "${RunCMake_BINARY_DIR}/prefix/src/empty.cpp" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" - "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" - COPYONLY -) - -foreach(policyStatus "" NEW OLD) - if (NOT "${policyStatus}" STREQUAL "") - set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) - else() - unset(policyOption) - set(policyStatus WARN) - endif() - set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} - "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" - ) - # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run - # the test suite in-source properly. Otherwise the install directory would be - # a subdirectory or the source directory, which is allowed and tested separately - # below. - set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") - run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) - unset(RunCMake_TEST_BINARY_DIR) - - set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} - "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" - ) - run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) - unset(RunCMake_TEST_SOURCE_DIR) -endforeach() - -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") -run_cmake(InstallPrefixInInterface) - -configure_file( - "${RunCMake_SOURCE_DIR}/CMakeLists.txt" - "${RunCMake_BINARY_DIR}/installToSrc/CMakeLists.txt" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/empty.cpp" - "${RunCMake_BINARY_DIR}/installToSrc/empty.cpp" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" - "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" - COPYONLY -) -set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix" - "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" - ) -set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc") -run_cmake(InstallToPrefixInSrcDirOutOfSource) -unset(RunCMake_TEST_SOURCE_DIR) - - -file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc") -set(RunCMake_TEST_NO_CLEAN ON) - -configure_file( - "${RunCMake_SOURCE_DIR}/CMakeLists.txt" - "${RunCMake_BINARY_DIR}/installToSrcInSrc/CMakeLists.txt" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/empty.cpp" - "${RunCMake_BINARY_DIR}/installToSrcInSrc/empty.cpp" - COPYONLY -) -configure_file( - "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" - "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" - COPYONLY -) - -set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix" - "-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" - ) -set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") -set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") -run_cmake(InstallToPrefixInSrcDirInSource) -unset(RunCMake_TEST_SOURCE_DIR) -unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_NO_CLEAN) From d9f8390db6ab0d776eb39b840a3b096b5422229f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 30 Nov 2014 13:42:00 +0100 Subject: [PATCH 0046/1029] Tests: Run IfacePaths tests with a parameter. Run the tests for the INCLUDE_DIRECTORIES INTERFACE property in a specific build location, and update the stderr expectation to match the new output. --- Tests/RunCMake/CMakeLists.txt | 4 ++- .../BinInInstallPrefix-CMP0052-NEW-stderr.txt | 2 +- ...BinInInstallPrefix-CMP0052-WARN-stderr.txt | 6 ++-- .../BinaryDirectoryInInterface-stderr.txt | 2 +- .../IfacePaths/InstallInBinDir-stderr.txt | 2 +- .../IfacePaths/InstallInSrcDir-stderr.txt | 2 +- Tests/RunCMake/IfacePaths/RunCMakeTest.cmake | 30 +++++++++++++------ .../SrcInInstallPrefix-CMP0052-NEW-stderr.txt | 2 +- ...SrcInInstallPrefix-CMP0052-WARN-stderr.txt | 6 ++-- 9 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 364573505..71507b8d2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -188,7 +188,9 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) -add_RunCMake_test(IfacePaths) + +set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) +add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) if(RPMBUILD) add_RunCMake_test(CPackRPM) diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt index 09d225fb8..f2d749b68 100644 --- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt index 6c3a122c5..3d838926c 100644 --- a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt @@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt: Directory: - ".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory of the install directory: - ".*Tests/RunCMake/IfacePaths/prefix" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix" however it is also a subdirectory of the build tree: - ".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-WARN-build" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-WARN-build" This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt index cb2cba4d4..ed7cd58e3 100644 --- a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt +++ b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*RunCMake/IfacePaths/BinaryDirectoryInInterface-build/foo" + ".*RunCMake/IfacePaths_INCLUDE_DIRECTORIES/BinaryDirectoryInInterface-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt index c71b37571..3d60831d1 100644 --- a/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt +++ b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/IfacePaths/InstallInBinDir-build/foo" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/InstallInBinDir-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt index 526ef61bf..11994ddb3 100644 --- a/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt +++ b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/IfacePaths/copy/foo" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/copy/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake index 4c9a7036e..8febf1805 100644 --- a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake +++ b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake @@ -1,5 +1,10 @@ include(RunCMake) +macro(run_cmake test) + list(APPEND RunCMake_TEST_OPTIONS -DTEST_PROP=${TEST_PROP}) + _run_cmake(${test}) +endmacro() + run_cmake(RelativePathInInterface) run_cmake(RelativePathInGenex) run_cmake(export-NOWARN) @@ -57,12 +62,15 @@ configure_file( COPYONLY ) -foreach(policyStatus "" NEW OLD) - if (NOT "${policyStatus}" STREQUAL "") - set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) - else() - unset(policyOption) - set(policyStatus WARN) +foreach(policyStatus NEW OLD "") + if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + if (NOT "${policyStatus}" STREQUAL "") + set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) + else() + unset(policyOption) + set(policyStatus WARN) + endif() + set(policySuffix -CMP0052-${policyStatus}) endif() set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} @@ -73,16 +81,20 @@ foreach(policyStatus "" NEW OLD) # a subdirectory or the source directory, which is allowed and tested separately # below. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") - run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix${policySuffix}-build") + run_cmake(BinInInstallPrefix${policySuffix}) unset(RunCMake_TEST_BINARY_DIR) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" ) - run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) + run_cmake(SrcInInstallPrefix${policySuffix}) unset(RunCMake_TEST_SOURCE_DIR) + + if (NOT TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + break() + endif() endforeach() set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt index ab95537bd..ed5df34a4 100644 --- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/IfacePaths/prefix/src/foo" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/src/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt index 23683e88c..cb5a51ccb 100644 --- a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt @@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt: Directory: - ".*Tests/RunCMake/IfacePaths/prefix/src/foo" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/src/foo" in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory of the install directory: - ".*Tests/RunCMake/IfacePaths/prefix" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix" however it is also a subdirectory of the source tree: - ".*Tests/RunCMake/IfacePaths/prefix/src" + ".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/src" This warning is for project developers. Use -Wno-dev to suppress it. From 7ab4fb5760a03cfcf1317351ebc75c7cfd91de96 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 10 Feb 2015 00:01:07 -0500 Subject: [PATCH 0047/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6ac970523..03df29dae 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150209) +set(CMake_VERSION_PATCH 20150210) #set(CMake_VERSION_RC 1) From e5ef9271a1bb1a0779132beba4cf2b0bae13d6cc Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 6 Feb 2015 12:21:51 -0800 Subject: [PATCH 0048/1029] FindRuby: Fix finding 64-bit Ruby on Windows Ruby 2.0.0 and 2.1.5 have 64-bit binaries for Windows, with "x64-" prefix. --- Modules/FindRuby.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 4be16c96f..e5ea210e1 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -234,11 +234,16 @@ if(WIN32) set( _RUBY_MSVC_RUNTIME "90" ) endif() + set(_RUBY_ARCH_PREFIX "") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_RUBY_ARCH_PREFIX "x64-") + endif() + list(APPEND _RUBY_POSSIBLE_LIB_NAMES - "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}" - "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static" - "msvcrt-ruby${_RUBY_NODOT_VERSION}" - "msvcrt-ruby${_RUBY_NODOT_VERSION}-static" ) + "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}" + "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static" + "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}" + "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}-static" ) endif() find_library(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} ) From f3e9eeedf43f783c02b2a2a10fc0e632eaf7cfd0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Feb 2015 10:21:55 -0500 Subject: [PATCH 0049/1029] try_compile: Use shorter test executable name with consistent length Since commit v2.8.8~176^2 (try_compile: Use random executable file name, 2012-02-13) the length of the test executable name in generated try_compile projects has been longer and unpredictable. With Visual Studio on windows, the tools try to create paths like: CMakeFiles/CMakeTmp/$tgt.dir/Debug/$tgt.tlog/$tgt.lastbuildstate With the target name repeated up to 3 times, we must make it short and of consistent length to avoid overrunning the 260 character limit imposed by VS tools. --- Source/cmCoreTryCompile.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index c4145536e..d9369e6e7 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -383,8 +383,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) /* Use a random file name to avoid rapid creation and deletion of the same executable name (some filesystems fail on that). */ - sprintf(targetNameBuf, "cmTryCompileExec%u", - cmSystemTools::RandomSeed()); + sprintf(targetNameBuf, "cmTC_%05x", + cmSystemTools::RandomSeed() & 0xFFFFF); targetName = targetNameBuf; if (!targets.empty()) From a27c13f4cad2247833d048ec5e334861943fd4d9 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Mon, 9 Feb 2015 20:09:41 +0300 Subject: [PATCH 0050/1029] BundleUtilities: Teach fixup_bundle to check install_name_tool result Fail explicitly if install_name_tool fails to make an update we need. --- Modules/BundleUtilities.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index fee0a7ca6..ce90f305c 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -776,7 +776,12 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # to install_name_tool: # if(changes) - execute_process(COMMAND install_name_tool ${changes} "${resolved_embedded_item}") + set(cmd install_name_tool ${changes} "${resolved_embedded_item}") + execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result) + if(NOT install_name_tool_result EQUAL 0) + string(REPLACE ";" "' '" msg "'${cmd}'") + message(FATAL_ERROR "Command failed:\n ${msg}") + endif() endif() endfunction() From ac26d4b343aece40b6b9a931ab619fc88d4b9492 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 21:50:16 +0100 Subject: [PATCH 0051/1029] Split cmAlgorithms into a separate header file. --- Source/CPack/cmCPackGeneratorFactory.cxx | 1 + Source/CTest/cmCTestGIT.cxx | 1 + Source/cmAlgorithms.h | 151 +++++++++++++++++++++++ Source/cmExportSet.cxx | 1 + Source/cmExportSetMap.cxx | 1 + Source/cmFileLockPool.cxx | 1 + Source/cmInstalledFile.h | 1 + Source/cmRST.cxx | 1 + Source/cmStandardIncludes.h | 134 -------------------- Source/cmSystemTools.cxx | 1 + Source/cmVariableWatch.cxx | 2 + 11 files changed, 161 insertions(+), 134 deletions(-) create mode 100644 Source/cmAlgorithms.h diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index a07c29aeb..46261427d 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -46,6 +46,7 @@ #endif #include "cmCPackLog.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 98bc9d7ad..6b84bab64 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -13,6 +13,7 @@ #include "cmCTest.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include "cmXMLSafe.h" #include diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h new file mode 100644 index 000000000..49381401d --- /dev/null +++ b/Source/cmAlgorithms.h @@ -0,0 +1,151 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Stephen Kelly + + 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. +============================================================================*/ +#ifndef cmAlgorithms_h +#define cmAlgorithms_h + +#include "cmStandardIncludes.h" + +inline bool cmHasLiteralPrefixImpl(const std::string &str1, + const char *str2, + size_t N) +{ + return strncmp(str1.c_str(), str2, N) == 0; +} + +inline bool cmHasLiteralPrefixImpl(const char* str1, + const char *str2, + size_t N) +{ + return strncmp(str1, str2, N) == 0; +} + +inline bool cmHasLiteralSuffixImpl(const std::string &str1, + const char *str2, + size_t N) +{ + size_t len = str1.size(); + return len >= N && strcmp(str1.c_str() + len - N, str2) == 0; +} + +inline bool cmHasLiteralSuffixImpl(const char* str1, + const char* str2, + size_t N) +{ + size_t len = strlen(str1); + return len >= N && strcmp(str1 + len - N, str2) == 0; +} + +template +const T* cmArrayBegin(const T (&a)[N]) { return a; } +template +const T* cmArrayEnd(const T (&a)[N]) { return a + N; } +template +size_t cmArraySize(const T (&)[N]) { return N; } + +template +bool cmHasLiteralPrefix(T str1, const char (&str2)[N]) +{ + return cmHasLiteralPrefixImpl(str1, str2, N - 1); +} + +template +bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) +{ + return cmHasLiteralSuffixImpl(str1, str2, N - 1); +} + +struct cmStrCmp { + cmStrCmp(const char *test) : m_test(test) {} + cmStrCmp(const std::string &test) : m_test(test) {} + + bool operator()(const std::string& input) const + { + return m_test == input; + } + + bool operator()(const char * input) const + { + return strcmp(input, m_test.c_str()) == 0; + } + +private: + const std::string m_test; +}; + +namespace ContainerAlgorithms { + +template +struct cmIsPair +{ + enum { value = false }; +}; + +template +struct cmIsPair > +{ + enum { value = true }; +}; + +template::value> +struct DefaultDeleter +{ + void operator()(typename Container::value_type value) { + delete value; + } +}; + +template +struct DefaultDeleter +{ + void operator()(typename Container::value_type value) { + delete value.second; + } +}; + +} + +template +void cmDeleteAll(Container const& c) +{ + std::for_each(c.begin(), c.end(), + ContainerAlgorithms::DefaultDeleter()); +} + +template +std::string cmJoin(Range const& r, const char* delimiter) +{ + if (r.empty()) + { + return std::string(); + } + std::ostringstream os; + typedef typename Range::value_type ValueType; + typedef typename Range::const_iterator InputIt; + InputIt first = r.begin(); + InputIt last = r.end(); + --last; + std::copy(first, last, + std::ostream_iterator(os, delimiter)); + + os << *last; + + return os.str(); +} + +template +std::string cmJoin(Range const& r, std::string delimiter) +{ + return cmJoin(r, delimiter.c_str()); +}; + +#endif diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx index 14812e402..4148fb50b 100644 --- a/Source/cmExportSet.cxx +++ b/Source/cmExportSet.cxx @@ -12,6 +12,7 @@ #include "cmExportSet.h" #include "cmTargetExport.h" +#include "cmAlgorithms.h" cmExportSet::~cmExportSet() { diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx index 14c445891..cf431c60c 100644 --- a/Source/cmExportSetMap.cxx +++ b/Source/cmExportSetMap.cxx @@ -12,6 +12,7 @@ #include "cmExportSetMap.h" #include "cmExportSet.h" +#include "cmAlgorithms.h" cmExportSet* cmExportSetMap::operator[](const std::string &name) { diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx index cf8e9a9d1..3710eb030 100644 --- a/Source/cmFileLockPool.cxx +++ b/Source/cmFileLockPool.cxx @@ -16,6 +16,7 @@ #include "cmFileLock.h" #include "cmFileLockResult.h" +#include "cmAlgorithms.h" cmFileLockPool::cmFileLockPool() { diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index 503f92c10..cdb0866b4 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -13,6 +13,7 @@ #define cmInstalledFile_h #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" /** \class cmInstalledFile * \brief Represents a file intended for installation. diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index f4607c665..d20d99962 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -12,6 +12,7 @@ #include "cmRST.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include "cmVersion.h" #include #include diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 77b4f6298..a9796b975 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -131,138 +131,4 @@ static thisClass* SafeDownCast(cmObject *c) \ } \ class cmTypeMacro_UseTrailingSemicolon -template -std::string cmJoin(Range const& r, const char* delimiter) -{ - if (r.empty()) - { - return std::string(); - } - std::ostringstream os; - typedef typename Range::value_type ValueType; - typedef typename Range::const_iterator InputIt; - InputIt first = r.begin(); - InputIt last = r.end(); - --last; - std::copy(first, last, - std::ostream_iterator(os, delimiter)); - - os << *last; - - return os.str(); -} - -template -std::string cmJoin(Range const& r, std::string delimiter) -{ - return cmJoin(r, delimiter.c_str()); -}; - -inline bool cmHasLiteralPrefixImpl(const std::string &str1, - const char *str2, - size_t N) -{ - return strncmp(str1.c_str(), str2, N) == 0; -} - -inline bool cmHasLiteralPrefixImpl(const char* str1, - const char *str2, - size_t N) -{ - return strncmp(str1, str2, N) == 0; -} - -inline bool cmHasLiteralSuffixImpl(const std::string &str1, - const char *str2, - size_t N) -{ - size_t len = str1.size(); - return len >= N && strcmp(str1.c_str() + len - N, str2) == 0; -} - -inline bool cmHasLiteralSuffixImpl(const char* str1, - const char* str2, - size_t N) -{ - size_t len = strlen(str1); - return len >= N && strcmp(str1 + len - N, str2) == 0; -} - -template -const T* cmArrayBegin(const T (&a)[N]) { return a; } -template -const T* cmArrayEnd(const T (&a)[N]) { return a + N; } -template -size_t cmArraySize(const T (&)[N]) { return N; } - -template -bool cmHasLiteralPrefix(T str1, const char (&str2)[N]) -{ - return cmHasLiteralPrefixImpl(str1, str2, N - 1); -} - -template -bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) -{ - return cmHasLiteralSuffixImpl(str1, str2, N - 1); -} - -struct cmStrCmp { - cmStrCmp(const char *test) : m_test(test) {} - cmStrCmp(const std::string &test) : m_test(test) {} - - bool operator()(const std::string& input) const - { - return m_test == input; - } - - bool operator()(const char * input) const - { - return strcmp(input, m_test.c_str()) == 0; - } - -private: - const std::string m_test; -}; - -namespace ContainerAlgorithms { - -template -struct cmIsPair -{ - enum { value = false }; -}; - -template -struct cmIsPair > -{ - enum { value = true }; -}; - -template::value> -struct DefaultDeleter -{ - void operator()(typename Container::value_type value) { - delete value; - } -}; - -template -struct DefaultDeleter -{ - void operator()(typename Container::value_type value) { - delete value.second; - } -}; - -} - -template -void cmDeleteAll(Container const& c) -{ - std::for_each(c.begin(), c.end(), - ContainerAlgorithms::DefaultDeleter()); -} - #endif diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7dd6121df..bf496e948 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index b8a6df2e0..57dde3139 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmVariableWatch.h" +#include "cmAlgorithms.h" + static const char* const cmVariableWatchAccessStrings[] = { "READ_ACCESS", From 736bcb9664b714b91e8a2a573451e0453716f4da Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 30 Nov 2014 13:54:18 +0100 Subject: [PATCH 0052/1029] Tests: Move IfacePaths test stderr files. Rename the files with a property-specific name, so that additional properties can be easily tested. --- ...inInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...nInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...=> BinaryDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...stderr.txt => InstallInBinDir-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...stderr.txt => InstallInSrcDir-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...rr.txt => RelativePathInGenex-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...xt => RelativePathInInterface-stderr_INCLUDE_DIRECTORIES.txt} | 0 Tests/RunCMake/IfacePaths/RunCMakeTest.cmake | 1 + ...=> SourceDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...rcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt} | 0 ...cInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt} | 0 11 files changed, 1 insertion(+) rename Tests/RunCMake/IfacePaths/{BinInInstallPrefix-CMP0052-NEW-stderr.txt => BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{BinInInstallPrefix-CMP0052-WARN-stderr.txt => BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{BinaryDirectoryInInterface-stderr.txt => BinaryDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{InstallInBinDir-stderr.txt => InstallInBinDir-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{InstallInSrcDir-stderr.txt => InstallInSrcDir-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{RelativePathInGenex-stderr.txt => RelativePathInGenex-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{RelativePathInInterface-stderr.txt => RelativePathInInterface-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{SourceDirectoryInInterface-stderr.txt => SourceDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{SrcInInstallPrefix-CMP0052-NEW-stderr.txt => SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt} (100%) rename Tests/RunCMake/IfacePaths/{SrcInInstallPrefix-CMP0052-WARN-stderr.txt => SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt} (100%) diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr.txt rename to Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/InstallInBinDir-stderr.txt rename to Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr.txt rename to Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr.txt b/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr.txt rename to Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr.txt rename to Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake index 8febf1805..489e3dfbf 100644 --- a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake +++ b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) macro(run_cmake test) list(APPEND RunCMake_TEST_OPTIONS -DTEST_PROP=${TEST_PROP}) + set(RunCMake-stderr-file ${test}-stderr_${TEST_PROP}.txt) _run_cmake(${test}) endmacro() diff --git a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr.txt b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr.txt rename to Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt rename to Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt From 6da65b3907419df28484c570f24d0da3593a0e5a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 28 Nov 2014 18:58:38 +0100 Subject: [PATCH 0053/1029] Allow export of targets with INTERFACE_SOURCES. Use the same rules for paths in source and binary dirs in installed INTERFACE_SOURCES as are used for INTERFACE_INCLUDE_DIRECTORIES. --- Help/command/target_sources.rst | 4 - Help/prop_tgt/INTERFACE_SOURCES.rst | 4 - Source/cmExportBuildFileGenerator.cxx | 13 +- Source/cmExportFileGenerator.cxx | 136 ++++++++++++------ Source/cmExportFileGenerator.h | 5 + Source/cmExportInstallFileGenerator.cxx | 28 ++-- .../Export/Interface/CMakeLists.txt | 12 +- .../Export/Interface/source_target.cpp | 13 ++ .../Interface/source_target_for_install.cpp | 13 ++ .../Import/Interface/CMakeLists.txt | 8 ++ .../Import/Interface/source_target_test.cpp | 7 + Tests/RunCMake/CMakeLists.txt | 3 + .../BinInInstallPrefix-result.txt} | 0 .../BinInInstallPrefix-stderr_SOURCES.txt | 6 + ...aryDirectoryInInterface-stderr_SOURCES.txt | 6 + .../BinaryDirectoryInInterface.cmake | 6 +- .../IfacePaths/DirInInstallPrefix.cmake | 7 +- .../InstallInBinDir-stderr_SOURCES.txt | 6 + .../InstallInSrcDir-stderr_SOURCES.txt | 6 + .../RelativePathInGenex-stderr_SOURCES.txt | 4 + .../IfacePaths/RelativePathInGenex.cmake | 7 +- ...RelativePathInInterface-stderr_SOURCES.txt | 4 + .../IfacePaths/RelativePathInInterface.cmake | 7 +- ...rceDirectoryInInterface-stderr_SOURCES.txt | 6 + .../SourceDirectoryInInterface.cmake | 6 +- .../IfacePaths/SrcInInstallPrefix-result.txt | 1 + .../SrcInInstallPrefix-stderr_SOURCES.txt | 6 + Tests/RunCMake/IfacePaths/export-NOWARN.cmake | 15 ++ .../TargetSources/ExportBuild-result.txt | 2 +- .../TargetSources/ExportBuild-stderr.txt | 1 - .../TargetSources/ExportInstall-stderr.txt | 1 - .../TargetSources/ExportInstall.cmake | 6 - .../RunCMake/TargetSources/RunCMakeTest.cmake | 1 - 33 files changed, 260 insertions(+), 90 deletions(-) create mode 100644 Tests/ExportImport/Export/Interface/source_target.cpp create mode 100644 Tests/ExportImport/Export/Interface/source_target_for_install.cpp create mode 100644 Tests/ExportImport/Import/Interface/source_target_test.cpp rename Tests/RunCMake/{TargetSources/ExportInstall-result.txt => IfacePaths/BinInInstallPrefix-result.txt} (100%) create mode 100644 Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt create mode 100644 Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt create mode 100644 Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt delete mode 100644 Tests/RunCMake/TargetSources/ExportBuild-stderr.txt delete mode 100644 Tests/RunCMake/TargetSources/ExportInstall-stderr.txt delete mode 100644 Tests/RunCMake/TargetSources/ExportInstall.cmake diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index 832240ade..d6f148d23 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -22,10 +22,6 @@ items will populate the :prop_tgt:`SOURCES` property of following arguments specify sources. Repeated calls for the same ```` append items in the order called. -Targets with :prop_tgt:`INTERFACE_SOURCES` may not be exported with the -:command:`export` or :command:`install(EXPORT)` commands. This limitation may be -lifted in a future version of CMake. - Arguments to ``target_sources`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Help/prop_tgt/INTERFACE_SOURCES.rst b/Help/prop_tgt/INTERFACE_SOURCES.rst index 696ee9511..a224b6859 100644 --- a/Help/prop_tgt/INTERFACE_SOURCES.rst +++ b/Help/prop_tgt/INTERFACE_SOURCES.rst @@ -12,10 +12,6 @@ When target dependencies are specified using :command:`target_link_libraries`, CMake will read this property from all target dependencies to determine the sources of the consumer. -Targets with ``INTERFACE_SOURCES`` may not be exported with the -:command:`export` or :command:`install(EXPORT)` commands. This limitation may be -lifted in a future version of CMake. - Contents of ``INTERFACE_SOURCES`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index a28ec4833..b1203dd01 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -68,16 +68,6 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) tei != this->Exports.end(); ++tei) { cmTarget* te = *tei; - if (te->GetProperty("INTERFACE_SOURCES")) - { - std::ostringstream e; - e << "Target \"" - << te->GetName() - << "\" has a populated INTERFACE_SOURCES property. This is not " - "currently supported."; - cmSystemTools::Error(e.str().c_str()); - return false; - } this->GenerateImportTargetCode(os, te); te->AppendBuildInterfaceIncludes(); @@ -87,6 +77,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te, cmGeneratorExpression::BuildInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_SOURCES", te, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te, cmGeneratorExpression::BuildInterface, properties, missingTargets); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index af4ce8b7b..71728be26 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -224,7 +224,7 @@ static bool isSubDirectory(const char* a, const char* b) //---------------------------------------------------------------------------- static bool checkInterfaceDirs(const std::string &prepro, - cmTarget *target) + cmTarget *target, const std::string& prop) { const char* installDir = target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); @@ -250,20 +250,27 @@ static bool checkInterfaceDirs(const std::string &prepro, std::ostringstream e; if (genexPos != std::string::npos) { - switch (target->GetPolicyStatusCMP0041()) + if (prop == "INTERFACE_INCLUDE_DIRECTORIES") { - case cmPolicies::WARN: - messageType = cmake::WARNING; - e << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; - break; - case cmPolicies::OLD: - continue; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - hadFatalError = true; - break; // Issue fatal message. + switch (target->GetPolicyStatusCMP0041()) + { + case cmPolicies::WARN: + messageType = cmake::WARNING; + e << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; + break; + case cmPolicies::OLD: + continue; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + hadFatalError = true; + break; // Issue fatal message. + } + } + else + { + hadFatalError = true; } } if (cmHasLiteralPrefix(li->c_str(), "${_IMPORT_PREFIX}")) @@ -272,8 +279,8 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (!cmSystemTools::FileIsFullPath(li->c_str())) { - e << "Target \"" << target->GetName() << "\" " - "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n" + e << "Target \"" << target->GetName() << "\" " << prop << + " property contains relative path:\n" " \"" << *li << "\""; target->GetMakefile()->IssueMessage(messageType, e.str()); } @@ -289,32 +296,35 @@ static bool checkInterfaceDirs(const std::string &prepro, (!inBinary || isSubDirectory(installDir, topBinaryDir)) && (!inSource || isSubDirectory(installDir, topSourceDir)); - if (!shouldContinue) + if (prop == "INTERFACE_INCLUDE_DIRECTORIES") { - switch(target->GetPolicyStatusCMP0052()) + if (!shouldContinue) { - case cmPolicies::WARN: + switch(target->GetPolicyStatusCMP0052()) { - std::ostringstream s; - s << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; - s << "Directory:\n \"" << *li << "\"\nin " - "INTERFACE_INCLUDE_DIRECTORIES of target \"" - << target->GetName() << "\" is a subdirectory of the install " - "directory:\n \"" << installDir << "\"\nhowever it is also " - "a subdirectory of the " << (inBinary ? "build" : "source") - << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) - << "\"" << std::endl; - target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, - s.str()); + case cmPolicies::WARN: + { + std::ostringstream s; + s << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; + s << "Directory:\n \"" << *li << "\"\nin " + "INTERFACE_INCLUDE_DIRECTORIES of target \"" + << target->GetName() << "\" is a subdirectory of the install " + "directory:\n \"" << installDir << "\"\nhowever it is also " + "a subdirectory of the " << (inBinary ? "build" : "source") + << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) + << "\"" << std::endl; + target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, + s.str()); + } + case cmPolicies::OLD: + shouldContinue = true; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + break; } - case cmPolicies::OLD: - shouldContinue = true; - break; - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::NEW: - break; } } if (shouldContinue) @@ -324,8 +334,8 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (inBinary) { - e << "Target \"" << target->GetName() << "\" " - "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" + e << "Target \"" << target->GetName() << "\" " << prop << + " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; target->GetMakefile()->IssueMessage(messageType, e.str()); } @@ -333,8 +343,8 @@ static bool checkInterfaceDirs(const std::string &prepro, { if (inSource) { - e << "Target \"" << target->GetName() << "\" " - "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" + e << "Target \"" << target->GetName() << "\" " << prop << + " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the source directory."; target->GetMakefile()->IssueMessage(messageType, e.str()); } @@ -364,6 +374,46 @@ static void prefixItems(std::string &exportDirs) } } +//---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateSourcesInterface( + cmTargetExport *tei, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap &properties, + std::vector &missingTargets) +{ + cmTarget *target = tei->Target; + assert(preprocessRule == cmGeneratorExpression::InstallInterface); + + const char *propName = "INTERFACE_SOURCES"; + const char *input = target->GetProperty(propName); + + if (!input) + { + return; + } + + if (!*input) + { + properties[propName] = ""; + return; + } + + std::string prepro = cmGeneratorExpression::Preprocess(input, + preprocessRule, + true); + if (!prepro.empty()) + { + this->ResolveTargetsInGeneratorExpressions(prepro, target, + missingTargets); + + if (!checkInterfaceDirs(prepro, target, propName)) + { + return; + } + properties[propName] = prepro; + } +} + //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( cmTargetExport *tei, @@ -424,7 +474,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( this->ResolveTargetsInGeneratorExpressions(prepro, target, missingTargets); - if (!checkInterfaceDirs(prepro, target)) + if (!checkInterfaceDirs(prepro, target, propName)) { return; } diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 919924e0e..b6f4166db 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -139,6 +139,11 @@ protected: cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector &missingTargets); + void PopulateSourcesInterface( + cmTargetExport *target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap &properties, + std::vector &missingTargets); void SetImportLinkInterface(const std::string& config, std::string const& suffix, diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 98ed8184a..a0d90130f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -123,6 +123,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) bool require2_8_12 = false; bool require3_0_0 = false; + bool require3_1_0 = false; bool requiresConfigFiles = false; // Create all the imported targets. for(std::vector::const_iterator @@ -131,17 +132,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { cmTarget* te = (*tei)->Target; - if (te->GetProperty("INTERFACE_SOURCES")) - { - std::ostringstream e; - e << "Target \"" - << te->GetName() - << "\" has a populated INTERFACE_SOURCES property. This is not " - "currently supported."; - cmSystemTools::Error(e.str().c_str()); - return false; - } - requiresConfigFiles = requiresConfigFiles || te->GetType() != cmTarget::INTERFACE_LIBRARY; @@ -152,6 +142,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateIncludeDirectoriesInterface(*tei, cmGeneratorExpression::InstallInterface, properties, missingTargets); + this->PopulateSourcesInterface(*tei, + cmGeneratorExpression::InstallInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", te, cmGeneratorExpression::InstallInterface, @@ -190,6 +183,13 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { require3_0_0 = true; } + if(te->GetProperty("INTERFACE_SOURCES")) + { + // We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1 + // can consume them. + require3_1_0 = true; + } + this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); this->PopulateCompatibleInterfaceProperties(te, properties); @@ -197,7 +197,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateInterfaceProperties(te, os, properties); } - if (require3_0_0) + if (require3_1_0) + { + this->GenerateRequiredCMakeVersion(os, "3.1.0"); + } + else if (require3_0_0) { this->GenerateRequiredCMakeVersion(os, "3.0.0"); } diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 523fc298c..00a53756d 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -29,7 +29,17 @@ target_compile_features(use_auto_type INTERFACE cxx_auto_type) add_library(use_c_restrict INTERFACE) target_compile_features(use_c_restrict INTERFACE c_restrict) -install(TARGETS headeronly sharediface use_auto_type use_c_restrict +add_library(source_target INTERFACE) +target_sources(source_target INTERFACE + $ + $/src/source_target_for_install.cpp> +) +install(FILES + source_target_for_install.cpp + DESTINATION src +) + +install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target EXPORT expInterface ) install(TARGETS sharedlib diff --git a/Tests/ExportImport/Export/Interface/source_target.cpp b/Tests/ExportImport/Export/Interface/source_target.cpp new file mode 100644 index 000000000..037191cf6 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/source_target.cpp @@ -0,0 +1,13 @@ + +#ifndef USE_FROM_BUILD_DIR +#error Expected define USE_FROM_BUILD_DIR +#endif + +#ifdef USE_FROM_INSTALL_DIR +#error Unexpected define USE_FROM_INSTALL_DIR +#endif + +int source_symbol() +{ + return 42; +} diff --git a/Tests/ExportImport/Export/Interface/source_target_for_install.cpp b/Tests/ExportImport/Export/Interface/source_target_for_install.cpp new file mode 100644 index 000000000..64514edb2 --- /dev/null +++ b/Tests/ExportImport/Export/Interface/source_target_for_install.cpp @@ -0,0 +1,13 @@ + +#ifdef USE_FROM_BUILD_DIR +#error Unexpected define USE_FROM_BUILD_DIR +#endif + +#ifndef USE_FROM_INSTALL_DIR +#error Expected define USE_FROM_INSTALL_DIR +#endif + +int source_symbol() +{ + return 42; +} diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 4028405ae..51d518e99 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -82,6 +82,14 @@ endmacro() do_try_compile(bld) +add_executable(source_target_test_bld source_target_test.cpp) +target_link_libraries(source_target_test_bld bld::source_target) +target_compile_definitions(source_target_test_bld PRIVATE USE_FROM_BUILD_DIR) + +add_executable(source_target_test_exp source_target_test.cpp) +target_link_libraries(source_target_test_exp exp::source_target) +target_compile_definitions(source_target_test_exp PRIVATE USE_FROM_INSTALL_DIR) + add_executable(headeronlytest_exp headeronlytest.cpp) target_link_libraries(headeronlytest_exp exp::headeronly) diff --git a/Tests/ExportImport/Import/Interface/source_target_test.cpp b/Tests/ExportImport/Import/Interface/source_target_test.cpp new file mode 100644 index 000000000..0e8ec5f87 --- /dev/null +++ b/Tests/ExportImport/Import/Interface/source_target_test.cpp @@ -0,0 +1,7 @@ + +extern int source_symbol(); + +int main() +{ + return source_symbol() - 42; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 71507b8d2..2de82a7ce 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -192,6 +192,9 @@ add_RunCMake_test(ExternalProject) set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) +set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) +add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) + if(RPMBUILD) add_RunCMake_test(CPackRPM) endif() diff --git a/Tests/RunCMake/TargetSources/ExportInstall-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-result.txt similarity index 100% rename from Tests/RunCMake/TargetSources/ExportInstall-result.txt rename to Tests/RunCMake/IfacePaths/BinInInstallPrefix-result.txt diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt new file mode 100644 index 000000000..239c0698b --- /dev/null +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/prefix/BinInInstallPrefix-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt new file mode 100644 index 000000000..e931a0142 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/BinaryDirectoryInInterface-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake index 67ee7de84..7001f3f63 100644 --- a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake +++ b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake @@ -2,7 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/foo") +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake b/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake index fab771718..f5f30050e 100644 --- a/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake +++ b/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake @@ -1,6 +1,11 @@ enable_language(CXX) add_library(testTarget empty.cpp) -target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/dir") + +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/dir") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_INSTALL_PREFIX}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt new file mode 100644 index 000000000..c79d59828 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/InstallInBinDir-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt new file mode 100644 index 000000000..e71921e6c --- /dev/null +++ b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/copy/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt new file mode 100644 index 000000000..2311af9e3 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" contains relative path in its INTERFACE_SOURCES: + + "empty.cpp" diff --git a/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake b/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake index 070a381d2..489c3a1c1 100644 --- a/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake +++ b/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake @@ -2,7 +2,12 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") + +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "$<1:empty.cpp>") +endif() add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_link_libraries(userTarget testTarget) diff --git a/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt new file mode 100644 index 000000000..f0f002c7c --- /dev/null +++ b/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains relative path: + + "empty.cpp" diff --git a/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake b/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake index 4c4727d42..e974aaca1 100644 --- a/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake +++ b/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake @@ -2,8 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") - +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib ) diff --git a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt new file mode 100644 index 000000000..c5157ad3a --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake index f814a3ca3..d80cbec85 100644 --- a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake +++ b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake @@ -2,7 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/foo") +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt new file mode 100644 index 000000000..48f248584 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/prefix/src/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/export-NOWARN.cmake b/Tests/RunCMake/IfacePaths/export-NOWARN.cmake index 50720a0c8..592572cc2 100644 --- a/Tests/RunCMake/IfacePaths/export-NOWARN.cmake +++ b/Tests/RunCMake/IfacePaths/export-NOWARN.cmake @@ -1,19 +1,34 @@ enable_language(CXX) add_library(foo empty.cpp) + set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<0:>/include/subdir) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $/include/subdir) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<0:>/include/subdir/empty.cpp) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $/include/subdir/empty.cpp) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $/include/subdir>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $/include>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $/include/subdir/empty.cpp>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $/include/subdir/empty.cpp>) # target_include_directories(foo INTERFACE include/subdir) # Does and should warn. INSTALL_INTERFACE must not list src dir paths. target_include_directories(foo INTERFACE $<0:>/include/subdir) # Does not and should not should warn, because it starts with a genex. target_include_directories(foo INTERFACE $/include/subdir) +target_sources(foo INTERFACE $<0:>/include/subdir/empty.cpp) +target_sources(foo INTERFACE $/include/subdir/empty.cpp) target_include_directories(foo INTERFACE $) target_include_directories(foo INTERFACE $>) +target_sources(foo INTERFACE $) +target_sources(foo INTERFACE $>) + +install(FILES include/subdir/empty.cpp + DESTINATION include/subdir +) install(TARGETS foo EXPORT FooTargets DESTINATION lib) install(EXPORT FooTargets DESTINATION lib/cmake) diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/TargetSources/ExportBuild-result.txt index d00491fd7..573541ac9 100644 --- a/Tests/RunCMake/TargetSources/ExportBuild-result.txt +++ b/Tests/RunCMake/TargetSources/ExportBuild-result.txt @@ -1 +1 @@ -1 +0 diff --git a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt b/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt deleted file mode 100644 index 0d65a558b..000000000 --- a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported. diff --git a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt b/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt deleted file mode 100644 index 0d65a558b..000000000 --- a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported. diff --git a/Tests/RunCMake/TargetSources/ExportInstall.cmake b/Tests/RunCMake/TargetSources/ExportInstall.cmake deleted file mode 100644 index 8e7c9f93f..000000000 --- a/Tests/RunCMake/TargetSources/ExportInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ - -add_library(iface INTERFACE) -target_sources(iface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp") - -install(TARGETS iface EXPORT exp) -install(EXPORT exp DESTINATION cmake) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 1b4ef0bc1..4416ef9f2 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -10,4 +10,3 @@ endif() run_cmake(CMP0026-LOCATION) run_cmake(RelativePathInInterface) run_cmake(ExportBuild) -run_cmake(ExportInstall) From f7e33820b628f39ae2e0ba3d25279545dfe18f73 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 5 Feb 2015 20:40:51 +0100 Subject: [PATCH 0054/1029] Add release notes for export-interface-source-files. --- Help/release/dev/export-interface-source-files.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/export-interface-source-files.rst diff --git a/Help/release/dev/export-interface-source-files.rst b/Help/release/dev/export-interface-source-files.rst new file mode 100644 index 000000000..00dcd251c --- /dev/null +++ b/Help/release/dev/export-interface-source-files.rst @@ -0,0 +1,6 @@ +export-interface-source-files +----------------------------- + +* It is now possible to export targets which populate the + :prop_tgt:`INTERFACE_SOURCES` target property using the + :command:`install(EXPORT)` and :command:`export()` commands. From 197933018863c4845262dd6fb47e4edf721445f1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 11 Feb 2015 00:01:09 -0500 Subject: [PATCH 0055/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 03df29dae..62cc2b698 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150210) +set(CMake_VERSION_PATCH 20150211) #set(CMake_VERSION_RC 1) From bd6389f7bce6d69a75e6f84245834e19b24cc03f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Feb 2015 10:23:38 -0500 Subject: [PATCH 0056/1029] CMake 3.1.3 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7b2790131..d6a2437ae 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 1) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) From 9fe8f49353f927882af256c7870eb24e4be0c9be Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 00:29:20 +0100 Subject: [PATCH 0057/1029] cmMacroCommand: Replace a loop with cmJoin. --- Source/cmMacroCommand.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 69fcca710..e7c6a2939 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -262,11 +262,11 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, if (!this->Depth) { std::string name = this->Args[0]; - std::vector::size_type cc; name += "("; - for ( cc = 0; cc < this->Args.size(); cc ++ ) + if (!this->Args.empty()) { - name += " " + this->Args[cc]; + name += " "; + name += cmJoin(this->Args, " "); } name += " )"; mf.AddMacro(this->Args[0].c_str(), name.c_str()); From f95543f8a6b38bf6d5350169bdb53d5066839b76 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:42:12 +0100 Subject: [PATCH 0058/1029] cmMacroCommand: Extract iteration starting point. --- Source/cmMacroCommand.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index e7c6a2939..c1eb35e5f 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -164,9 +164,10 @@ bool cmMacroHelperCommand::InvokeInitialPass { if (!argnDefInitialized) { - std::vector::const_iterator eit; + std::vector::const_iterator eit + = expandedArgs.begin(); std::vector::size_type cnt = 0; - for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit) + for( ; eit != expandedArgs.end(); ++eit) { if ( cnt >= this->Args.size()-1 ) { From 11ecc31d0a2da0090195a682364fb4628f55673a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:44:49 +0100 Subject: [PATCH 0059/1029] cmMacroCommand: Execute loop only if it has an effect. --- Source/cmMacroCommand.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index c1eb35e5f..c1e7cbbc6 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -164,20 +164,23 @@ bool cmMacroHelperCommand::InvokeInitialPass { if (!argnDefInitialized) { - std::vector::const_iterator eit - = expandedArgs.begin(); - std::vector::size_type cnt = 0; - for( ; eit != expandedArgs.end(); ++eit) + if (expandedArgs.size() > this->Args.size() - 1) { - if ( cnt >= this->Args.size()-1 ) + std::vector::const_iterator eit + = expandedArgs.begin(); + std::vector::size_type cnt = 0; + for( ; eit != expandedArgs.end(); ++eit) { - if (!argnDef.empty()) + if ( cnt >= this->Args.size()-1 ) { - argnDef += ";"; + if (!argnDef.empty()) + { + argnDef += ";"; + } + argnDef += *eit; } - argnDef += *eit; + cnt ++; } - cnt ++; } argnDefInitialized = true; } From f99991db882c2f4cf8246b9c272845faaa5bbce5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Feb 2015 11:45:41 -0500 Subject: [PATCH 0060/1029] cmInstallGenerator: Move GetDestination to subclasses that need it The method is used only for EXPORT and TARGET install destinations. While at it, make it return a std::string by reference instead of a "const char*". --- Source/cmExportInstallFileGenerator.cxx | 8 ++++---- Source/cmInstallExportGenerator.h | 3 +++ Source/cmInstallGenerator.h | 3 --- Source/cmInstallTargetGenerator.h | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index a0d90130f..053c022fa 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -73,8 +73,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) // to reference if they are relative to the install prefix. std::string installPrefix = this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); - const char* installDest = this->IEGen->GetDestination(); - if(cmSystemTools::FileIsFullPath(installDest)) + std::string const& expDest = this->IEGen->GetDestination(); + if(cmSystemTools::FileIsFullPath(expDest)) { // The export file is being installed to an absolute path so the // package is not relocatable. Use the configured install prefix. @@ -87,7 +87,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { // Add code to compute the installation prefix relative to the // import file location. - std::string absDest = installPrefix + "/" + installDest; + std::string absDest = installPrefix + "/" + expDest; std::string absDestS = absDest + "/"; os << "# Compute the installation prefix relative to this file.\n" << "get_filename_component(_IMPORT_PREFIX" @@ -109,7 +109,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) "unset(_realOrig)\n" "unset(_realCurr)\n"; } - std::string dest = installDest; + std::string dest = expDest; while(!dest.empty()) { os << diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index eb8c28bbe..3e078f229 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -41,6 +41,9 @@ public: const std::string& GetNamespace() const { return this->Namespace; } + std::string const& GetDestination() const + { return this->Destination; } + protected: virtual void GenerateScript(std::ostream& os); virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index 38aac9185..eeeca158b 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -50,9 +50,6 @@ public: Indent const& indent = Indent() ); - const char* GetDestination() const - { return this->Destination.c_str(); } - /** Get the install destination as it should appear in the installation script. */ std::string GetInstallDestination() const; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 7e5cc71a7..4d4b3995f 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -60,6 +60,9 @@ public: cmTarget* GetTarget() const { return this->Target; } bool IsImportLibrary() const { return this->ImportLibrary; } + std::string const& GetDestination() const + { return this->Destination; } + protected: virtual void GenerateScript(std::ostream& os); virtual void GenerateScriptForConfig(std::ostream& os, From 290ca8e2d0328d27f51ff5248c35e32e44fdd1eb Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Feb 2015 11:48:02 -0500 Subject: [PATCH 0061/1029] cmInstallGenerator: Refactor computation of absolute install dest Replace the GetInstallDestination method, which looked up the Destination ivar, with a new ConvertToAbsoluteDestination method that takes the nominal destination as an argument. Update call sites accordingly. This will allow some clients to transform the install destination before calling the method. --- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallGenerator.cxx | 11 ++++++----- Source/cmInstallGenerator.h | 2 +- Source/cmInstallTargetGenerator.cxx | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 4480cc643..77af6c29c 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -199,7 +199,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, { // Remove old per-configuration export files if the main changes. std::string installedDir = "$ENV{DESTDIR}"; - installedDir += this->GetInstallDestination(); + installedDir += this->ConvertToAbsoluteDestination(this->Destination); installedDir += "/"; std::string installedFile = installedDir; installedFile += this->FileName; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index b261cbfd0..1d6467475 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -60,7 +60,7 @@ void cmInstallGenerator case cmInstallType_FILES: stype = "FILE"; break; } os << indent; - std::string dest = this->GetInstallDestination(); + std::string dest = this->ConvertToAbsoluteDestination(this->Destination); if (cmSystemTools::FileIsFullPath(dest.c_str())) { os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n"; @@ -179,15 +179,16 @@ bool cmInstallGenerator::InstallsForConfig(const std::string& config) } //---------------------------------------------------------------------------- -std::string cmInstallGenerator::GetInstallDestination() const +std::string +cmInstallGenerator::ConvertToAbsoluteDestination(std::string const& dest) const { std::string result; - if(!this->Destination.empty() && - !cmSystemTools::FileIsFullPath(this->Destination.c_str())) + if(!dest.empty() && + !cmSystemTools::FileIsFullPath(dest.c_str())) { result = "${CMAKE_INSTALL_PREFIX}/"; } - result += this->Destination; + result += dest; return result; } diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index eeeca158b..1e87bda3b 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -52,7 +52,7 @@ public: /** Get the install destination as it should appear in the installation script. */ - std::string GetInstallDestination() const; + std::string ConvertToAbsoluteDestination(std::string const& dest) const; /** Test if this generator installs something for a given configuration. */ bool InstallsForConfig(const std::string& config); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 6d69f545c..a22b123fa 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -77,7 +77,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary); fromDirConfig += "/"; } - std::string toDir = this->GetInstallDestination(); + std::string toDir = + this->ConvertToAbsoluteDestination(this->Destination); toDir += "/"; // Compute the list of files to install for this target. From ebd556caa9e1fc92e00c8e401b145c531390e854 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Feb 2015 11:52:19 -0500 Subject: [PATCH 0062/1029] cmInstallGenerator: Fix check for absolute install destinations In AddInstallRule, check for absolute install destinations before converting to the absolute install destination. Previously this worked only by accident because literal "${CMAKE_INSTALL_PREFIX}" looks like a relative path. --- Source/cmInstallGenerator.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 1d6467475..3ae897574 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -60,7 +60,7 @@ void cmInstallGenerator case cmInstallType_FILES: stype = "FILE"; break; } os << indent; - std::string dest = this->ConvertToAbsoluteDestination(this->Destination); + std::string const& dest = this->Destination; if (cmSystemTools::FileIsFullPath(dest.c_str())) { os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n"; @@ -94,7 +94,8 @@ void cmInstallGenerator << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; os << indent << "endif()\n"; } - os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype; + std::string absDest = this->ConvertToAbsoluteDestination(dest); + os << "file(INSTALL DESTINATION \"" << absDest << "\" TYPE " << stype; if(optional) { os << " OPTIONAL"; From 7607c3d16aa0636458c909f4036e4b0d91581b30 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Feb 2015 11:48:13 -0500 Subject: [PATCH 0063/1029] cmInstallGenerator: Pass destination explicitly to AddInstallRule This will allow specific invocations to transform the destination before AddInstallRule uses it. --- Source/cmInstallDirectoryGenerator.cxx | 4 +++- Source/cmInstallExportGenerator.cxx | 6 ++++-- Source/cmInstallFilesGenerator.cxx | 1 + Source/cmInstallGenerator.cxx | 2 +- Source/cmInstallGenerator.h | 4 +++- Source/cmInstallTargetGenerator.cxx | 4 ++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 8c13bab58..7593380ef 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -44,7 +44,9 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, { // Write code to install the directories. const char* no_rename = 0; - this->AddInstallRule(os, cmInstallType_DIRECTORY, + this->AddInstallRule(os, + this->Destination, + cmInstallType_DIRECTORY, this->Directories, this->Optional, this->FilePermissions.c_str(), diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 77af6c29c..38c80dff6 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -185,7 +185,8 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first); os << indent << "if(" << config_test << ")\n"; - this->AddInstallRule(os, cmInstallType_FILES, files, false, + this->AddInstallRule(os, this->Destination, + cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); os << indent << "endif()\n"; @@ -224,6 +225,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, // Install the main export file. std::vector files; files.push_back(this->MainImportFile); - this->AddInstallRule(os, cmInstallType_FILES, files, false, + this->AddInstallRule(os, this->Destination, + cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 91b102a34..28c27c295 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -57,6 +57,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule( // Write code to install the files. const char* no_dir_permissions = 0; this->AddInstallRule(os, + this->Destination, (this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 3ae897574..2e1c5f05f 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -37,6 +37,7 @@ cmInstallGenerator void cmInstallGenerator ::AddInstallRule( std::ostream& os, + std::string const& dest, cmInstallType type, std::vector const& files, bool optional /* = false */, @@ -60,7 +61,6 @@ void cmInstallGenerator case cmInstallType_FILES: stype = "FILE"; break; } os << indent; - std::string const& dest = this->Destination; if (cmSystemTools::FileIsFullPath(dest.c_str())) { os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n"; diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index 1e87bda3b..c4191e42d 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -40,7 +40,9 @@ public: virtual ~cmInstallGenerator(); void AddInstallRule( - std::ostream& os, cmInstallType type, + std::ostream& os, + std::string const& dest, + cmInstallType type, std::vector const& files, bool optional = false, const char* permissions_file = 0, diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index a22b123fa..7ab88f16d 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -323,8 +323,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, const char* no_dir_permissions = 0; const char* no_rename = 0; bool optional = this->Optional || this->ImportLibrary; - this->AddInstallRule(os, type, filesFrom, - optional, + this->AddInstallRule(os, this->Destination, + type, filesFrom, optional, this->FilePermissions.c_str(), no_dir_permissions, no_rename, literal_args.c_str(), indent); From f30022eb07b913598326d2e3b10ff2e706fbe873 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 11 Feb 2015 14:02:45 -0500 Subject: [PATCH 0064/1029] install: Allow generator expressions in TARGETS DESTINATION (#14317) This will allow per-config destinations for targets in EXPORT sets. Using multiple install(TARGETS) with separate CONFIGURATIONS is rejected as a target appearing more than once in an export set. Now instead one can write install(TARGETS foo EXPORT exp DESTINATION lib/$) to get a single logical membership of the target in the export set while still having a per-config destination. --- Help/command/install.rst | 4 ++++ Help/release/dev/install-DESTINATION-genex.rst | 5 +++++ Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 14 ++++++++++++-- Source/cmInstallTargetGenerator.h | 3 +-- Tests/ExportImport/Export/CMakeLists.txt | 12 +++++++++--- Tests/ExportImport/Export/testLibPerConfigDest.c | 1 + Tests/ExportImport/Import/A/CMakeLists.txt | 2 ++ Tests/ExportImport/Import/A/imp_testExe1.c | 2 ++ Tests/RunCMake/install/RunCMakeTest.cmake | 1 + .../install/TARGETS-DESTINATION-bad-result.txt | 1 + .../install/TARGETS-DESTINATION-bad-stderr.txt | 6 ++++++ .../RunCMake/install/TARGETS-DESTINATION-bad.cmake | 3 +++ Tests/RunCMake/install/empty.c | 0 14 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 Help/release/dev/install-DESTINATION-genex.rst create mode 100644 Tests/ExportImport/Export/testLibPerConfigDest.c create mode 100644 Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt create mode 100644 Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt create mode 100644 Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake create mode 100644 Tests/RunCMake/install/empty.c diff --git a/Help/command/install.rst b/Help/command/install.rst index 5dd5aaaa5..c99ed7361 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -159,6 +159,10 @@ file itself, call ``install(EXPORT)``, documented below. Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property set to ``TRUE`` has undefined behavior. +The install destination given to the target install ``DESTINATION`` may +use "generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for available expressions. + Installing Files ^^^^^^^^^^^^^^^^ diff --git a/Help/release/dev/install-DESTINATION-genex.rst b/Help/release/dev/install-DESTINATION-genex.rst new file mode 100644 index 000000000..4c4bbedf6 --- /dev/null +++ b/Help/release/dev/install-DESTINATION-genex.rst @@ -0,0 +1,5 @@ +install-DESTINATION-genex +------------------------- + +* The :command:`install(TARGETS)` command learned to support + generator expressions in the ``DESTINATION`` value. diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 053c022fa..ba1dde29f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -398,7 +398,7 @@ cmExportInstallFileGenerator cmTarget* target = itgen->GetTarget(); // Construct the installed location of the target. - std::string dest = itgen->GetDestination(); + std::string dest = itgen->GetDestination(config); std::string value; if(!cmSystemTools::FileIsFullPath(dest.c_str())) { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 7ab88f16d..b035bad95 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -12,6 +12,7 @@ #include "cmInstallTargetGenerator.h" #include "cmComputeLinkInformation.h" +#include "cmGeneratorExpression.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" @@ -78,7 +79,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, fromDirConfig += "/"; } std::string toDir = - this->ConvertToAbsoluteDestination(this->Destination); + this->ConvertToAbsoluteDestination(this->GetDestination(config)); toDir += "/"; // Compute the list of files to install for this target. @@ -323,7 +324,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, const char* no_dir_permissions = 0; const char* no_rename = 0; bool optional = this->Optional || this->ImportLibrary; - this->AddInstallRule(os, this->Destination, + this->AddInstallRule(os, this->GetDestination(config), type, filesFrom, optional, this->FilePermissions.c_str(), no_dir_permissions, no_rename, literal_args.c_str(), @@ -334,6 +335,15 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, &cmInstallTargetGenerator::PostReplacementTweaks); } +//---------------------------------------------------------------------------- +std::string +cmInstallTargetGenerator::GetDestination(std::string const& config) const +{ + cmGeneratorExpression ge; + return ge.Parse(this->Destination) + ->Evaluate(this->Target->GetMakefile(), config); +} + //---------------------------------------------------------------------------- std::string cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 4d4b3995f..075c8a4bf 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -60,8 +60,7 @@ public: cmTarget* GetTarget() const { return this->Target; } bool IsImportLibrary() const { return this->ImportLibrary; } - std::string const& GetDestination() const - { return this->Destination; } + std::string GetDestination(std::string const& config) const; protected: virtual void GenerateScript(std::ostream& os); diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index e130ecaa0..0df42d982 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -68,6 +68,11 @@ add_library(testLib5 SHARED testLib5.c) add_library(testLib6 STATIC testLib6.cxx testLib6c.c) +add_library(testLibPerConfigDest STATIC testLibPerConfigDest.c) +install(TARGETS testLibPerConfigDest EXPORT exp + DESTINATION lib/$<$>:$>$<$>>:NoConfig> + ) + # Work-around: Visual Studio 6 does not support per-target object files. set(VS6) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") @@ -446,9 +451,9 @@ install( cmp0022NEW cmp0022OLD systemlib EXPORT exp - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib NAMELINK_SKIP - ARCHIVE DESTINATION lib + RUNTIME DESTINATION $<1:bin> + LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP + ARCHIVE DESTINATION $<1:lib> FRAMEWORK DESTINATION Frameworks BUNDLE DESTINATION Applications ) @@ -503,6 +508,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB + testLibPerConfigDest NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake ) diff --git a/Tests/ExportImport/Export/testLibPerConfigDest.c b/Tests/ExportImport/Export/testLibPerConfigDest.c new file mode 100644 index 000000000..c7113fc15 --- /dev/null +++ b/Tests/ExportImport/Export/testLibPerConfigDest.c @@ -0,0 +1 @@ +int testLibPerConfigDest(void) { return 0; } diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 358776bfd..ced7b03eb 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -34,6 +34,7 @@ target_link_libraries(imp_testExe1 exp_testLib5 exp_testLib6 exp_testLibCycleA + exp_testLibPerConfigDest ) # Try building a plugin to an executable imported from the install tree. @@ -66,6 +67,7 @@ target_link_libraries(imp_testExe1b bld_testLib5 bld_testLib6 bld_testLibCycleA + bld_testLibPerConfigDest ) add_custom_target(check_testLib1_genex ALL diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index 451998ab7..150fcef3e 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -7,6 +7,7 @@ extern int testLib4lib(); extern int testLib5(); extern int testLib6(); extern int testLibCycleA1(); +extern int testLibPerConfigDest(); /* Switch a symbol between debug and optimized builds to make sure the proper library is found from the testLib4 link interface. */ @@ -21,5 +22,6 @@ int main() { return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() + testLib5() + testLib6() + testLibCycleA1() + + testLibPerConfigDest() + generated_by_testExe3() + testLib4lib() + testLib4libcfg()); } diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 53b91f396..714960355 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) +run_cmake(TARGETS-DESTINATION-bad) diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt new file mode 100644 index 000000000..984415868 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake b/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake new file mode 100644 index 000000000..feff52dfe --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_library(empty empty.c) +install(TARGETS empty DESTINATION $) diff --git a/Tests/RunCMake/install/empty.c b/Tests/RunCMake/install/empty.c new file mode 100644 index 000000000..e69de29bb From 0a4e5674eccb0126733086d4632c7239217db6f1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:47:21 +0100 Subject: [PATCH 0065/1029] cmMacroCommand: Remove counting variable. Start iteration at correct starting point directly. --- Source/cmMacroCommand.cxx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index c1e7cbbc6..657e75014 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -167,19 +167,14 @@ bool cmMacroHelperCommand::InvokeInitialPass if (expandedArgs.size() > this->Args.size() - 1) { std::vector::const_iterator eit - = expandedArgs.begin(); - std::vector::size_type cnt = 0; + = expandedArgs.begin() + (this->Args.size() - 1); for( ; eit != expandedArgs.end(); ++eit) { - if ( cnt >= this->Args.size()-1 ) + if (!argnDef.empty()) { - if (!argnDef.empty()) - { - argnDef += ";"; - } - argnDef += *eit; + argnDef += ";"; } - cnt ++; + argnDef += *eit; } } argnDefInitialized = true; From 7ee56f03999e8605cc2cbe85a3a7b7159e639e5d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 17 Jan 2015 17:47:10 +0100 Subject: [PATCH 0066/1029] Convert loops into the commonly used pattern. --- Source/cmGetCMakePropertyCommand.cxx | 23 ++++++++++--------- Source/cmMakefile.cxx | 34 +++++++++++----------------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index e193cf5b0..c0e4683a2 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -25,7 +25,6 @@ bool cmGetCMakePropertyCommand return false; } - std::vector::size_type cc; std::string variable = args[0]; std::string output = "NOTFOUND"; @@ -35,12 +34,15 @@ bool cmGetCMakePropertyCommand std::vector vars = this->Makefile->GetDefinitions(cacheonly); if (!vars.empty()) { - output = vars[0]; - } - for ( cc = 1; cc < vars.size(); ++cc ) - { - output += ";"; - output += vars[cc]; + output = ""; + const char* sep = ""; + std::vector::size_type cc; + for ( cc = 0; cc < vars.size(); ++cc ) + { + output += sep; + output += vars[cc]; + sep = ";"; + } } } else if ( args[1] == "MACROS" ) @@ -54,13 +56,12 @@ bool cmGetCMakePropertyCommand ->GetInstallComponents(); std::set::const_iterator compIt; output = ""; + const char* sep = ""; for (compIt = components->begin(); compIt != components->end(); ++compIt) { - if (compIt != components->begin()) - { - output += ";"; - } + output += sep; output += *compIt; + sep = ";"; } } else diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eb68e4986..aca4413a2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3752,15 +3752,12 @@ void cmMakefile::GetListOfMacros(std::string& macros) const { StringStringMap::const_iterator it; macros = ""; - int cc = 0; + const char* sep = ""; for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it ) { - if ( cc > 0 ) - { - macros += ";"; - } + macros += sep; macros += it->first; - cc ++; + sep = ""; } } @@ -4205,15 +4202,14 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LISTFILE_STACK") { + const char* sep = ""; for (std::deque::const_iterator i = this->ListFileStack.begin(); i != this->ListFileStack.end(); ++i) { - if (i != this->ListFileStack.begin()) - { - output += ";"; - } + output += sep; output += *i; + sep = ";"; } return output.c_str(); } @@ -4225,13 +4221,12 @@ const char *cmMakefile::GetProperty(const std::string& prop, cacheonly = 1; } std::vector vars = this->GetDefinitions(cacheonly); + const char* sep = ""; for (unsigned int cc = 0; cc < vars.size(); cc ++ ) { - if ( cc > 0 ) - { - output += ";"; - } + output += sep; output += vars[cc]; + sep = ";"; } return output.c_str(); } @@ -4247,19 +4242,16 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LINK_DIRECTORIES") { - std::ostringstream str; + const char* sep = ""; for (std::vector::const_iterator it = this->GetLinkDirectories().begin(); it != this->GetLinkDirectories().end(); ++ it ) { - if ( it != this->GetLinkDirectories().begin()) - { - str << ";"; - } - str << it->c_str(); + output += sep; + output += *it; + sep = ";"; } - output = str.str(); return output.c_str(); } else if (prop == "INCLUDE_DIRECTORIES") From 7b8725bf8472ebf4781ddd60ef8fcca9c3ad98dd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 17 Jan 2015 17:36:19 +0100 Subject: [PATCH 0067/1029] Convert loops populating maybe-empty content into the common pattern. --- Source/cmListCommand.cxx | 12 ++++++++---- Source/cmLocalGenerator.cxx | 12 ++++++++---- Source/cmMacroCommand.cxx | 23 ++++++++++++++--------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 107dca938..8d1657d82 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -254,14 +254,18 @@ bool cmListCommand::HandleAppendCommand(std::vector const& args) // expand the variable std::string listString; this->GetListString(listString, listName); + + if(!listString.empty() && !args.empty()) + { + listString += ";"; + } + const char* sep = ""; size_t cc; for ( cc = 2; cc < args.size(); ++ cc ) { - if(!listString.empty()) - { - listString += ";"; - } + listString += sep; listString += args[cc]; + sep = ";"; } this->Makefile->AddDefinition(listName, listString.c_str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7afe05fa3..05d8ab5f9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3011,13 +3011,17 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, // trailing slash in the input then the last iteration of the loop // will add a slash followed by an empty string which will preserve // the trailing slash in the output. + + if(!relative.empty() && !remote.empty()) + { + relative += "/"; + } + const char* sep = ""; for(unsigned int i=common; i < remote.size(); ++i) { - if(!relative.empty()) - { - relative += "/"; - } + relative += sep; relative += remote[i]; + sep = "/"; } // Finally return the path. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 657e75014..81aaf3ec1 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -166,15 +166,17 @@ bool cmMacroHelperCommand::InvokeInitialPass { if (expandedArgs.size() > this->Args.size() - 1) { + if (!argnDef.empty() && !expandedArgs.empty()) + { + argnDef += ";"; + } std::vector::const_iterator eit = expandedArgs.begin() + (this->Args.size() - 1); + const char* sep = ""; for( ; eit != expandedArgs.end(); ++eit) { - if (!argnDef.empty()) - { - argnDef += ";"; - } - argnDef += *eit; + argnDef += sep + *eit; + sep = ";"; } } argnDefInitialized = true; @@ -191,14 +193,17 @@ bool cmMacroHelperCommand::InvokeInitialPass // repleace ARGV, compute it only once if (!argvDefInitialized) { + if (!argvDef.empty() && !expandedArgs.empty()) + { + argvDef += ";"; + } + const char* sep = ""; std::vector::const_iterator eit; for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit) { - if (!argvDef.empty()) - { - argvDef += ";"; - } + argvDef += sep; argvDef += *eit; + sep = ";"; } argvDefInitialized = true; } From 8910224950a2b723e0d4fd7c21a326af7fb2e050 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 14 Jan 2015 21:31:46 +0100 Subject: [PATCH 0068/1029] Replace common loop pattern with cmJoin --- Source/cmFindPackageCommand.cxx | 19 ++---------------- Source/cmFunctionCommand.cxx | 8 ++------ Source/cmGetCMakePropertyCommand.cxx | 20 ++----------------- Source/cmMacroCommand.cxx | 9 +-------- Source/cmMakefile.cxx | 30 +++------------------------- Source/cmOptionCommand.cxx | 6 +----- 6 files changed, 11 insertions(+), 81 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7746980d4..fd9b236a8 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1064,26 +1064,11 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found) } - std::string tmp; - const char* sep =""; - for(size_t i=0; iMakefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND", tmp.c_str()); - tmp = ""; - sep = ""; - for(size_t i=0; iMakefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND", tmp.c_str()); } diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index c33048c81..b44e228a0 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -193,12 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, if (!this->Depth) { std::string name = this->Args[0]; - std::vector::size_type cc; - name += "("; - for ( cc = 0; cc < this->Args.size(); cc ++ ) - { - name += " " + this->Args[cc]; - } + name += "( "; + name += cmJoin(this->Args, " "); name += " )"; // create a new command and add it to cmake diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index c0e4683a2..84c00bac4 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -34,15 +34,7 @@ bool cmGetCMakePropertyCommand std::vector vars = this->Makefile->GetDefinitions(cacheonly); if (!vars.empty()) { - output = ""; - const char* sep = ""; - std::vector::size_type cc; - for ( cc = 0; cc < vars.size(); ++cc ) - { - output += sep; - output += vars[cc]; - sep = ";"; - } + output = cmJoin(vars, ";"); } } else if ( args[1] == "MACROS" ) @@ -54,15 +46,7 @@ bool cmGetCMakePropertyCommand const std::set* components = this->Makefile->GetLocalGenerator()->GetGlobalGenerator() ->GetInstallComponents(); - std::set::const_iterator compIt; - output = ""; - const char* sep = ""; - for (compIt = components->begin(); compIt != components->end(); ++compIt) - { - output += sep; - output += *compIt; - sep = ";"; - } + output = cmJoin(*components, ";"); } else { diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 81aaf3ec1..676e082bf 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -197,14 +197,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { argvDef += ";"; } - const char* sep = ""; - std::vector::const_iterator eit; - for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit) - { - argvDef += sep; - argvDef += *eit; - sep = ";"; - } + argvDef += cmJoin(expandedArgs, ";"); argvDefInitialized = true; } cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str()); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index aca4413a2..ac5fec9c3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4202,15 +4202,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LISTFILE_STACK") { - const char* sep = ""; - for (std::deque::const_iterator - i = this->ListFileStack.begin(); - i != this->ListFileStack.end(); ++i) - { - output += sep; - output += *i; - sep = ";"; - } + output = cmJoin(this->ListFileStack, ";"); return output.c_str(); } else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES") @@ -4220,14 +4212,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, { cacheonly = 1; } - std::vector vars = this->GetDefinitions(cacheonly); - const char* sep = ""; - for (unsigned int cc = 0; cc < vars.size(); cc ++ ) - { - output += sep; - output += vars[cc]; - sep = ";"; - } + output = cmJoin(this->GetDefinitions(cacheonly), ";"); return output.c_str(); } else if (prop == "MACROS") @@ -4242,16 +4227,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LINK_DIRECTORIES") { - const char* sep = ""; - for (std::vector::const_iterator - it = this->GetLinkDirectories().begin(); - it != this->GetLinkDirectories().end(); - ++ it ) - { - output += sep; - output += *it; - sep = ";"; - } + output = cmJoin(this->GetLinkDirectories(), ";"); return output.c_str(); } else if (prop == "INCLUDE_DIRECTORIES") diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index e505440e8..60728eaea 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -34,11 +34,7 @@ bool cmOptionCommand if(argError) { std::string m = "called with incorrect number of arguments: "; - for(size_t i =0; i < args.size(); ++i) - { - m += args[i]; - m += " "; - } + m += cmJoin(args, " "); this->SetError(m); return false; } From 4e78ebbdf94b99f7b7d5b9b31d05dd9479b1d6ab Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 22:19:21 +0100 Subject: [PATCH 0069/1029] cmAlgorithms: Add a Range container and adaptor method. This can make a pair of iterators API compatible with the cmJoin algorithm and other range-based algorithms. Accept different iterator types in the cmRange adaptor so that a const and non-const iterator are accepted. --- Source/cmAlgorithms.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 49381401d..6c03f519a 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -112,6 +112,27 @@ struct DefaultDeleter } }; +template +struct Range +{ + typedef const_iterator_ const_iterator; + typedef typename std::iterator_traits::value_type value_type; + Range(const_iterator begin_, const_iterator end_) + : Begin(begin_), End(end_) {} + const_iterator begin() const { return Begin; } + const_iterator end() const { return End; } + bool empty() const { return std::distance(Begin, End) == 0; } +private: + const_iterator Begin; + const_iterator End; +}; + +} + +template +ContainerAlgorithms::Range cmRange(Iter1 begin, Iter2 end) +{ + return ContainerAlgorithms::Range(begin, end); } template From 27c6f017a1ef7c62f7f0332d624add7e8189f81c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 14 Jan 2015 21:27:25 +0100 Subject: [PATCH 0070/1029] Use cmJoin to accumulate string ranges. Avoid using the std::accumulate algorithm which is designed for numeric types, not complex types. It introduces unneccessary copies. Initialize variables where they are populated. --- Source/cmFileCommand.cxx | 6 +----- Source/cmMessageCommand.cxx | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 8b893bc7a..212603ceb 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -217,7 +217,6 @@ bool cmFileCommand bool cmFileCommand::HandleWriteCommand(std::vector const& args, bool append) { - std::string message; std::vector::const_iterator i = args.begin(); i++; // Get rid of subcommand @@ -231,10 +230,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, i++; - for(;i != args.end(); ++i) - { - message += *i; - } if ( !this->Makefile->CanIWriteThisFile(fileName.c_str()) ) { std::string e @@ -272,6 +267,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, this->SetError(error); return false; } + std::string message = cmJoin(cmRange(i, args.end()), std::string()); file << message; file.close(); if(mode) diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 88d6a771b..0449c501d 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -20,7 +20,6 @@ bool cmMessageCommand this->SetError("called with incorrect number of arguments"); return false; } - std::string message; std::vector::const_iterator i = args.begin(); cmake::MessageType type = cmake::MESSAGE; @@ -70,10 +69,7 @@ bool cmMessageCommand ++i; } - for(;i != args.end(); ++i) - { - message += *i; - } + std::string message = cmJoin(cmRange(i, args.end()), std::string()); if (type != cmake::MESSAGE) { From 0c12f1ea0da0a5822a7a69b4ff77b45732c72466 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 22:14:54 +0100 Subject: [PATCH 0071/1029] cmAlgorithms: Add a range adaptor and API for adjusting a range. --- Source/cmAlgorithms.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 6c03f519a..ad2b9c164 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -122,6 +122,17 @@ struct Range const_iterator begin() const { return Begin; } const_iterator end() const { return End; } bool empty() const { return std::distance(Begin, End) == 0; } + Range& advance(cmIML_INT_intptr_t amount) + { + std::advance(Begin, amount); + return *this; + } + + Range& retreat(cmIML_INT_intptr_t amount) + { + std::advance(End, -amount); + return *this; + } private: const_iterator Begin; const_iterator End; @@ -135,6 +146,14 @@ ContainerAlgorithms::Range cmRange(Iter1 begin, Iter2 end) return ContainerAlgorithms::Range(begin, end); } +template +ContainerAlgorithms::Range +cmRange(Range const& range) +{ + return ContainerAlgorithms::Range( + range.begin(), range.end()); +} + template void cmDeleteAll(Container const& c) { From bb10012fea677fd8aa1bbefd06061efcb7ec1955 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 22:23:41 +0100 Subject: [PATCH 0072/1029] cmStringCommand: Accumulate with cmJoin and range adaptors. --- Source/cmStringCommand.cxx | 42 ++++++++++---------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 3e606d748..edc6afc19 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -303,13 +303,6 @@ bool cmStringCommand::RegexMatch(std::vector const& args) std::string regex = args[2]; std::string outvar = args[3]; - // Concatenate all the last arguments together. - std::string input = args[4]; - for(unsigned int i=5; i < args.size(); ++i) - { - input += args[i]; - } - this->Makefile->ClearMatches(); // Compile the regular expression. cmsys::RegularExpression re; @@ -321,6 +314,9 @@ bool cmStringCommand::RegexMatch(std::vector const& args) return false; } + // Concatenate all the last arguments together. + std::string input = cmJoin(cmRange(args).advance(4), std::string()); + // Scan through the input for all matches. std::string output; if(re.find(input.c_str())) @@ -352,13 +348,6 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) std::string regex = args[2]; std::string outvar = args[3]; - // Concatenate all the last arguments together. - std::string input = args[4]; - for(unsigned int i=5; i < args.size(); ++i) - { - input += args[i]; - } - this->Makefile->ClearMatches(); // Compile the regular expression. cmsys::RegularExpression re; @@ -371,6 +360,9 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) return false; } + // Concatenate all the last arguments together. + std::string input = cmJoin(cmRange(args).advance(4), std::string()); + // Scan through the input for all matches. std::string output; const char* p = input.c_str(); @@ -456,13 +448,6 @@ bool cmStringCommand::RegexReplace(std::vector const& args) l = r; } - // Concatenate all the last arguments together. - std::string input = args[5]; - for(unsigned int i=6; i < args.size(); ++i) - { - input += args[i]; - } - this->Makefile->ClearMatches(); // Compile the regular expression. cmsys::RegularExpression re; @@ -475,6 +460,9 @@ bool cmStringCommand::RegexReplace(std::vector const& args) return false; } + // Concatenate all the last arguments together. + std::string input = cmJoin(cmRange(args).advance(5), std::string()); + // Scan through the input for all matches. std::string output; std::string::size_type base = 0; @@ -673,11 +661,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector const& const std::string& replaceExpression = args[2]; const std::string& variableName = args[3]; - std::string input = args[4]; - for(unsigned int i=5; i < args.size(); ++i) - { - input += args[i]; - } + std::string input = cmJoin(cmRange(args).advance(4), std::string()); cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(), replaceExpression.c_str()); @@ -756,11 +740,7 @@ bool cmStringCommand } std::string const& variableName = args[1]; - std::string value; - for(unsigned int i = 2; i < args.size(); ++i) - { - value += args[i]; - } + std::string value = cmJoin(cmRange(args).advance(2), std::string()); this->Makefile->AddDefinition(variableName, value.c_str()); return true; From 9380e85f865e29cd5968e91408a31d5160f4a4cb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:53:20 +0100 Subject: [PATCH 0073/1029] Convert loops to cmJoin algorithm with cmRange. --- Source/cmListCommand.cxx | 9 +-------- Source/cmLocalGenerator.cxx | 8 +------- Source/cmMacroCommand.cxx | 7 +------ Source/cmcmd.cxx | 15 ++------------- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 8d1657d82..dd0cfa9d2 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -259,14 +259,7 @@ bool cmListCommand::HandleAppendCommand(std::vector const& args) { listString += ";"; } - const char* sep = ""; - size_t cc; - for ( cc = 2; cc < args.size(); ++ cc ) - { - listString += sep; - listString += args[cc]; - sep = ";"; - } + listString += cmJoin(cmRange(args).advance(2), ";"); this->Makefile->AddDefinition(listName, listString.c_str()); return true; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 05d8ab5f9..35956aded 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3016,13 +3016,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, { relative += "/"; } - const char* sep = ""; - for(unsigned int i=common; i < remote.size(); ++i) - { - relative += sep; - relative += remote[i]; - sep = "/"; - } + relative += cmJoin(cmRange(remote).advance(common), "/"); // Finally return the path. return relative; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 676e082bf..8f6364d7d 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -172,12 +172,7 @@ bool cmMacroHelperCommand::InvokeInitialPass } std::vector::const_iterator eit = expandedArgs.begin() + (this->Args.size() - 1); - const char* sep = ""; - for( ; eit != expandedArgs.end(); ++eit) - { - argnDef += sep + *eit; - sep = ";"; - } + argnDef += cmJoin(cmRange(eit, expandedArgs.end()), ";"); } argnDefInitialized = true; } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5260cb0e8..5c9397519 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -406,12 +406,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Clock command else if (args[1] == "time" && args.size() > 2) { - std::string command = args[2]; - for (std::string::size_type cc = 3; cc < args.size(); cc ++) - { - command += " "; - command += args[cc]; - } + std::string command = cmJoin(cmRange(args).advance(2), " "); clock_t clock_start, clock_finish; time_t time_start, time_finish; @@ -473,14 +468,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } std::string command = "\""; - command += args[3]; + command += cmJoin(cmRange(args).advance(3), "\" \""); command += "\""; - for (std::string::size_type cc = 4; cc < args.size(); cc ++) - { - command += " \""; - command += args[cc]; - command += "\""; - } int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, From 0ea719326ea78b423a5ec95b1218b626e9392f07 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 14 Jan 2015 22:23:41 +0100 Subject: [PATCH 0074/1029] cmFindBase: Replace loop with cmJoin on range. --- Source/cmFindBase.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 69991d53a..6e555333d 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -166,11 +166,9 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) } else { - this->VariableDocumentation += "one of the " + this->Names[0]; - for (unsigned int j = 1; j < this->Names.size() - 1; ++j) - { - this->VariableDocumentation += ", " + this->Names[j]; - } + this->VariableDocumentation += "one of the "; + this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1), + ", "); this->VariableDocumentation += " or " + this->Names[this->Names.size() - 1] + " libraries be found"; } From 559dc15589ad0b9a7bdaa62ac7552899993f6f0d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 23:26:58 +0100 Subject: [PATCH 0075/1029] cmSet: Replace loop with cmJoin. --- Source/cmSetCommand.cxx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 90d7b0395..204d95b1e 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -108,17 +108,7 @@ bool cmSetCommand } // collect any values into a single semi-colon separated value list - if(static_cast(args.size()) > - static_cast(1 + ignoreLastArgs)) - { - value = args[1]; - size_t endPos = args.size() - ignoreLastArgs; - for(size_t i = 2; i < endPos; ++i) - { - value += ";"; - value += args[i]; - } - } + value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";"); if (parentScope) { From e21f7829a2891ce7599ade02d4fd9c193657069a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 22:48:02 +0100 Subject: [PATCH 0076/1029] cmTarget: Use a sorted vector in place of a set. The vector has a more easy-to-use API. Join the string with cmJoin, and avoid erasing from the container in the loop. --- Source/cmTarget.cxx | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f0bdea7d6..526a923f4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6687,40 +6687,33 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, if (!prop.empty()) { - // Use a std::set to keep the error message sorted. - std::set props; + // Use a sorted std::vector to keep the error message sorted. + std::vector props; std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) { - props.insert(strBool); + props.push_back(strBool); } i = emittedStrings.find(prop); if (i != emittedStrings.end()) { - props.insert(strString); + props.push_back(strString); } i = emittedMinNumbers.find(prop); if (i != emittedMinNumbers.end()) { - props.insert(strNumMin); + props.push_back(strNumMin); } i = emittedMaxNumbers.find(prop); if (i != emittedMaxNumbers.end()) { - props.insert(strNumMax); + props.push_back(strNumMax); } + std::sort(props.begin(), props.end()); + + std::string propsString = cmJoin(cmRange(props).retreat(1), ", "); + propsString += " and the " + props.back(); - std::string propsString = *props.begin(); - props.erase(props.begin()); - while (props.size() > 1) - { - propsString += ", " + *props.begin(); - props.erase(props.begin()); - } - if (props.size() == 1) - { - propsString += " and the " + *props.begin(); - } std::ostringstream e; e << "Property \"" << prop << "\" appears in both the " << propsString << From 0b61b86df856e3cec366f8c23f35aae576b2d821 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 23 Jan 2015 01:03:45 +0100 Subject: [PATCH 0077/1029] Handle last element outside of the loop. There is no point in checking on each loop iteration whether it is the last element. --- Source/cmLocalUnixMakefileGenerator3.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 54d330f8c..32da82180 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2298,10 +2298,9 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, // Now add the rest of the components separated by the proper slash // direction for this platform. bool first = true; - for(unsigned int i=1; i < components.size(); ++i) + for(unsigned int i=1; i < components.size() - 1; ++i) { - // Only the last component can be empty to avoid double slashes. - if(!components[i].empty() || (i == (components.size()-1))) + if(!components[i].empty()) { if(!first) { @@ -2311,6 +2310,15 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, first = false; } } + if (components.size() > 1) + { + // Only the last component can be empty to avoid double slashes. + if(!first) + { + result += slash; + } + result += components.back(); + } } // Close the quoted result. From abfca97525be06e067981b6c6bf63ba7a3aa52f9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 23:09:03 +0100 Subject: [PATCH 0078/1029] Move loop inside of condition. The loop is only executed if the condition is true. --- Source/cmLocalUnixMakefileGenerator3.cxx | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 32da82180..703ab2724 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2295,23 +2295,23 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, // Begin the quoted result with the root component. result += components[0]; - // Now add the rest of the components separated by the proper slash - // direction for this platform. - bool first = true; - for(unsigned int i=1; i < components.size() - 1; ++i) - { - if(!components[i].empty()) - { - if(!first) - { - result += slash; - } - result += components[i]; - first = false; - } - } if (components.size() > 1) { + // Now add the rest of the components separated by the proper slash + // direction for this platform. + bool first = true; + for(unsigned int i=1; i < components.size() - 1; ++i) + { + if(!components[i].empty()) + { + if(!first) + { + result += slash; + } + result += components[i]; + first = false; + } + } // Only the last component can be empty to avoid double slashes. if(!first) { From 8a399c8c9f1c4a793289d6baf37081efac082eee Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 23 Jan 2015 01:06:40 +0100 Subject: [PATCH 0079/1029] Convert loop to the common pattern. --- Source/cmLocalUnixMakefileGenerator3.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 703ab2724..359141a07 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2299,24 +2299,18 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, { // Now add the rest of the components separated by the proper slash // direction for this platform. - bool first = true; + const char* sep = ""; for(unsigned int i=1; i < components.size() - 1; ++i) { if(!components[i].empty()) { - if(!first) - { - result += slash; - } + result += sep; result += components[i]; - first = false; + sep = slash; } } // Only the last component can be empty to avoid double slashes. - if(!first) - { - result += slash; - } + result += slash; result += components.back(); } } From 7c3f637680ac0cdb6cec5e75ba4a9b188de5017b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 24 Jan 2015 18:07:37 +0100 Subject: [PATCH 0080/1029] Convert loop into two algorithms. --- Source/cmLocalUnixMakefileGenerator3.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 359141a07..a08c1592e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2299,16 +2299,12 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, { // Now add the rest of the components separated by the proper slash // direction for this platform. - const char* sep = ""; - for(unsigned int i=1; i < components.size() - 1; ++i) - { - if(!components[i].empty()) - { - result += sep; - result += components[i]; - sep = slash; - } - } + std::vector::const_iterator compEnd + = std::remove(components.begin() + 1, components.end() - 1, + std::string()); + std::vector::const_iterator compStart + = components.begin() + 1; + result += cmJoin(cmRange(compStart, compEnd), slash); // Only the last component can be empty to avoid double slashes. result += slash; result += components.back(); From 17b5ebd383df4c0c731b5c687ccaa3608b2d188f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:47:16 +0100 Subject: [PATCH 0081/1029] cmMacroCommand: Join the args strings outside of the loops. This means that we compute the strings even if not used in the macro but this shouldn't be expensive and it simplifies the code. --- Source/cmMacroCommand.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 8f6364d7d..de52fc9ea 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -114,6 +114,10 @@ bool cmMacroHelperCommand::InvokeInitialPass // declare varuiables for ARGV ARGN but do not compute until needed std::string argvDef; std::string argnDef; + std::vector::const_iterator eit + = expandedArgs.begin() + (this->Args.size() - 1); + std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";"); + std::string expandedArgv = cmJoin(expandedArgs, ";"); bool argnDefInitialized = false; bool argvDefInitialized = false; if(!this->Functions.empty()) @@ -170,9 +174,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { argnDef += ";"; } - std::vector::const_iterator eit - = expandedArgs.begin() + (this->Args.size() - 1); - argnDef += cmJoin(cmRange(eit, expandedArgs.end()), ";"); + argnDef += expandedArgn; } argnDefInitialized = true; } @@ -192,7 +194,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { argvDef += ";"; } - argvDef += cmJoin(expandedArgs, ";"); + argvDef += expandedArgv; argvDefInitialized = true; } cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str()); From 081a13f7c011d0ebd28caebfedee1e3e3f7602c9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 19:10:19 +0100 Subject: [PATCH 0082/1029] cmMacroCommand: Declare arg variables where used and initialized. Make the initialization by population with the expanded* content unconditional. --- Source/cmMacroCommand.cxx | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index de52fc9ea..f7daa768a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -111,15 +111,10 @@ bool cmMacroHelperCommand::InvokeInitialPass argcDefStream << expandedArgs.size(); std::string argcDef = argcDefStream.str(); - // declare varuiables for ARGV ARGN but do not compute until needed - std::string argvDef; - std::string argnDef; std::vector::const_iterator eit = expandedArgs.begin() + (this->Args.size() - 1); std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";"); std::string expandedArgv = cmJoin(expandedArgs, ";"); - bool argnDefInitialized = false; - bool argvDefInitialized = false; if(!this->Functions.empty()) { this->FilePath = this->Functions[0].FilePath; @@ -166,17 +161,14 @@ bool cmMacroHelperCommand::InvokeInitialPass // repleace ARGN if (tmps.find("${ARGN}") != std::string::npos) { - if (!argnDefInitialized) + std::string argnDef; + if (expandedArgs.size() > this->Args.size() - 1) { - if (expandedArgs.size() > this->Args.size() - 1) + if (!argnDef.empty() && !expandedArgs.empty()) { - if (!argnDef.empty() && !expandedArgs.empty()) - { - argnDef += ";"; - } - argnDef += expandedArgn; + argnDef += ";"; } - argnDefInitialized = true; + argnDef += expandedArgn; } cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str()); } @@ -187,16 +179,12 @@ bool cmMacroHelperCommand::InvokeInitialPass { char argvName[60]; - // repleace ARGV, compute it only once - if (!argvDefInitialized) + std::string argvDef; + if (!argvDef.empty() && !expandedArgs.empty()) { - if (!argvDef.empty() && !expandedArgs.empty()) - { - argvDef += ";"; - } - argvDef += expandedArgv; - argvDefInitialized = true; + argvDef += ";"; } + argvDef += expandedArgv; cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str()); // also replace the ARGV1 ARGV2 ... etc From 3250a7e535684bec684c0109b31675ba72dc3aa9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 19:16:15 +0100 Subject: [PATCH 0083/1029] cmMacroCommand: Remove conditional append of semicolon. The conditions are never true. --- Source/cmMacroCommand.cxx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index f7daa768a..b27b994db 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -164,10 +164,6 @@ bool cmMacroHelperCommand::InvokeInitialPass std::string argnDef; if (expandedArgs.size() > this->Args.size() - 1) { - if (!argnDef.empty() && !expandedArgs.empty()) - { - argnDef += ";"; - } argnDef += expandedArgn; } cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str()); @@ -180,10 +176,6 @@ bool cmMacroHelperCommand::InvokeInitialPass char argvName[60]; std::string argvDef; - if (!argvDef.empty() && !expandedArgs.empty()) - { - argvDef += ";"; - } argvDef += expandedArgv; cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str()); From f2c49f59d8dbca936a40b62a9079fa71ca551365 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 19:17:29 +0100 Subject: [PATCH 0084/1029] cmMacroCommand: Remove condition around ARGN computation. An empty string is appended if the condition is false, which is ok for this commit. --- Source/cmMacroCommand.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index b27b994db..9fc479e33 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -162,10 +162,7 @@ bool cmMacroHelperCommand::InvokeInitialPass if (tmps.find("${ARGN}") != std::string::npos) { std::string argnDef; - if (expandedArgs.size() > this->Args.size() - 1) - { - argnDef += expandedArgn; - } + argnDef += expandedArgn; cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str()); } From 8e0827b646b14028446503ac392a9ab7bb5a53a3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 19:26:33 +0100 Subject: [PATCH 0085/1029] cmMacroCommand: Remove intermediate arg variables. --- Source/cmMacroCommand.cxx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9fc479e33..8bbb7c6e0 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -161,9 +161,7 @@ bool cmMacroHelperCommand::InvokeInitialPass // repleace ARGN if (tmps.find("${ARGN}") != std::string::npos) { - std::string argnDef; - argnDef += expandedArgn; - cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str()); + cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str()); } // if the current argument of the current function has ${ARGV in it @@ -171,10 +169,7 @@ bool cmMacroHelperCommand::InvokeInitialPass if (tmps.find("${ARGV") != std::string::npos) { char argvName[60]; - - std::string argvDef; - argvDef += expandedArgv; - cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str()); + cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str()); // also replace the ARGV1 ARGV2 ... etc for (unsigned int t = 0; t < expandedArgs.size(); ++t) From f79c0f7697ee0bd25ec74f7dbb2ac0cf6189a9df Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 19:51:15 +0100 Subject: [PATCH 0086/1029] cmMacroCommand: Compute variables outside of two loops. Avoid computing them from scratch for each argument of each function. --- Source/cmMacroCommand.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 8bbb7c6e0..8424c7517 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -115,6 +115,15 @@ bool cmMacroHelperCommand::InvokeInitialPass = expandedArgs.begin() + (this->Args.size() - 1); std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";"); std::string expandedArgv = cmJoin(expandedArgs, ";"); + std::vector variables; + variables.reserve(this->Args.size() - 1); + for (unsigned int j = 1; j < this->Args.size(); ++j) + { + std::string variable = "${"; + variable += this->Args[j]; + variable += "}"; + variables.push_back(variable); + } if(!this->Functions.empty()) { this->FilePath = this->Functions[0].FilePath; @@ -147,13 +156,10 @@ bool cmMacroHelperCommand::InvokeInitialPass { tmps = k->Value; // replace formal arguments - for (unsigned int j = 1; j < this->Args.size(); ++j) + for (unsigned int j = 0; j < variables.size(); ++j) { - variable = "${"; - variable += this->Args[j]; - variable += "}"; - cmSystemTools::ReplaceString(tmps, variable.c_str(), - expandedArgs[j-1].c_str()); + cmSystemTools::ReplaceString(tmps, variables[j].c_str(), + expandedArgs[j].c_str()); } // replace argc cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str()); From a551851ab3f23f58074638ffcf38a08d98a35fa8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:14:30 +0100 Subject: [PATCH 0087/1029] cmMacroCommand: Inline variable computation. --- Source/cmMacroCommand.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 8424c7517..6f454847a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -86,7 +86,6 @@ bool cmMacroHelperCommand::InvokeInitialPass std::string tmps; cmListFileArgument arg; - std::string variable; // make sure the number of arguments passed is at least the number // required by the signature @@ -119,10 +118,7 @@ bool cmMacroHelperCommand::InvokeInitialPass variables.reserve(this->Args.size() - 1); for (unsigned int j = 1; j < this->Args.size(); ++j) { - std::string variable = "${"; - variable += this->Args[j]; - variable += "}"; - variables.push_back(variable); + variables.push_back("${" + this->Args[j] + "}"); } if(!this->Functions.empty()) { From 2c4a7298fcb3ac6a6b6c0a9545b343c814f3d6ec Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:23:36 +0100 Subject: [PATCH 0088/1029] cmMacroCommand: Declare arg in the scope that it is used. It can make sense to declare objects outside of loops if the size required by the object can grow (eg std::string when using getline), but that is not the case here. --- Source/cmMacroCommand.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 6f454847a..bd53b1e06 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -85,7 +85,6 @@ bool cmMacroHelperCommand::InvokeInitialPass this->Makefile->ExpandArguments(args, expandedArgs); std::string tmps; - cmListFileArgument arg; // make sure the number of arguments passed is at least the number // required by the signature @@ -144,6 +143,8 @@ bool cmMacroHelperCommand::InvokeInitialPass // Set the FilePath on the arguments to match the function since it is // not stored and the original values may be freed k->FilePath = this->FilePath.c_str(); + + cmListFileArgument arg; if(k->Delim == cmListFileArgument::Bracket) { arg.Value = k->Value; From 6774c92b5809b80c767ef8094b2f26d06556e0fd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:25:44 +0100 Subject: [PATCH 0089/1029] cmMacroCommand: Declare tmps in the scope that it's used. We don't particularly need to reuse the string memory here, and this pattern is not common in CMake. --- Source/cmMacroCommand.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index bd53b1e06..6635fee23 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -84,8 +84,6 @@ bool cmMacroHelperCommand::InvokeInitialPass std::vector expandedArgs; this->Makefile->ExpandArguments(args, expandedArgs); - std::string tmps; - // make sure the number of arguments passed is at least the number // required by the signature if (expandedArgs.size() < this->Args.size() - 1) @@ -151,7 +149,7 @@ bool cmMacroHelperCommand::InvokeInitialPass } else { - tmps = k->Value; + std::string tmps = k->Value; // replace formal arguments for (unsigned int j = 0; j < variables.size(); ++j) { From 4aa7bd2ac11aa2edb0288e5ba360984b7799130d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:06:39 +0100 Subject: [PATCH 0090/1029] cmMacroCommand: Remove condition around ARGN replacement. There is none for ARGC replacement, so no reason to conditionalize the replacement. The computation is already done. --- Source/cmMacroCommand.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 6635fee23..111ad96a0 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -159,11 +159,7 @@ bool cmMacroHelperCommand::InvokeInitialPass // replace argc cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str()); - // repleace ARGN - if (tmps.find("${ARGN}") != std::string::npos) - { - cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str()); - } + cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str()); // if the current argument of the current function has ${ARGV in it // then try replacing ARGV values From 9a1f8f35f48d7dcfefc70de9ae530c31b16cd9e0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:08:05 +0100 Subject: [PATCH 0091/1029] cmMacroCommand: Move ARGV replacement out of condition. --- Source/cmMacroCommand.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 111ad96a0..44b14652c 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -160,14 +160,13 @@ bool cmMacroHelperCommand::InvokeInitialPass cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str()); cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str()); + cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str()); // if the current argument of the current function has ${ARGV in it // then try replacing ARGV values if (tmps.find("${ARGV") != std::string::npos) { char argvName[60]; - cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str()); - // also replace the ARGV1 ARGV2 ... etc for (unsigned int t = 0; t < expandedArgs.size(); ++t) { From 83414d5a07753d004f5e663c385ef0c713895d46 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 20:16:40 +0100 Subject: [PATCH 0092/1029] cmMacroCommand: Move computation of ARGV%n names out of double loop. --- Source/cmMacroCommand.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 44b14652c..49b9fd235 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -117,6 +117,14 @@ bool cmMacroHelperCommand::InvokeInitialPass { variables.push_back("${" + this->Args[j] + "}"); } + std::vector argVs; + argVs.reserve(expandedArgs.size()); + char argvName[60]; + for (unsigned int j = 0; j < expandedArgs.size(); ++j) + { + sprintf(argvName,"${ARGV%i}",j); + argVs.push_back(argvName); + } if(!this->Functions.empty()) { this->FilePath = this->Functions[0].FilePath; @@ -166,12 +174,9 @@ bool cmMacroHelperCommand::InvokeInitialPass // then try replacing ARGV values if (tmps.find("${ARGV") != std::string::npos) { - char argvName[60]; - // also replace the ARGV1 ARGV2 ... etc for (unsigned int t = 0; t < expandedArgs.size(); ++t) { - sprintf(argvName,"${ARGV%i}",t); - cmSystemTools::ReplaceString(tmps, argvName, + cmSystemTools::ReplaceString(tmps, argVs[t].c_str(), expandedArgs[t].c_str()); } } From b5f98e5012ef53ee6746c42131fc66892bfff717 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 22:16:03 +0100 Subject: [PATCH 0093/1029] cmMacroCommand: Manipulate target string directly. Avoid copying a string from the source, manipulating it, and then copying it back. Manipulate it in place instead. --- Source/cmMacroCommand.cxx | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 49b9fd235..29e8cb1f9 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -151,37 +151,33 @@ bool cmMacroHelperCommand::InvokeInitialPass k->FilePath = this->FilePath.c_str(); cmListFileArgument arg; - if(k->Delim == cmListFileArgument::Bracket) + arg.Value = k->Value; + if(k->Delim != cmListFileArgument::Bracket) { - arg.Value = k->Value; - } - else - { - std::string tmps = k->Value; // replace formal arguments for (unsigned int j = 0; j < variables.size(); ++j) { - cmSystemTools::ReplaceString(tmps, variables[j].c_str(), + cmSystemTools::ReplaceString(arg.Value, variables[j].c_str(), expandedArgs[j].c_str()); } // replace argc - cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGC}",argcDef.c_str()); - cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str()); - cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGN}", + expandedArgn.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGV}", + expandedArgv.c_str()); // if the current argument of the current function has ${ARGV in it // then try replacing ARGV values - if (tmps.find("${ARGV") != std::string::npos) + if (arg.Value.find("${ARGV") != std::string::npos) { for (unsigned int t = 0; t < expandedArgs.size(); ++t) { - cmSystemTools::ReplaceString(tmps, argVs[t].c_str(), + cmSystemTools::ReplaceString(arg.Value, argVs[t].c_str(), expandedArgs[t].c_str()); } } - - arg.Value = tmps; } arg.Delim = k->Delim; arg.FilePath = k->FilePath; From 09cdcc54303bf065022a997056f403dd0707bc7e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 12 Feb 2015 00:01:15 -0500 Subject: [PATCH 0094/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 62cc2b698..615214467 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150211) +set(CMake_VERSION_PATCH 20150212) #set(CMake_VERSION_RC 1) From bf8f9c29e745933d5732f4481669c38ba8bdc3fc Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Wed, 11 Feb 2015 20:48:43 +0100 Subject: [PATCH 0095/1029] Xcode: Teach XCODE_ATTRIBUTE target properties about generator expressions Signed-off-by: Gregor Jasny --- Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst | 6 ++++++ Help/release/dev/xcode-attribute-genex.rst | 5 +++++ Source/cmGlobalXCodeGenerator.cxx | 5 ++++- Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 2 ++ .../RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake | 7 +++++++ Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake | 4 ++++ .../XcodeProject/XcodeAttributeGenexError-result.txt | 1 + .../XcodeProject/XcodeAttributeGenexError-stderr.txt | 6 ++++++ Tests/RunCMake/XcodeProject/XcodeAttributeGenexError.cmake | 4 ++++ 9 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/xcode-attribute-genex.rst create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-result.txt create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-stderr.txt create mode 100644 Tests/RunCMake/XcodeProject/XcodeAttributeGenexError.cmake diff --git a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst index de98c3706..7e00ac430 100644 --- a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst +++ b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst @@ -8,3 +8,9 @@ the generated Xcode project. Ignored on other generators. See the :variable:`CMAKE_XCODE_ATTRIBUTE_` variable to set attributes on all targets in a directory tree. + +Contents of ``XCODE_ATTRIBUTE_`` may use +"generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for available +expressions. See the :manual:`cmake-buildsystem(7)` manual +for more on defining buildsystem properties. diff --git a/Help/release/dev/xcode-attribute-genex.rst b/Help/release/dev/xcode-attribute-genex.rst new file mode 100644 index 000000000..3fd5b1c68 --- /dev/null +++ b/Help/release/dev/xcode-attribute-genex.rst @@ -0,0 +1,5 @@ +xcode-attribute-genex +--------------------- + +* The :prop_tgt:`XCODE_ATTRIBUTE_` target property learned + to support generator expressions. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 30ed13462..aea134e11 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2436,8 +2436,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, if (!attribute.empty()) { + cmGeneratorExpression ge; + std::string processed = ge.Parse(i->second.GetValue()) + ->Evaluate(this->CurrentMakefile, configName); buildSettings->AddAttribute(attribute.c_str(), - this->CreateString(i->second.GetValue())); + this->CreateString(processed)); } } } diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 8e4026ba0..792f40e70 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -1,3 +1,5 @@ include(RunCMake) run_cmake(XcodeFileType) +run_cmake(XcodeAttributeGenex) +run_cmake(XcodeAttributeGenexError) diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake new file mode 100644 index 000000000..637df0fd7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake @@ -0,0 +1,7 @@ +set(expect "TEST_HOST = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/some\"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "TEST_HOST = .*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake new file mode 100644 index 000000000..760b882c6 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(some main.c) +add_executable(another main.c) +set_property(TARGET another PROPERTY XCODE_ATTRIBUTE_TEST_HOST "$") diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-result.txt b/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-stderr.txt b/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-stderr.txt new file mode 100644 index 000000000..984415868 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError.cmake new file mode 100644 index 000000000..98ad6c5a8 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenexError.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(some main.c) +add_executable(another main.c) +set_property(TARGET another PROPERTY XCODE_ATTRIBUTE_TEST_HOST "$") From e5ebeae768a8310b5cfdce0aeff9419e1de51eaa Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 23:29:04 +0100 Subject: [PATCH 0096/1029] cmFunctionCommand: Split loop in two. --- Source/cmFunctionCommand.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index b44e228a0..a0a14e82f 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -128,8 +128,6 @@ bool cmFunctionHelperCommand::InvokeInitialPass // define ARGV and ARGN std::vector::const_iterator eit; std::string argvDef; - std::string argnDef; - unsigned int cnt = 0; for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit ) { if (!argvDef.empty()) @@ -137,6 +135,10 @@ bool cmFunctionHelperCommand::InvokeInitialPass argvDef += ";"; } argvDef += *eit; + } + std::string argnDef; + unsigned int cnt = 0; + for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit ) if ( cnt >= this->Args.size()-1 ) { if (!argnDef.empty()) From fc1cf2654de04ed8f6954dc1907ab1dcb8bb946e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 23:31:22 +0100 Subject: [PATCH 0097/1029] cmFunctionCommand: Remove counting variable. Start iteration at correct starting point directly. --- Source/cmFunctionCommand.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index a0a14e82f..088a697b6 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -137,17 +137,13 @@ bool cmFunctionHelperCommand::InvokeInitialPass argvDef += *eit; } std::string argnDef; - unsigned int cnt = 0; - for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit ) - if ( cnt >= this->Args.size()-1 ) + eit = expandedArgs.begin() + (this->Args.size()-1); + for ( ; eit != expandedArgs.end(); ++eit) + if (!argnDef.empty()) { - if (!argnDef.empty()) - { - argnDef += ";"; - } - argnDef += *eit; + argnDef += ";"; } - cnt ++; + argnDef += *eit; } this->Makefile->AddDefinition("ARGV", argvDef.c_str()); this->Makefile->MarkVariableAsUsed("ARGV"); From 78757e7ffce9fb6297a2d501989e9b172e6151dc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 23:33:03 +0100 Subject: [PATCH 0098/1029] cmFunctionCommand: Replace loops with cmJoin. --- Source/cmFunctionCommand.cxx | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 088a697b6..a4d93579e 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -126,25 +126,10 @@ bool cmFunctionHelperCommand::InvokeInitialPass } // define ARGV and ARGN - std::vector::const_iterator eit; - std::string argvDef; - for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit ) - { - if (!argvDef.empty()) - { - argvDef += ";"; - } - argvDef += *eit; - } - std::string argnDef; - eit = expandedArgs.begin() + (this->Args.size()-1); - for ( ; eit != expandedArgs.end(); ++eit) - if (!argnDef.empty()) - { - argnDef += ";"; - } - argnDef += *eit; - } + std::string argvDef = cmJoin(expandedArgs, ";"); + std::vector::const_iterator eit + = expandedArgs.begin() + (this->Args.size()-1); + std::string argnDef = cmJoin(cmRange(eit, expandedArgs.end()), ";"); this->Makefile->AddDefinition("ARGV", argvDef.c_str()); this->Makefile->MarkVariableAsUsed("ARGV"); this->Makefile->AddDefinition("ARGN", argnDef.c_str()); From 8d38ff05e2db3f3bd907f5a3c279fd116010e775 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 13 Feb 2015 00:01:16 -0500 Subject: [PATCH 0099/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 615214467..dcd81911b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150212) +set(CMake_VERSION_PATCH 20150213) #set(CMake_VERSION_RC 1) From a2ccbffd8b4191f7b8b888fafde85eb5e7dbb2e4 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 13 Feb 2015 11:57:20 +0100 Subject: [PATCH 0100/1029] CPackWIX: Extend the patching mechanism to allow adding content to . --- Modules/CPackWIX.cmake | 5 ++++- Modules/WIX.template.in | 1 + Source/CPack/WiX/cmCPackWIXGenerator.cxx | 14 +++++++++++++- Source/CPack/WiX/cmCPackWIXGenerator.h | 4 +++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 0a47e196f..105df96fc 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -148,6 +148,9 @@ # Currently fragments can be injected into most # Component, File and Directory elements. # +# The special Id ``#PRODUCT`` can be used to inject content +# into the ```` element. +# # The following example illustrates how this works. # # Given that the WiX generator creates the following XML element: @@ -233,7 +236,7 @@ # * ARPSIZE - Size (in kilobytes) of the application #============================================================================= -# Copyright 2014 Kitware, Inc. +# Copyright 2014-2015 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/WIX.template.in b/Modules/WIX.template.in index bbb7c8831..c4fc83afa 100644 --- a/Modules/WIX.template.in +++ b/Modules/WIX.template.in @@ -42,5 +42,6 @@ + diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 59c38e9b1..11d5437e7 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2014 Kitware, Inc., Insight Software Consortium + Copyright 2012-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -257,6 +257,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() CreateWiXVariablesIncludeFile(); CreateWiXPropertiesIncludeFile(); + CreateWiXProductFragmentIncludeFile(); if(!CreateWiXSourceFiles()) { @@ -385,6 +386,17 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() } } +void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile() +{ + std::string includeFilename = + this->CPackTopLevel + "/product_fragment.wxi"; + + cmWIXSourceWriter includeFile( + this->Logger, includeFilename, true); + + this->Patch->ApplyFragment("#PRODUCT", includeFile); +} + void cmCPackWIXGenerator::CopyDefinition( cmWIXSourceWriter &source, std::string const& name) { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 8705d404b..703529703 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2012 Kitware, Inc. + Copyright 2012-2015 Kitware, Inc. Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -76,6 +76,8 @@ private: void CreateWiXPropertiesIncludeFile(); + void CreateWiXProductFragmentIncludeFile(); + void CopyDefinition( cmWIXSourceWriter &source, std::string const& name); From d891d47434a181f14554622118c39c954d6a9466 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 13 Feb 2015 11:47:47 -0500 Subject: [PATCH 0101/1029] Tests: Consolidate detection of 'rpmbuild' Several tests use slight variations of the same logic to enable CPack RPM tests. Consolidate this logic into one check before any tests are added. Look for 'rpmbuild' only on Linux and only when the test build tree does not have spaces in the path. In particular, this will make the result available in time for the RunCMake.CPackRPM test to be activated even if CMake is configured exactly once. --- Tests/CMakeLists.txt | 25 +++++++++++++++---------- Tests/RunCMake/CMakeLists.txt | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7e7aa2ec8..cb45e79d3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -102,6 +102,17 @@ if(BUILD_TESTING) list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) endif() + # Look for rpmbuild to use for tests. + # The tool does not work with spaces in the path. + if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") + find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild) + else() + set(RPMBUILD_EXECUTABLE "RPMBUILD_EXECUTABLE-NOTFOUND") + endif() + + #--------------------------------------------------------------------------- + # Add tests below here. + if(NOT CMake_TEST_EXTERNAL_CMAKE) add_subdirectory(CMakeLib) endif() @@ -826,11 +837,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) - if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") - find_program(RPMBUILD NAMES rpmbuild) - endif() # Do not try to build RPM - if (NOT RPMBUILD) + if (NOT RPMBUILD_EXECUTABLE) set(CPACK_BINARY_RPM OFF) endif() @@ -912,7 +920,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CTEST_RUN_CPackComponentsForAll) # Check whether if rpmbuild command is found # before adding RPM tests - find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild) if(RPMBUILD_EXECUTABLE) list(APPEND ACTIVE_CPACK_GENERATORS RPM) endif() @@ -931,11 +938,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(APPLE) list(APPEND GENLST "DragNDrop") endif() - if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") - list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE) - if (NOT ${RPM_ACTIVE} EQUAL -1) - list(APPEND GENLST "RPM") - endif() + list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE) + if (NOT ${RPM_ACTIVE} EQUAL -1) + list(APPEND GENLST "RPM") endif() list(FIND ACTIVE_CPACK_GENERATORS "DEB" DEB_ACTIVE) if (NOT ${DEB_ACTIVE} EQUAL -1) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2de82a7ce..f0426e5e7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -195,6 +195,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) -if(RPMBUILD) +if(RPMBUILD_EXECUTABLE) add_RunCMake_test(CPackRPM) endif() From feb76254c5c9c078f0a66e27f6d5a6a964001e44 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 14 Feb 2015 00:01:14 -0500 Subject: [PATCH 0102/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index dcd81911b..b90522459 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150213) +set(CMake_VERSION_PATCH 20150214) #set(CMake_VERSION_RC 1) From fd8112ea7c594c8e24230f08aa8bebc6117a1cf2 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 15 Feb 2015 00:01:08 -0500 Subject: [PATCH 0103/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b90522459..f69e3640b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150214) +set(CMake_VERSION_PATCH 20150215) #set(CMake_VERSION_RC 1) From 1cecd3a53107f7f670cf011201c1da3a33b795b6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 24 Jan 2015 18:43:37 +0100 Subject: [PATCH 0104/1029] cmListCommand: Use std::find algorithm for FIND subcommand. Use a ostringstream to account for the input being a variable of type size_t as a result of using std::distance. There is no single format string which portably accepts a size_t. --- Source/cmListCommand.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index dd0cfa9d2..ae13fdf98 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -284,18 +284,14 @@ bool cmListCommand::HandleFindCommand(std::vector const& args) return true; } - std::vector::iterator it; - unsigned int index = 0; - for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it ) + std::vector::iterator it = + std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]); + if (it != varArgsExpanded.end()) { - if ( *it == args[2] ) - { - char indexString[32]; - sprintf(indexString, "%d", index); - this->Makefile->AddDefinition(variableName, indexString); - return true; - } - index++; + std::ostringstream indexStream; + indexStream << std::distance(varArgsExpanded.begin(), it); + this->Makefile->AddDefinition(variableName, indexStream.str().c_str()); + return true; } this->Makefile->AddDefinition(variableName, "-1"); From 67a26764b536992a966cacab4811c2d30624405c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 18:02:56 +0100 Subject: [PATCH 0105/1029] cmListCommand: Implement REVERSE subcommand with std::reverse. --- Source/cmListCommand.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index ae13fdf98..22d8b0e98 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -410,15 +410,8 @@ bool cmListCommand return false; } - std::string value; - std::vector::reverse_iterator it; - const char* sep = ""; - for ( it = varArgsExpanded.rbegin(); it != varArgsExpanded.rend(); ++ it ) - { - value += sep; - value += it->c_str(); - sep = ";"; - } + std::reverse(varArgsExpanded.begin(), varArgsExpanded.end()); + std::string value = cmJoin(varArgsExpanded, ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; From 069f2440c471e89dfe2ecf6778bbab16e9fbe491 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 20:07:20 +0100 Subject: [PATCH 0106/1029] cmListCommand: Convert loop to find algorithm. --- Source/cmListCommand.cxx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 22d8b0e98..826632f74 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -104,19 +104,8 @@ bool cmListCommand::GetList(std::vector& list, } // expand the variable into a list cmSystemTools::ExpandListArgument(listString, list, true); - // check the list for empty values - bool hasEmpty = false; - for(std::vector::iterator i = list.begin(); - i != list.end(); ++i) - { - if(i->empty()) - { - hasEmpty = true; - break; - } - } // if no empty elements then just return - if(!hasEmpty) + if (std::find(list.begin(), list.end(), std::string()) == list.end()) { return true; } From 0b5cf0dabd430dfe1289e865b1b51c41066338a7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 18:47:10 +0100 Subject: [PATCH 0107/1029] cmAlgorithms: Implement algorithm for removing indexes. Implement ContainerAlgorithms::RemoveN to remove N elements to the end of a container by rotating. The rotate is implemented in terms of the efficient swap algorithm, optimized even more in the standard library implementation when the compiler supports the rvalue-references feature to move elements. Implement cmRemoveN with a Range API for completeness. std::rotate in C++11 is specified to return an iterator, but c++98 specifies it to return void. libstdc++ 5.0 will be the first version to have the correct return type. Implement ContainerAlgorithms::Rotate in terms of std::rotate and return the correct iterator from it. While std::rotate requires forward iterators, this workaround means cmRotate requires bidirectional iterators. As most of CMake uses random access iterators anyway, this should not be a problem. Implement cmRemoveIndices in terms of the RemoveN algorithm, such that each element which is not removed is rotated only once. This can not use the cmRemoveN range-API algorithm because that would require creating a new range, but the range must be taken by reference and so it can't be a temporary. These remove algorithms are not part of the STL and I couldn't find them anywhere else either. --- Source/cmAlgorithms.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index ad2b9c164..70fdff69c 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -138,6 +138,22 @@ private: const_iterator End; }; +template +BiDirIt Rotate(BiDirIt first, BiDirIt middle, BiDirIt last) +{ + typename std::iterator_traits::difference_type dist = + std::distance(first, middle); + std::rotate(first, middle, last); + std::advance(last, -dist); + return last; +} + +template +Iter RemoveN(Iter i1, Iter i2, size_t n) +{ + return ContainerAlgorithms::Rotate(i1, i1 + n, i2); +} + } template @@ -188,4 +204,26 @@ std::string cmJoin(Range const& r, std::string delimiter) return cmJoin(r, delimiter.c_str()); }; +template +typename Range::const_iterator cmRemoveN(Range& r, size_t n) +{ + return ContainerAlgorithms::RemoveN(r.begin(), r.end(), n); +} + +template +typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) +{ + typename InputRange::const_iterator remIt = rem.begin(); + + typename Range::iterator writer = r.begin() + *remIt; + ++remIt; + size_t count = 1; + for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt) + { + writer = ContainerAlgorithms::RemoveN(writer, r.begin() + *remIt, count); + } + writer = ContainerAlgorithms::RemoveN(writer, r.end(), count); + return writer; +} + #endif From 6a22e40147b7df5285a67b63249562ecbeff112e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 15:23:43 +0100 Subject: [PATCH 0108/1029] cmListCommand: Use cmRemoveIndices for REMOVE_AT subcommand. Avoid repeatedly looping over the indices to process elements (even without breaking out of the loop when the element is found). --- Source/cmListCommand.cxx | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 826632f74..93c6d66c8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -527,26 +527,19 @@ bool cmListCommand::HandleRemoveAtCommand( removed.push_back(static_cast(item)); } + std::sort(removed.begin(), removed.end()); + removed.erase(std::unique(removed.begin(), removed.end()), removed.end()); + + varArgsExpanded.erase(cmRemoveIndices(varArgsExpanded, removed), + varArgsExpanded.end()); + std::string value; const char* sep = ""; for ( cc = 0; cc < varArgsExpanded.size(); ++ cc ) { - size_t kk; - bool found = false; - for ( kk = 0; kk < removed.size(); ++ kk ) - { - if ( cc == removed[kk] ) - { - found = true; - } - } - - if ( !found ) - { - value += sep; - value += varArgsExpanded[cc]; - sep = ";"; - } + value += sep; + value += varArgsExpanded[cc]; + sep = ";"; } this->Makefile->AddDefinition(listName, value.c_str()); From a77af8f1301b6a9964c187ffff7a1893a80fbe90 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 15:46:30 +0100 Subject: [PATCH 0109/1029] cmListCommand: Replace joining loop with cmJoin algorithm. --- Source/cmListCommand.cxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 93c6d66c8..592681b27 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -533,14 +533,8 @@ bool cmListCommand::HandleRemoveAtCommand( varArgsExpanded.erase(cmRemoveIndices(varArgsExpanded, removed), varArgsExpanded.end()); - std::string value; - const char* sep = ""; - for ( cc = 0; cc < varArgsExpanded.size(); ++ cc ) - { - value += sep; - value += varArgsExpanded[cc]; - sep = ";"; - } + std::string value = cmJoin(varArgsExpanded, ";"); + this->Makefile->AddDefinition(listName, value.c_str()); return true; From 050958a3286f69c577fe5d03407800cbe0367898 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 18:58:36 +0100 Subject: [PATCH 0110/1029] cmAlgorithms: Add cmRemoveMatching algorithm. Implement it in terms of std::remove_if with a binary search through a matching range. --- Source/cmAlgorithms.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 70fdff69c..0f162a2e5 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -154,6 +154,23 @@ Iter RemoveN(Iter i1, Iter i2, size_t n) return ContainerAlgorithms::Rotate(i1, i1 + n, i2); } +template +struct BinarySearcher +{ + typedef typename Range::value_type argument_type; + BinarySearcher(Range const& r) + : m_range(r) + { + } + + bool operator()(argument_type const& item) + { + return std::binary_search(m_range.begin(), m_range.end(), item); + } +private: + Range const& m_range; +}; + } template @@ -226,4 +243,11 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) return writer; } +template +typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) +{ + return std::remove_if(r.begin(), r.end(), + ContainerAlgorithms::BinarySearcher(m)); +} + #endif From 3cfe7a4ca876c496f9b491e4175fd1c9be24f3d7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 16:00:54 +0100 Subject: [PATCH 0111/1029] cmListCommand: Implement REMOVE_ITEM in terms of cmRemoveMatching. --- Source/cmListCommand.cxx | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 592681b27..50adce6fe 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -355,23 +355,13 @@ bool cmListCommand return false; } - size_t cc; - for ( cc = 2; cc < args.size(); ++ cc ) - { - size_t kk = 0; - while ( kk < varArgsExpanded.size() ) - { - if ( varArgsExpanded[kk] == args[cc] ) - { - varArgsExpanded.erase(varArgsExpanded.begin()+kk); - } - else - { - kk ++; - } - } - } + std::vector remove(args.begin() + 2, args.end()); + std::sort(remove.begin(), remove.end()); + remove.erase(std::unique(remove.begin(), remove.end()), remove.end()); + varArgsExpanded.erase( + cmRemoveMatching(varArgsExpanded, remove), + varArgsExpanded.end()); std::string value = cmJoin(varArgsExpanded, ";"); this->Makefile->AddDefinition(listName, value.c_str()); From cebeed248606ba92597b7e32a5b0be1f474f7a91 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 19:08:12 +0100 Subject: [PATCH 0112/1029] cmAlgorithms: Add cmRemoveDuplicates algorithm. Start by creating a vector to hold a unique values of the input range. We expect that in most cases, there will be relatively few duplicates, so reserving enough memory for a complete copy is worthwhile. Unlike a solution involving a std::set, this algorithm allocates all the memory it needs in one go and in one place, so it is more cache friendly. Populate the unique copy with a lower_bound insert algorithm and record the indices of duplicates. This is the same complexity as the std::set insert algorithm, but without the need to allocate memory on the heap and other disadvantages of std::set. Remove the duplicates with the cmRemoveIndices algorithm. --- Source/cmAlgorithms.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 0f162a2e5..a9960880f 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -250,4 +250,33 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) ContainerAlgorithms::BinarySearcher(m)); } +template +typename Range::const_iterator cmRemoveDuplicates(Range& r) +{ + std::vector unique; + unique.reserve(r.size()); + std::vector indices; + size_t count = 0; + for(typename Range::const_iterator it = r.begin(); + it != r.end(); ++it, ++count) + { + typename Range::iterator low = + std::lower_bound(unique.begin(), unique.end(), *it); + if (low == unique.end() || *low != *it) + { + unique.insert(low, *it); + } + else + { + indices.push_back(count); + } + } + if (indices.empty()) + { + return r.end(); + } + std::sort(indices.begin(), indices.end()); + return cmRemoveIndices(r, indices); +} + #endif From 1c7c35c3723abfb91f5e9a986ccd4f7e70683baf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 16:22:08 +0100 Subject: [PATCH 0113/1029] cmListCommand: Replace remove duplicates loop with algorithm. --- Source/cmListCommand.cxx | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 50adce6fe..e2ebe0ab7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -418,24 +418,9 @@ bool cmListCommand return false; } - std::string value; - - - std::set unique; - std::vector::iterator it; - const char* sep = ""; - for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it ) - { - if (unique.find(*it) != unique.end()) - { - continue; - } - unique.insert(*it); - value += sep; - value += it->c_str(); - sep = ";"; - } - + varArgsExpanded.erase(cmRemoveDuplicates(varArgsExpanded), + varArgsExpanded.end()); + std::string value = cmJoin(varArgsExpanded, ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; From 116459d34fab6327906e901753611636f84a16c1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 15:48:51 +0100 Subject: [PATCH 0114/1029] cmListCommand: Avoid needlessly erasing from vectors. The entire vector will be destroyed at once at the end of the scope, and the remove algorithms already give us the end of the range of interesting values, so just use those sentinals. --- Source/cmListCommand.cxx | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index e2ebe0ab7..98dcef109 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -357,13 +357,14 @@ bool cmListCommand std::vector remove(args.begin() + 2, args.end()); std::sort(remove.begin(), remove.end()); - remove.erase(std::unique(remove.begin(), remove.end()), remove.end()); + std::vector::const_iterator remEnd = + std::unique(remove.begin(), remove.end()); + std::vector::const_iterator remBegin = remove.begin(); - varArgsExpanded.erase( - cmRemoveMatching(varArgsExpanded, remove), - varArgsExpanded.end()); - - std::string value = cmJoin(varArgsExpanded, ";"); + std::vector::const_iterator argsEnd = + cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd)); + std::vector::const_iterator argsBegin = varArgsExpanded.begin(); + std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -418,9 +419,11 @@ bool cmListCommand return false; } - varArgsExpanded.erase(cmRemoveDuplicates(varArgsExpanded), - varArgsExpanded.end()); - std::string value = cmJoin(varArgsExpanded, ";"); + std::vector::const_iterator argsEnd = + cmRemoveDuplicates(varArgsExpanded); + std::vector::const_iterator argsBegin = + varArgsExpanded.begin(); + std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; @@ -503,13 +506,14 @@ bool cmListCommand::HandleRemoveAtCommand( } std::sort(removed.begin(), removed.end()); - removed.erase(std::unique(removed.begin(), removed.end()), removed.end()); - - varArgsExpanded.erase(cmRemoveIndices(varArgsExpanded, removed), - varArgsExpanded.end()); - - std::string value = cmJoin(varArgsExpanded, ";"); + std::vector::const_iterator remEnd = + std::unique(removed.begin(), removed.end()); + std::vector::const_iterator remBegin = removed.begin(); + std::vector::const_iterator argsEnd = + cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd)); + std::vector::const_iterator argsBegin = varArgsExpanded.begin(); + std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; From f724ab5e78ec71b22c8b5dc9e894d3feb288c620 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 16 Feb 2015 00:01:09 -0500 Subject: [PATCH 0115/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f69e3640b..46d0888e4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150215) +set(CMake_VERSION_PATCH 20150216) #set(CMake_VERSION_RC 1) From aa2ba12164046cd1812c3f3b67cadca856d51846 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 16 Feb 2015 11:11:37 -0500 Subject: [PATCH 0116/1029] VS: Use $(ConfigurationName) as CMAKE_CFG_INTDIR in VS 7, 8, 9 This will allow us to use a value other than just the config name for the project OutputDirectory setting used for $(OutDir). Also use $(ConfigurationName) instead of $(OutDir) for the link directory configuration suffix since that is a hard-coded instance of a use case for CMAKE_CFG_INTDIR. --- Help/release/dev/vs7-OutputDirectory.rst | 10 ++++++++++ Help/variable/CMAKE_CFG_INTDIR.rst | 10 +++++----- Source/cmGlobalVisualStudio7Generator.h | 3 ++- Source/cmLocalVisualStudio7Generator.cxx | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 Help/release/dev/vs7-OutputDirectory.rst diff --git a/Help/release/dev/vs7-OutputDirectory.rst b/Help/release/dev/vs7-OutputDirectory.rst new file mode 100644 index 000000000..2725d0c59 --- /dev/null +++ b/Help/release/dev/vs7-OutputDirectory.rst @@ -0,0 +1,10 @@ +vs7-OutputDirectory +------------------- + +* The :variable:`CMAKE_CFG_INTDIR` variable value for Visual Studio + 7, 8, and 9 is now ``$(ConfigurationName)`` instead of ``$(OutDir)``. + This should have no effect on the intended use cases of the variable. + +* With Visual Studio 7, 8, and 9 generators the value of the ``$(OutDir)`` + placeholder no longer evaluates to the configuration name. Projects + should use ``$(ConfigurationName)`` for that instead. diff --git a/Help/variable/CMAKE_CFG_INTDIR.rst b/Help/variable/CMAKE_CFG_INTDIR.rst index 20435e590..55f7b0141 100644 --- a/Help/variable/CMAKE_CFG_INTDIR.rst +++ b/Help/variable/CMAKE_CFG_INTDIR.rst @@ -12,11 +12,11 @@ values: :: - $(IntDir) = Visual Studio 6 - $(OutDir) = Visual Studio 7, 8, 9 - $(Configuration) = Visual Studio 10 - $(CONFIGURATION) = Xcode - . = Make-based tools + $(IntDir) = Visual Studio 6 + $(ConfigurationName) = Visual Studio 7, 8, 9 + $(Configuration) = Visual Studio 10 + $(CONFIGURATION) = Xcode + . = Make-based tools Since these values are evaluated by the native build system, this variable is suitable only for use in command lines that will be diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 201a6a61d..b591653e3 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -94,7 +94,8 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; } + virtual const char* GetCMakeCFGIntDir() const + { return "$(ConfigurationName)"; } /** Return true if the target project file should have the option LinkLibraryDependencies and link to .sln dependencies. */ diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 914df5f2c..88c528416 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1441,7 +1441,8 @@ cmLocalVisualStudio7Generator // First search a configuration-specific subdirectory and then the // original directory. - fout << comma << this->ConvertToXMLOutputPath((dir+"/$(OutDir)").c_str()) + fout << comma + << this->ConvertToXMLOutputPath((dir+"/$(ConfigurationName)").c_str()) << "," << this->ConvertToXMLOutputPath(dir.c_str()); comma = ","; } From fa8b30ebb57da8ddc3e3616c4d212811abc19335 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 16 Feb 2015 11:13:43 -0500 Subject: [PATCH 0117/1029] VS: Fix .vcproj and .vfproj file OutputDirectory generation Teach cmLocalVisualStudio7Generator to set 'OutputDirectory' using the same method as is used to set the 'OutputFile' in the generated project file. Also, OutputDirectory only needs to be set for targets that run the linker or librarian. These two changes make the VS 7 OutputDirectory consistent with what cmVisualStudio10TargetGenerator generates for OutDir. Without this, since the VS Intel Fortran plugin for VS >= 10 still uses the VS 7 .vfproj file format, when executing test VSGNUFortran using Intel Fortran Compiler 15.xx, the following warning is issued just before compilation: TargetPath(...) does not match the Linker's OutputFile property value (...). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). Subsequently, an error is reported during linking. Inspired-by: Vincent Newsum --- Source/cmLocalVisualStudio7Generator.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 88c528416..ed560aa14 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -669,8 +669,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, static_cast(this->GlobalGenerator); fout << "\t\tGetPlatformName() << "\"\n" - << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; + << "|" << gg->GetPlatformName() << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library // 2 == dll @@ -798,6 +797,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; intermediateDir += configName; + + if (target.GetType() < cmTarget::UTILITY) + { + std::string const& outDir = + target.GetType() == cmTarget::OBJECT_LIBRARY? + intermediateDir : target.GetDirectory(configName); + fout << "\t\t\tOutputDirectory=\"" + << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n"; + } + fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" From 034f8e0bd9a2b8a319fead5042ee5782a0df03fd Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 17 Feb 2015 00:01:08 -0500 Subject: [PATCH 0118/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 46d0888e4..6c4deca7e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150216) +set(CMake_VERSION_PATCH 20150217) #set(CMake_VERSION_RC 1) From c697c1fafef16f00e4ec6a72d12eb3a43c01879a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 19:51:54 +0100 Subject: [PATCH 0119/1029] cmTarget: Remove template argument workaround. Pre-C++98 compilers required that the template argument be used in the function parameters. Those compilers are no longer supported as hosts, so drop the workaround. --- Help/manual/cmake-developer.7.rst | 28 ---------------------------- Source/cmTarget.cxx | 14 +++++--------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index e18250c6a..7bffa4253 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -28,34 +28,6 @@ Some implementations have a ``std::auto_ptr`` which can not be used as a return value from a function. ``std::auto_ptr`` may not be used. Use ``cmsys::auto_ptr`` instead. -Template Parameter Defaults ---------------------------- - -On ancient compilers, C++ template must use template parameters in function -arguments. If no parameter of that type is needed, the common workaround is -to add a defaulted pointer to the type to the templated function. However, -this does not work with other ancient compilers: - -.. code-block:: c++ - - template - PropertyType getTypedProperty(cmTarget* tgt, const char* prop, - PropertyType* = 0) // Wrong - { - - } - -.. code-block:: c++ - - template - PropertyType getTypedProperty(cmTarget* tgt, const char* prop, - PropertyType*) // Ok - { - - } - -and invoke it with the value ``0`` explicitly in all cases. - size_t ------ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 526a923f4..1ad0d486a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4711,13 +4711,11 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const //---------------------------------------------------------------------------- template -PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop, - PropertyType *); +PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop); //---------------------------------------------------------------------------- template<> -bool getTypedProperty(cmTarget const* tgt, const std::string& prop, - bool *) +bool getTypedProperty(cmTarget const* tgt, const std::string& prop) { return tgt->GetPropertyAsBool(prop); } @@ -4725,8 +4723,7 @@ bool getTypedProperty(cmTarget const* tgt, const std::string& prop, //---------------------------------------------------------------------------- template<> const char *getTypedProperty(cmTarget const* tgt, - const std::string& prop, - const char **) + const std::string& prop) { return tgt->GetProperty(prop); } @@ -4937,8 +4934,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, CompatibleType t, PropertyType *) { - PropertyType propContent = getTypedProperty(tgt, p, - 0); + PropertyType propContent = getTypedProperty(tgt, p); const bool explicitlySet = tgt->GetProperties() .find(p) != tgt->GetProperties().end(); @@ -4991,7 +4987,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, != theTarget->GetProperties().end(); PropertyType ifacePropContent = getTypedProperty(theTarget, - interfaceProperty, 0); + interfaceProperty); std::string reportEntry; if (ifaceIsSet) From 62429a1e54ec443edda35074bc66805d6e602f89 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 20:00:19 +0100 Subject: [PATCH 0120/1029] cmGlobalGenerator: Remove unneeded pointer check. Deleting nullptr is ok. --- Source/cmGlobalGenerator.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6d0fedc16..227462d48 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -74,11 +74,7 @@ cmGlobalGenerator::cmGlobalGenerator() cmGlobalGenerator::~cmGlobalGenerator() { this->ClearGeneratorMembers(); - - if (this->ExtraGenerator) - { - delete this->ExtraGenerator; - } + delete this->ExtraGenerator; } bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, From 1ee4721f7c7d0d889e00c0a2cdb799e71a4b5574 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 20:01:46 +0100 Subject: [PATCH 0121/1029] Help: Fix formatting of command parameter. --- Help/command/target_compile_definitions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst index 3c9fe8758..8bd323375 100644 --- a/Help/command/target_compile_definitions.rst +++ b/Help/command/target_compile_definitions.rst @@ -9,7 +9,7 @@ Add compile definitions to a target. [items1...] [ [items2...] ...]) -Specify compile definitions to use when compiling a given ``. The named ```` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an :ref:`Imported Target `. From 0550b9e330d75dfcb02257c998706759574cd9c0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 1 Jan 2015 13:41:48 +0100 Subject: [PATCH 0122/1029] Revert "Attempt to fix the compile of cmake on Sun CC." This reverts commit a573a856581118d7a9d8dd7be1f613ba7b1ddb04. The workaround is not needed on supported SolarisStudio compilers. --- Source/cmGeneratorExpressionEvaluator.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6692a9265..ba18faabb 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,10 +24,7 @@ #include //---------------------------------------------------------------------------- -#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510 -static -#endif -void reportError(cmGeneratorExpressionContext *context, +static void reportError(cmGeneratorExpressionContext *context, const std::string &expr, const std::string &result) { context->HadError = true; From 6010f93632c8de9405bc97e40fc06f5949c09976 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 1 Jan 2015 13:41:54 +0100 Subject: [PATCH 0123/1029] Revert "cmGlobalGenerator: Fix value type pushed into autogens vector" This reverts commit ae6fc555a7e8929f6d96545bd1137c8bd378566d. Use the more-natural make_pair algorithm. The compiler motivating the need for this is not supported as a host anymore. --- Source/cmGlobalGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 227462d48..1de4a5976 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1387,7 +1387,7 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) cmQtAutoGenerators autogen; if(autogen.InitializeAutogenTarget(&target)) { - autogens.push_back(AutogensType::value_type(autogen, &target)); + autogens.push_back(std::make_pair(autogen, &target)); } } } From cfb8483412761e567f64343ccc008b44150a901b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 19:48:21 +0100 Subject: [PATCH 0124/1029] Update comment to match recent dashboard testing. --- Source/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8a83c3e3d..69bc2a1b6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -520,8 +520,8 @@ if(APPLE) target_link_libraries(CMakeLib "-framework CoreFoundation") endif() -# On some platforms we need the rpcrt4 library for the VS 7 generators. if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) + # We need the rpcrt4 library for at least the VS7-VC10 generators. target_link_libraries(CMakeLib rpcrt4) endif() From 26602cf56c4697a589f320809afa7a127268d09f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 08:08:26 +0100 Subject: [PATCH 0125/1029] cmLocalGenerator: Move variable population inside of condition. It is only used in the condition, so no need to look for uses elsewhere when reading the code. --- Source/cmLocalGenerator.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 35956aded..6a6135b78 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1952,14 +1952,13 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, // Write the library flags to the build rule. fout << linkLibs; - // Get the RPATH entries. - std::vector runtimeDirs; - cli.GetRPath(runtimeDirs, relink); - // Check what kind of rpath flags to use. if(cli.GetRuntimeSep().empty()) { // Each rpath entry gets its own option ("-R a -R b -R c") + std::vector runtimeDirs; + cli.GetRPath(runtimeDirs, relink); + std::string rpath; for(std::vector::iterator ri = runtimeDirs.begin(); ri != runtimeDirs.end(); ++ri) From 2d833232a35715e412a40ee6207137ecfee7da36 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 21:03:34 +0100 Subject: [PATCH 0126/1029] cmCoreTryCompile: Remove variable assignment. The variable is not a reference, and we return in the same scope after assigning, so it has no effect. --- Source/cmCoreTryCompile.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index d9369e6e7..8e20c14e8 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -685,8 +685,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName) command += tmpOutputFile; if(cmSystemTools::FileExists(command.c_str())) { - tmpOutputFile = cmSystemTools::CollapseFullPath(command); - this->OutputFile = tmpOutputFile; + this->OutputFile = cmSystemTools::CollapseFullPath(command); return; } } From 2acd04c96624ce530edcb0ca991bddad7f70023e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 22:14:08 +0100 Subject: [PATCH 0127/1029] cmcmd: Remove some comment copy-pasta. --- Source/cmcmd.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5c9397519..6a7dc6ea5 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -287,8 +287,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } #if defined(CMAKE_BUILD_WITH_CMAKE) - // Command to create a symbolic link. Fails on platforms not - // supporting them. else if (args[1] == "environment" ) { std::vector env = cmSystemTools::GetEnvironmentVariables(); @@ -352,8 +350,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { for (std::string::size_type cc = 2; cc < args.size(); cc ++) { - // Complain if the file could not be removed, still exists, - // and the -f option was not given. if(!cmSystemTools::Touch(args[cc], true)) { return 1; From 74906322585034968142e1d1663f604e2c97332c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 17 Feb 2015 09:02:03 +0100 Subject: [PATCH 0128/1029] cmAlgorithms: Remove sort of already-sorted container. The indices is populated by an increasing number. --- Source/cmAlgorithms.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index a9960880f..dc4f2758a 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -275,7 +275,6 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) { return r.end(); } - std::sort(indices.begin(), indices.end()); return cmRemoveIndices(r, indices); } From 10e53e230811b94701d86e8c78e38df5abf69ee8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 17 Feb 2015 19:32:52 +0100 Subject: [PATCH 0129/1029] cmAlgorithms: Add missing const to functors. --- Source/cmAlgorithms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index dc4f2758a..8491838e5 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -99,7 +99,7 @@ template::value> struct DefaultDeleter { - void operator()(typename Container::value_type value) { + void operator()(typename Container::value_type value) const { delete value; } }; @@ -107,7 +107,7 @@ struct DefaultDeleter template struct DefaultDeleter { - void operator()(typename Container::value_type value) { + void operator()(typename Container::value_type value) const { delete value.second; } }; @@ -163,7 +163,7 @@ struct BinarySearcher { } - bool operator()(argument_type const& item) + bool operator()(argument_type const& item) const { return std::binary_search(m_range.begin(), m_range.end(), item); } From 75661fdfd94fef4b8f1e8112aa75d76d1cc366e6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 25 Jan 2015 15:20:56 +0100 Subject: [PATCH 0130/1029] cmListCommand: Move size variable out of loop. Re-use it where possible in two instances. --- Source/cmListCommand.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 98dcef109..0c6adfd11 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -202,12 +202,12 @@ bool cmListCommand::HandleGetCommand(std::vector const& args) std::string value; size_t cc; const char* sep = ""; + size_t nitem = varArgsExpanded.size(); for ( cc = 2; cc < args.size()-1; cc ++ ) { int item = atoi(args[cc].c_str()); value += sep; sep = ";"; - size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { item = (int)nitem + item; @@ -216,8 +216,8 @@ bool cmListCommand::HandleGetCommand(std::vector const& args) { std::ostringstream str; str << "index: " << item << " out of range (-" - << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << nitem << ", " + << nitem - 1 << ")"; this->SetError(str.str()); return false; } @@ -485,10 +485,10 @@ bool cmListCommand::HandleRemoveAtCommand( size_t cc; std::vector removed; + size_t nitem = varArgsExpanded.size(); for ( cc = 2; cc < args.size(); ++ cc ) { int item = atoi(args[cc].c_str()); - size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { item = (int)nitem + item; @@ -497,8 +497,8 @@ bool cmListCommand::HandleRemoveAtCommand( { std::ostringstream str; str << "index: " << item << " out of range (-" - << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << nitem << ", " + << nitem - 1 << ")"; this->SetError(str.str()); return false; } From 6652afe66961bcbb5ff17dd7b8a3a91da62f2712 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 13:42:17 +0100 Subject: [PATCH 0131/1029] CTest: Use clear instead of erase-all. --- Source/CTest/cmCTestBuildAndTestHandler.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index d90aeb7b5..4cdce71b7 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -32,8 +32,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() //---------------------------------------------------------------------- void cmCTestBuildAndTestHandler::Initialize() { - this->BuildTargets.erase( - this->BuildTargets.begin(), this->BuildTargets.end()); + this->BuildTargets.clear(); this->Superclass::Initialize(); } From 4fb9e847c0c757ff6e1ee430bbb9fc2b6b4e2ae6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 18 Feb 2015 00:01:09 -0500 Subject: [PATCH 0132/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6c4deca7e..368944392 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150217) +set(CMake_VERSION_PATCH 20150218) #set(CMake_VERSION_RC 1) From a0f17fbe9cc8c8d30d8c1a4df50c4af5fc4e63d1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Feb 2015 09:37:14 -0500 Subject: [PATCH 0133/1029] Windows-GNU: Do not tell find_library to treat '.dll' as linkable Modern software distributions always use a separate ".dll.a" or ".lib" import library for linking. --- Help/release/dev/mingw-no-find_library-dll.rst | 8 ++++++++ Modules/Platform/Windows-GNU.cmake | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/mingw-no-find_library-dll.rst diff --git a/Help/release/dev/mingw-no-find_library-dll.rst b/Help/release/dev/mingw-no-find_library-dll.rst new file mode 100644 index 000000000..1b0c19ba2 --- /dev/null +++ b/Help/release/dev/mingw-no-find_library-dll.rst @@ -0,0 +1,8 @@ +mingw-no-find_library-dll +------------------------- + +* When building with GNU tools on Windows (MinGW tools), the + :command:`find_library` command will no longer consider + ``.dll`` files to be linkable libraries. All dynamic link + libraries are expected to provide separate ``.dll.a`` or + ``.lib`` import libraries. diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index ffc56573f..a7653cfee 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -35,7 +35,7 @@ endif() if(MINGW) set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib") set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") endif() From d1cf09e3c2ded58d08288a42c0eb9038727c22c7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Feb 2015 12:30:59 -0500 Subject: [PATCH 0134/1029] CMakeParseImplicitLinkInfo: Avoid if() auto-deref in quoted arg When matching implicit library names, use a sentinel "x" to avoid ever expanding the library name as a variable. This was detected by a CMP0054 warning. --- Modules/CMakeParseImplicitLinkInfo.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index fcc13da82..8abc465f9 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -124,7 +124,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj # We remove items that are not language-specific. set(implicit_libs "") foreach(lib IN LISTS implicit_libs_tmp) - if("${lib}" MATCHES "^(crt.*\\.o|gcc.*|System.*)$") + if("x${lib}" MATCHES "^x(crt.*\\.o|gcc.*|System.*)$") set(log "${log} remove lib [${lib}]\n") elseif(IS_ABSOLUTE "${lib}") get_filename_component(abs "${lib}" ABSOLUTE) From e6ca1b82744154fa048634abdc353e4118a11979 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 20:47:53 +0100 Subject: [PATCH 0135/1029] cmCTest: Convert loop to member insert. --- Source/cmCTest.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index f08b87c9c..69573ac0e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2256,10 +2256,9 @@ int cmCTest::Run(std::vector &args, std::string* output) bool SRArgumentSpecified = false; // copy the command line - for(size_t i=0; i < args.size(); ++i) - { - this->InitialCommandLineArguments.push_back(args[i]); - } + this->InitialCommandLineArguments.insert( + this->InitialCommandLineArguments.end(), + args.begin(), args.end()); // process the command line arguments for(size_t i=1; i < args.size(); ++i) From 470cff497bc26d48ee05de0b260af2546bb7698c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 22:39:46 +0100 Subject: [PATCH 0136/1029] cmMakefile: Replace loop with composed algorithm. --- Source/cmMakefile.cxx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ac5fec9c3..2085a973e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1472,18 +1472,11 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) cmSystemTools::ExpandListArgument(cdefs, defs); // Recompose the list without the definition. - std::string ndefs; - const char* sep = ""; - for(std::vector::const_iterator di = defs.begin(); - di != defs.end(); ++di) - { - if(*di != define) - { - ndefs += sep; - sep = ";"; - ndefs += *di; - } - } + std::vector::const_iterator defEnd = + std::remove(defs.begin(), defs.end(), define); + std::vector::const_iterator defBegin = + defs.begin(); + std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";"); // Store the new list. this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str()); From ee269f4f16300b0427c1e1baef94b85ccc4ea13f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 00:40:54 +0100 Subject: [PATCH 0137/1029] cmMakefile: Replace two loops with std::replace. --- Source/cmMakefile.cxx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2085a973e..0d0c60a06 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1341,19 +1341,8 @@ void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags) { // remove any \n\r std::string ret = flag; - std::string::size_type pos = 0; - while((pos = ret.find('\n', pos)) != std::string::npos) - { - ret[pos] = ' '; - pos++; - } - pos = 0; - while((pos = ret.find('\r', pos)) != std::string::npos) - { - ret[pos] = ' '; - pos++; - } - + std::replace(ret.begin(), ret.end(), '\n', ' '); + std::replace(ret.begin(), ret.end(), '\r', ' '); dflags += " "; dflags += ret; } From f20a4257f2889387fcbf540b29b16f10843f2f9e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 00:44:45 +0100 Subject: [PATCH 0138/1029] cmMakefile: Add flag to result and manipulate in place. Rather than creating a string, manipulating it, and then copying it to the result. --- Source/cmMakefile.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0d0c60a06..6fd569e64 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1340,11 +1340,11 @@ void cmMakefile::AddDefineFlag(const char* flag) void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags) { // remove any \n\r - std::string ret = flag; - std::replace(ret.begin(), ret.end(), '\n', ' '); - std::replace(ret.begin(), ret.end(), '\r', ' '); - dflags += " "; - dflags += ret; + std::string::size_type initSize = dflags.size(); + dflags += std::string(" ") + flag; + std::string::iterator flagStart = dflags.begin() + initSize + 1; + std::replace(flagStart, dflags.end(), '\n', ' '); + std::replace(flagStart, dflags.end(), '\r', ' '); } From b3a0c6e08f36efc5f3cd4c1a0d9614a789f91e38 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 23:45:25 +0100 Subject: [PATCH 0139/1029] cmLocalGenerator: Convert loop to algorithm. --- Source/cmLocalGenerator.cxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6a6135b78..2accf47cb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2800,12 +2800,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, } if(this->WindowsShell) { - std::string::size_type pos = 0; - while((pos = result.find('/', pos)) != std::string::npos) - { - result[pos] = '\\'; - pos++; - } + std::replace(result.begin(), result.end(), '/', '\\'); } result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); } From ee5bc006ebee898729b81237719106704a2bb38a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 21:58:07 +0100 Subject: [PATCH 0140/1029] cmGeneratorTarget: Replace set insert algorithm with cmRemoveDuplicates. --- Source/cmGeneratorTarget.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a4f099bb3..44c9e9a59 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -528,23 +528,22 @@ cmGeneratorTarget::UseObjectLibraries(std::vector& objs, std::vector objectFiles; this->GetExternalObjects(objectFiles, config); std::vector objectLibraries; - std::set emitted; for(std::vector::const_iterator it = objectFiles.begin(); it != objectFiles.end(); ++it) { std::string objLib = (*it)->GetObjectLibrary(); if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib)) { - if (emitted.insert(tgt).second) - { - objectLibraries.push_back(tgt); - } + objectLibraries.push_back(tgt); } } + std::vector::const_iterator end + = cmRemoveDuplicates(objectLibraries); + for(std::vector::const_iterator ti = objectLibraries.begin(); - ti != objectLibraries.end(); ++ti) + ti != end; ++ti) { cmTarget* objLib = *ti; cmGeneratorTarget* ogt = From 9c225767873ce64a745e865c6f1c3372a8ab45d9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 22:45:01 +0100 Subject: [PATCH 0141/1029] cmGlobalGenerator: Replace set::insert algorithm with cmRemoveDuplicates. --- Source/cmGlobalGenerator.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1de4a5976..c976c699b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2937,14 +2937,11 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) { target->GetSourceFiles(sources, *ci); } - std::set emitted; + std::vector::const_iterator sourcesEnd + = cmRemoveDuplicates(sources); for(std::vector::const_iterator si = sources.begin(); - si != sources.end(); ++si) + si != sourcesEnd; ++si) { - if (!emitted.insert(*si).second) - { - continue; - } Json::Value& lj_source = lj_sources.append(Json::objectValue); cmSourceFile* sf = *si; std::string const& sfp = sf->GetFullPath(); From f7fc99cec6a1db6c53dbf5158b2fb95534704b37 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 19 Feb 2015 00:01:10 -0500 Subject: [PATCH 0142/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 368944392..92f6278cb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150218) +set(CMake_VERSION_PATCH 20150219) #set(CMake_VERSION_RC 1) From e6ebc814dfa022680038a3855eb1eee56f6015f0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:24:31 -0500 Subject: [PATCH 0143/1029] Fortran: Add infrastructure to detect compiler version (#15372) Fortran does not offer syntax to compose a string literal at preprocessing time from numeric compuations. Instead encode each digit of each component as a separate INFO string and compose them in CMake code after extraction. Support MAJOR, MINOR, PATCH, and TWEAK components with up to 8 digits each. --- Modules/CMakeDetermineCompilerId.cmake | 41 ++++++++++++++++++++- Modules/CMakeDetermineFortranCompiler.cmake | 41 +++++++++++++++++++++ Modules/CMakeFortranCompilerId.F.in | 22 +++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index dfed00e77..d22a867c5 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -409,12 +409,28 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # Read the compiler identification string from the executable file. set(COMPILER_ID) set(COMPILER_VERSION) + set(COMPILER_VERSION_MAJOR 0) + set(COMPILER_VERSION_MINOR 0) + set(COMPILER_VERSION_PATCH 0) + set(COMPILER_VERSION_TWEAK 0) + set(HAVE_COMPILER_VERSION_MAJOR 0) + set(HAVE_COMPILER_VERSION_MINOR 0) + set(HAVE_COMPILER_VERSION_PATCH 0) + set(HAVE_COMPILER_VERSION_TWEAK 0) + set(DIGIT_VALUE_1 1) + set(DIGIT_VALUE_2 10) + set(DIGIT_VALUE_3 100) + set(DIGIT_VALUE_4 1000) + set(DIGIT_VALUE_5 10000) + set(DIGIT_VALUE_6 100000) + set(DIGIT_VALUE_7 1000000) + set(DIGIT_VALUE_8 10000000) set(PLATFORM_ID) set(ARCHITECTURE_ID) set(SIMULATE_ID) set(SIMULATE_VERSION) file(STRINGS ${file} - CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") + CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") set(COMPILER_ID_TWICE) foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]") @@ -433,6 +449,15 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}") string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") endif() + foreach(comp MAJOR MINOR PATCH TWEAK) + foreach(digit 1 2 3 4 5 6 7 8 9) + if("${info}" MATCHES "INFO:compiler_version_${comp}_digit_${digit}\\[([0-9])\\]") + set(value ${CMAKE_MATCH_1}) + math(EXPR COMPILER_VERSION_${comp} "${COMPILER_VERSION_${comp}} + ${value} * ${DIGIT_VALUE_${digit}}") + set(HAVE_COMPILER_VERSION_${comp} 1) + endif() + endforeach() + endforeach() if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]") set(SIMULATE_ID "${CMAKE_MATCH_1}") endif() @@ -445,6 +470,20 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endforeach() + # Construct compiler version from components if needed. + if(NOT DEFINED COMPILER_VERSION AND HAVE_COMPILER_VERSION_MAJOR) + set(COMPILER_VERSION "${COMPILER_VERSION_MAJOR}") + if(HAVE_COMPILER_VERSION_MINOR) + set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_MINOR}") + if(HAVE_COMPILER_VERSION_PATCH) + set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_PATCH}") + if(HAVE_COMPILER_VERSION_TWEAK) + set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_TWEAK}") + endif() + endif() + endif() + endif() + # Detect the exact architecture from the PE header. if(WIN32) # The offset to the PE signature is stored at 0x3c. diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index a4bb86cac..3a27127e2 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -119,6 +119,47 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") + set(_version_info "") + foreach(m MAJOR MINOR PATCH TWEAK) + set(_COMP "_${m}") + set(_version_info "${_version_info} +#if defined(COMPILER_VERSION${_COMP})") + foreach(d 1 2 3 4 5 6 7 8) + set(_version_info "${_version_info} +# undef DEC +# undef HEX +# define DEC(n) DEC_${d}(n) +# define HEX(n) HEX_${d}(n) +# if COMPILER_VERSION${_COMP} == 0 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[0]' +# elif COMPILER_VERSION${_COMP} == 1 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[1]' +# elif COMPILER_VERSION${_COMP} == 2 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[2]' +# elif COMPILER_VERSION${_COMP} == 3 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[3]' +# elif COMPILER_VERSION${_COMP} == 4 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[4]' +# elif COMPILER_VERSION${_COMP} == 5 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[5]' +# elif COMPILER_VERSION${_COMP} == 6 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[6]' +# elif COMPILER_VERSION${_COMP} == 7 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[7]' +# elif COMPILER_VERSION${_COMP} == 8 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[8]' +# elif COMPILER_VERSION${_COMP} == 9 + PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[9]' +# endif +") + endforeach() + set(_version_info "${_version_info} +#endif") + endforeach() + set(CMAKE_Fortran_COMPILER_ID_VERSION_INFO "${_version_info}") + unset(_version_info) + unset(_COMP) + # Try to identify the compiler. set(CMAKE_Fortran_COMPILER_ID) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 53495051d..955ca8508 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -134,4 +134,26 @@ PRINT *, 'INFO:arch[X86]' # endif #endif + +#if 0 +! Encode compiler version digits +#endif +#define DEC_8(n) (((n) / 10000000) % 10) +#define DEC_7(n) (((n) / 1000000) % 10) +#define DEC_6(n) (((n) / 100000) % 10) +#define DEC_5(n) (((n) / 10000) % 10) +#define DEC_4(n) (((n) / 1000) % 10) +#define DEC_3(n) (((n) / 100) % 10) +#define DEC_2(n) (((n) / 10) % 10) +#define DEC_1(n) (((n) ) % 10) +#define HEX_8(n) ((n)>>28 & 0xF) +#define HEX_7(n) ((n)>>24 & 0xF) +#define HEX_6(n) ((n)>>20 & 0xF) +#define HEX_5(n) ((n)>>16 & 0xF) +#define HEX_4(n) ((n)>>12 & 0xF) +#define HEX_3(n) ((n)>>8 & 0xF) +#define HEX_2(n) ((n)>>4 & 0xF) +#define HEX_1(n) ((n) & 0xF) +@CMAKE_Fortran_COMPILER_ID_VERSION_INFO@ + END From 2e09c4230f601ef5d744a2e43643e214a149ba39 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:26:14 -0500 Subject: [PATCH 0144/1029] Fortran: Detect Intel compiler version Port logic from the "Compiler/Intel-DetermineCompiler" module into "CMakeFortranCompilerId.F.in". --- Modules/CMakeFortranCompilerId.F.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 955ca8508..956576d1b 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -4,6 +4,17 @@ #endif #if defined(__INTEL_COMPILER) || defined(__ICC) PRINT *, 'INFO:compiler[Intel]' +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif + # if defined(_MSC_VER) PRINT *, 'INFO:simulate[MSVC]' # if _MSC_VER >= 1800 From aa77b631d9fc94e7ba69929560d4592e1ab12a04 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:27:22 -0500 Subject: [PATCH 0145/1029] Fortran: Detect SunPro compiler version Port logic from "Compiler/SunPro-*DetermineCompiler" modules into "CMakeFortranCompilerId.F.in". --- Modules/CMakeFortranCompilerId.F.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 956576d1b..5e8f64650 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -33,8 +33,16 @@ PRINT *, 'INFO:simulate_version[013.00]' # endif # endif -#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) +#elif defined(__SUNPRO_F95) PRINT *, 'INFO:compiler[SunPro]' +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F95>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F95 & 0xF) +#elif defined(__SUNPRO_F90) + PRINT *, 'INFO:compiler[SunPro]' +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F90>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F90>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90 & 0xF) #elif defined(_CRAYFTN) PRINT *, 'INFO:compiler[Cray]' #elif defined(__G95__) From 49562a77f7223befa21a5b72625dc10f807ce788 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:28:45 -0500 Subject: [PATCH 0146/1029] Fortran: Detect PathScale compiler version Port logic from the "Compiler/PathScale-DetermineCompiler" module into "CMakeFortranCompilerId.F.in". --- Modules/CMakeFortranCompilerId.F.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 5e8f64650..fcffaa260 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -49,6 +49,11 @@ PRINT *, 'INFO:compiler[G95]' #elif defined(__PATHSCALE__) PRINT *, 'INFO:compiler[PathScale]' +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif #elif defined(__ABSOFT__) PRINT *, 'INFO:compiler[Absoft]' #elif defined(__GNUC__) From 8c8b77a5dede8d1ad3110124b93973db8d879d79 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:29:33 -0500 Subject: [PATCH 0147/1029] Fortran: Detect GNU compiler version Port logic from the "Compiler/GNU-DetermineCompiler" module into "CMakeFortranCompilerId.F.in". --- Modules/CMakeFortranCompilerId.F.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index fcffaa260..14ce39582 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -58,6 +58,11 @@ PRINT *, 'INFO:compiler[Absoft]' #elif defined(__GNUC__) PRINT *, 'INFO:compiler[GNU]' +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif #elif defined(__IBMC__) # if defined(__COMPILER_VER__) PRINT *, 'INFO:compiler[zOS]' From 302d47b1fe19fb794800faa548d4cb9a8e89220a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:30:19 -0500 Subject: [PATCH 0148/1029] Fortran: Detect XL and VisualAge compiler versions Port logic from the "Compiler/XL-*-DetermineCompiler" and "Compiler/VisualAge-*-DetermineCompiler" modules into "CMakeFortranCompilerId.F.in". --- Modules/CMakeFortranCompilerId.F.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 14ce39582..4c172a8be 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -68,8 +68,14 @@ PRINT *, 'INFO:compiler[zOS]' # elif __IBMC__ >= 800 PRINT *, 'INFO:compiler[XL]' +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) # else PRINT *, 'INFO:compiler[VisualAge]' +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) # endif #elif defined(__PGI) PRINT *, 'INFO:compiler[PGI]' From 0033faac1d5641c370646e089ca19cd527a8d842 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:31:45 -0500 Subject: [PATCH 0149/1029] Fortran: Detect PGI compiler version Port logic from the "Compiler/PGI-DetermineCompiler" module into "CMakeFortranCompilerId.F.in". --- Modules/CMakeFortranCompilerId.F.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 4c172a8be..98ec7f3df 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -79,6 +79,11 @@ # endif #elif defined(__PGI) PRINT *, 'INFO:compiler[PGI]' +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) PRINT *, 'INFO:compiler[MIPSpro]' # if 0 From c6e1f4647576801b27fbb25652fe3e947564be27 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:32:28 -0500 Subject: [PATCH 0150/1029] Fortran: Detect G95 compiler version The __G95__ and __G95_MINOR__ preprocessor symbols encode the compiler version as decimal digits. --- Modules/CMakeFortranCompilerId.F.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 98ec7f3df..2533d3f98 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -47,6 +47,8 @@ PRINT *, 'INFO:compiler[Cray]' #elif defined(__G95__) PRINT *, 'INFO:compiler[G95]' +# define COMPILER_VERSION_MAJOR DEC(__G95__) +# define COMPILER_VERSION_MINOR DEC(__G95_MINOR__) #elif defined(__PATHSCALE__) PRINT *, 'INFO:compiler[PathScale]' # define COMPILER_VERSION_MAJOR DEC(__PATHCC__) From f611406fe9045e2861ccc8a9fd8b9daa39982553 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:37:23 -0500 Subject: [PATCH 0151/1029] Fortran: Test that CMAKE_Fortran_COMPILER_VERSION is set (#15372) Update the CMakeOnly.CompilerIdFortran test to require that the variable is set instead of just warning. We already require it for C and CXX. --- Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt index 3a2bdebd6..02e466887 100644 --- a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -4,6 +4,7 @@ project(CompilerIdFortran Fortran) foreach(v CMAKE_Fortran_COMPILER CMAKE_Fortran_COMPILER_ID + CMAKE_Fortran_COMPILER_VERSION ) if(${v}) message(STATUS "${v}=[${${v}}]") @@ -11,12 +12,3 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() -foreach(v - CMAKE_Fortran_COMPILER_VERSION - ) - if(${v}) - message(STATUS "${v}=[${${v}}]") - else() - message(WARNING "${v} not set!") - endif() -endforeach() From 4cf3589ed6b71dbc2bf95bc16d079ef469511538 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Feb 2015 13:38:31 -0500 Subject: [PATCH 0152/1029] Help: Add notes for topic 'compiler-version-Fortran' --- Help/release/dev/compiler-version-Fortran.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/compiler-version-Fortran.rst diff --git a/Help/release/dev/compiler-version-Fortran.rst b/Help/release/dev/compiler-version-Fortran.rst new file mode 100644 index 000000000..e10b2066d --- /dev/null +++ b/Help/release/dev/compiler-version-Fortran.rst @@ -0,0 +1,6 @@ +compiler-version-Fortran +------------------------ + +* The version of some Fortran compilers is now detected and stored in the + :variable:`CMAKE_Fortran_COMPILER_VERSION _COMPILER_VERSION>` + variable. From ffc06c12397e7cda7307afcfc8a79ebda4a786a6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Feb 2015 10:54:45 -0500 Subject: [PATCH 0153/1029] Teach find_(library|file|path) to get prefixes from PATH (#15370) The find_package command already knows how to compute installation prefixes from PATH. Use the same approach to establish prefixes for find_library, find_file, and find_path to use to look in directories like "/lib[/]" and "/include" for libraries and headers. This will reduce the amount of configuration end users need to do to establish a work environment rooted under a specific prefix. --- Help/command/FIND_XXX.txt | 4 ++++ Help/command/find_file.rst | 5 ++++- Help/command/find_library.rst | 5 ++++- Help/command/find_path.rst | 5 ++++- .../dev/find-command-prefix-from-PATH.rst | 6 +++++ Source/cmFindBase.cxx | 1 + Source/cmSearchPath.cxx | 22 ++++++++++++++++++- Source/cmSearchPath.h | 2 +- Tests/RunCMake/CMakeLists.txt | 2 ++ Tests/RunCMake/find_file/CMakeLists.txt | 3 +++ .../find_file/PrefixInPATH-stdout.txt | 4 ++++ Tests/RunCMake/find_file/PrefixInPATH.cmake | 8 +++++++ Tests/RunCMake/find_file/RunCMakeTest.cmake | 3 +++ .../RunCMake/find_file/include/PrefixInPATH.h | 0 .../find_library/PrefixInPATH-stdout.txt | 4 ++++ .../RunCMake/find_library/PrefixInPATH.cmake | 11 ++++++++++ .../RunCMake/find_library/RunCMakeTest.cmake | 1 + .../find_library/lib/libPrefixInPATH.a | 0 Tests/RunCMake/find_path/CMakeLists.txt | 3 +++ .../find_path/PrefixInPATH-stdout.txt | 4 ++++ Tests/RunCMake/find_path/PrefixInPATH.cmake | 8 +++++++ Tests/RunCMake/find_path/RunCMakeTest.cmake | 3 +++ .../RunCMake/find_path/include/PrefixInPATH.h | 0 23 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/find-command-prefix-from-PATH.rst create mode 100644 Tests/RunCMake/find_file/CMakeLists.txt create mode 100644 Tests/RunCMake/find_file/PrefixInPATH-stdout.txt create mode 100644 Tests/RunCMake/find_file/PrefixInPATH.cmake create mode 100644 Tests/RunCMake/find_file/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/find_file/include/PrefixInPATH.h create mode 100644 Tests/RunCMake/find_library/PrefixInPATH-stdout.txt create mode 100644 Tests/RunCMake/find_library/PrefixInPATH.cmake create mode 100644 Tests/RunCMake/find_library/lib/libPrefixInPATH.a create mode 100644 Tests/RunCMake/find_path/CMakeLists.txt create mode 100644 Tests/RunCMake/find_path/PrefixInPATH-stdout.txt create mode 100644 Tests/RunCMake/find_path/PrefixInPATH.cmake create mode 100644 Tests/RunCMake/find_path/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/find_path/include/PrefixInPATH.h diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 5889e9009..935832930 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -53,6 +53,10 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: /|XXX_SUBDIR| for each in CMAKE_PREFIX_PATH +.. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace:: + /|XXX_SUBDIR| for each /[s]bin in PATH, and + /|XXX_SUBDIR| for other entries in PATH + .. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace:: /|XXX_SUBDIR| for each in CMAKE_SYSTEM_PREFIX_PATH diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index db7e1518e..be309a530 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -13,7 +13,10 @@ find_file .. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH .. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH and INCLUDE +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, + /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and + |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, + and the directories in PATH itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index 91342bad3..09df6888f 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -13,7 +13,10 @@ find_library .. |CMAKE_XXX_PATH| replace:: CMAKE_LIBRARY_PATH .. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH and LIB +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in LIB, + /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and + |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, + and the directories in PATH itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index 95d49e77a..b5a6e373f 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -13,7 +13,10 @@ find_path .. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH .. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH and INCLUDE +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, + /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and + |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, + and the directories in PATH itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and diff --git a/Help/release/dev/find-command-prefix-from-PATH.rst b/Help/release/dev/find-command-prefix-from-PATH.rst new file mode 100644 index 000000000..f9aae2a93 --- /dev/null +++ b/Help/release/dev/find-command-prefix-from-PATH.rst @@ -0,0 +1,6 @@ +find-command-prefix-from-PATH +----------------------------- + +* The :command:`find_library`, :command:`find_path`, and :command:`find_file` + commands now search in installation prefixes derived from the ``PATH`` + environment variable. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 6e555333d..4336e1c71 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -275,6 +275,7 @@ void cmFindBase::FillSystemEnvironmentPath() if(!this->EnvironmentPath.empty()) { paths.AddEnvPath(this->EnvironmentPath); + paths.AddEnvPrefixPath("PATH", true); } // Add PATH paths.AddEnvPath("PATH"); diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 861dbf178..1e777ab7a 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -136,10 +136,30 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable) } //---------------------------------------------------------------------------- -void cmSearchPath::AddEnvPrefixPath(const std::string& variable) +static std::string cmSearchPathStripBin(std::string const& s) +{ + // If the path is a PREFIX/bin case then add its parent instead. + if((cmHasLiteralSuffix(s, "/bin")) || + (cmHasLiteralSuffix(s, "/sbin"))) + { + return cmSystemTools::GetFilenamePath(s); + } + else + { + return s; + } +} + +//---------------------------------------------------------------------------- +void cmSearchPath::AddEnvPrefixPath(const std::string& variable, bool stripBin) { std::vector expanded; cmSystemTools::GetPath(expanded, variable.c_str()); + if (stripBin) + { + std::transform(expanded.begin(), expanded.end(), expanded.begin(), + cmSearchPathStripBin); + } this->AddPrefixPaths(expanded); } diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h index 51a6149ea..41c680d14 100644 --- a/Source/cmSearchPath.h +++ b/Source/cmSearchPath.h @@ -42,7 +42,7 @@ public: void AddCMakePath(const std::string& variable); void AddEnvPath(const std::string& variable); void AddCMakePrefixPath(const std::string& variable); - void AddEnvPrefixPath(const std::string& variable); + void AddEnvPrefixPath(const std::string& variable, bool stripBin = false); void AddSuffixes(const std::vector& suffixes); protected: diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f0426e5e7..fd01201a8 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -131,8 +131,10 @@ add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) add_RunCMake_test(file) +add_RunCMake_test(find_file) add_RunCMake_test(find_library) add_RunCMake_test(find_package) +add_RunCMake_test(find_path) add_RunCMake_test(get_filename_component) add_RunCMake_test(get_property) add_RunCMake_test(if) diff --git a/Tests/RunCMake/find_file/CMakeLists.txt b/Tests/RunCMake/find_file/CMakeLists.txt new file mode 100644 index 000000000..ef2163c29 --- /dev/null +++ b/Tests/RunCMake/find_file/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt b/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt new file mode 100644 index 000000000..d73bc1dfd --- /dev/null +++ b/Tests/RunCMake/find_file/PrefixInPATH-stdout.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' diff --git a/Tests/RunCMake/find_file/PrefixInPATH.cmake b/Tests/RunCMake/find_file/PrefixInPATH.cmake new file mode 100644 index 000000000..1e33c08a6 --- /dev/null +++ b/Tests/RunCMake/find_file/PrefixInPATH.cmake @@ -0,0 +1,8 @@ +set(ENV_PATH "$ENV{PATH}") +foreach(path "/does_not_exist" "" "/bin" "/sbin") + unset(PrefixInPATH_INCLUDE_DIR CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_file(PrefixInPATH_INCLUDE_DIR NAMES PrefixInPATH.h) + message(STATUS "PrefixInPATH_INCLUDE_DIR='${PrefixInPATH_INCLUDE_DIR}'") +endforeach() +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_file/RunCMakeTest.cmake b/Tests/RunCMake/find_file/RunCMakeTest.cmake new file mode 100644 index 000000000..014f39734 --- /dev/null +++ b/Tests/RunCMake/find_file/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(PrefixInPATH) diff --git a/Tests/RunCMake/find_file/include/PrefixInPATH.h b/Tests/RunCMake/find_file/include/PrefixInPATH.h new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt b/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt new file mode 100644 index 000000000..1ab884cb7 --- /dev/null +++ b/Tests/RunCMake/find_library/PrefixInPATH-stdout.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' diff --git a/Tests/RunCMake/find_library/PrefixInPATH.cmake b/Tests/RunCMake/find_library/PrefixInPATH.cmake new file mode 100644 index 000000000..f1b8b187a --- /dev/null +++ b/Tests/RunCMake/find_library/PrefixInPATH.cmake @@ -0,0 +1,11 @@ +list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib) +list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a) + +set(ENV_PATH "$ENV{PATH}") +foreach(path "/does_not_exist" "" "/bin" "/sbin") + unset(PrefixInPATH_LIBRARY CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_library(PrefixInPATH_LIBRARY NAMES PrefixInPATH) + message(STATUS "PrefixInPATH_LIBRARY='${PrefixInPATH_LIBRARY}'") +endforeach() +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index 40006799b..136031c63 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(Created) +run_cmake(PrefixInPATH) diff --git a/Tests/RunCMake/find_library/lib/libPrefixInPATH.a b/Tests/RunCMake/find_library/lib/libPrefixInPATH.a new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/find_path/CMakeLists.txt b/Tests/RunCMake/find_path/CMakeLists.txt new file mode 100644 index 000000000..ef2163c29 --- /dev/null +++ b/Tests/RunCMake/find_path/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt b/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt new file mode 100644 index 000000000..bb2ceb725 --- /dev/null +++ b/Tests/RunCMake/find_path/PrefixInPATH-stdout.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' diff --git a/Tests/RunCMake/find_path/PrefixInPATH.cmake b/Tests/RunCMake/find_path/PrefixInPATH.cmake new file mode 100644 index 000000000..614d64f1f --- /dev/null +++ b/Tests/RunCMake/find_path/PrefixInPATH.cmake @@ -0,0 +1,8 @@ +set(ENV_PATH "$ENV{PATH}") +foreach(path "/does_not_exist" "" "/bin" "/sbin") + unset(PrefixInPATH_INCLUDE_DIR CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_path(PrefixInPATH_INCLUDE_DIR NAMES PrefixInPATH.h) + message(STATUS "PrefixInPATH_INCLUDE_DIR='${PrefixInPATH_INCLUDE_DIR}'") +endforeach() +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake new file mode 100644 index 000000000..014f39734 --- /dev/null +++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(PrefixInPATH) diff --git a/Tests/RunCMake/find_path/include/PrefixInPATH.h b/Tests/RunCMake/find_path/include/PrefixInPATH.h new file mode 100644 index 000000000..e69de29bb From 76e7c22b3c37f382d6232ee95fe77e39e7aa269d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Feb 2015 11:21:55 -0500 Subject: [PATCH 0154/1029] Tests: Rename RunCMake.CTestMemcheck internals to match CTestSubmit --- Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in | 2 +- Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in | 2 +- Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake | 14 +++++++------- Tests/RunCMake/CTestMemcheck/test.cmake.in | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in b/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in index d15d14822..3b8edf4c9 100644 --- a/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in +++ b/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheck@SUBTEST_NAME@ NONE) +project(CTestTestMemcheck@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in b/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in index 19c76c26c..6d4a718d0 100644 --- a/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in +++ b/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in @@ -1,4 +1,4 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") +set (CTEST_PROJECT_NAME "CTestTestMemcheck@CASE_NAME@") set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set (CTEST_DART_SERVER_VERSION "2") set(CTEST_DROP_METHOD "http") diff --git a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake index 6485de849..005745eac 100644 --- a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake @@ -4,18 +4,18 @@ set(SITE test-site) set(BUILDNAME test-build) set(COVERAGE_COMMAND "") -function(run_mc_test SUBTEST_NAME CHECKER_COMMAND) +function(run_mc_test CASE_NAME CHECKER_COMMAND) configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in - ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/test.cmake @ONLY) + ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY) configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in - ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/CTestConfig.cmake @ONLY) + ${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake @ONLY) configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in - ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/CMakeLists.txt @ONLY) - run_cmake_command(${SUBTEST_NAME} ${CMAKE_CTEST_COMMAND} + ${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY) + run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND} -C Debug - -S ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/test.cmake + -S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake -V - --output-log ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}-build/testOutput.log + --output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log ${ARGN} ) endfunction() diff --git a/Tests/RunCMake/CTestMemcheck/test.cmake.in b/Tests/RunCMake/CTestMemcheck/test.cmake.in index 622d70936..f9c1ba99d 100644 --- a/Tests/RunCMake/CTestMemcheck/test.cmake.in +++ b/Tests/RunCMake/CTestMemcheck/test.cmake.in @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.8.9) # Settings: set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@SUBTEST_NAME@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@CASE_NAME@") -set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@SUBTEST_NAME@") -set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@SUBTEST_NAME@-build") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") From 9b50388b0989fab1d77fbb3d48e648c86427d808 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Feb 2015 11:07:34 -0500 Subject: [PATCH 0155/1029] Tests: Split RunCTest helper out of RunCMake.CTest(Submit|Memcheck) Provide the "run_ctest" macro for use in other tests that also want to cover running "ctest" scripts. --- .../RunCMake/CTestMemcheck/RunCMakeTest.cmake | 16 ++-------------- Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake | 18 +----------------- Tests/RunCMake/README.rst | 10 ++++++++++ Tests/RunCMake/RunCTest.cmake | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 31 deletions(-) create mode 100644 Tests/RunCMake/RunCTest.cmake diff --git a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake index 005745eac..b1793fa44 100644 --- a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake @@ -1,23 +1,11 @@ -include(RunCMake) +include(RunCTest) set(SITE test-site) set(BUILDNAME test-build) set(COVERAGE_COMMAND "") function(run_mc_test CASE_NAME CHECKER_COMMAND) - configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in - ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY) - configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in - ${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake @ONLY) - configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in - ${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY) - run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND} - -C Debug - -S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake - -V - --output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log - ${ARGN} - ) + run_ctest(${CASE_NAME} ${ARGN}) endfunction() unset(CTEST_EXTRA_CONFIG) diff --git a/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake b/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake index 797365d71..c004e97bb 100644 --- a/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake @@ -1,26 +1,10 @@ -include(RunCMake) +include(RunCTest) # Default case parameters. set(CASE_DROP_METHOD "http") set(CASE_DROP_SITE "-no-site-") set(CASE_CTEST_SUBMIT_ARGS "") -function(run_ctest CASE_NAME) - configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in - ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY) - configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in - ${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake @ONLY) - configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in - ${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY) - run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND} - -C Debug - -S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake - -V - --output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log - ${ARGN} - ) -endfunction() - #----------------------------------------------------------------------------- # Test bad argument combinations. diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index e801a86c2..4aae4aed5 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -22,6 +22,16 @@ but do not actually build anything. To add a test: to fully customize the test case command-line. + Alternatively, if the test is to cover running ``ctest -S`` then use:: + + include(RunCTest) + run_ctest(SubTest1) + ... + run_ctest(SubTestN) + + and create ``test.cmake.in``, ``CTestConfig.cmake.in``, and + ``CMakeLists.txt.in`` files to be configured for each case. + 4. Create file ``/CMakeLists.txt`` in the directory containing:: cmake_minimum_required(...) diff --git a/Tests/RunCMake/RunCTest.cmake b/Tests/RunCMake/RunCTest.cmake new file mode 100644 index 000000000..e94432b17 --- /dev/null +++ b/Tests/RunCMake/RunCTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_ctest CASE_NAME) + configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in + ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY) + configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in + ${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake @ONLY) + configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in + ${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY) + run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND} + -C Debug + -S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake + -V + --output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log + ${ARGN} + ) +endfunction() From d7662141a771f105e64b56543d99ee43e7d00849 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Feb 2015 11:33:32 -0500 Subject: [PATCH 0156/1029] Tests: Rename RunCMake.{CTestSubmit => ctest_submit} Follow the convention of naming tests after the command they test. --- Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/CTestSubmit/BadArg-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/CDashUploadFILES-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/CDashUploadPARTS-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/FailDrop-cp-stderr.txt | 4 ---- Tests/RunCMake/CTestSubmit/FailDrop-ftp-stderr.txt | 3 --- Tests/RunCMake/CTestSubmit/FailDrop-http-stderr.txt | 3 --- Tests/RunCMake/CTestSubmit/FailDrop-https-stderr.txt | 3 --- Tests/RunCMake/CTestSubmit/FailDrop-scp-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/PARTSCDashUpload-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-stderr.txt | 2 -- Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt | 2 -- .../RunCMake/{CTestSubmit => ctest_submit}/BadArg-result.txt | 0 Tests/RunCMake/ctest_submit/BadArg-stderr.txt | 2 ++ .../{CTestSubmit => ctest_submit}/BadFILES-result.txt | 0 Tests/RunCMake/ctest_submit/BadFILES-stderr.txt | 2 ++ .../{CTestSubmit => ctest_submit}/BadPARTS-result.txt | 0 Tests/RunCMake/ctest_submit/BadPARTS-stderr.txt | 2 ++ .../{CTestSubmit => ctest_submit}/CDashUploadFILES-result.txt | 0 Tests/RunCMake/ctest_submit/CDashUploadFILES-stderr.txt | 2 ++ .../{CTestSubmit => ctest_submit}/CDashUploadFTP-result.txt | 0 .../{CTestSubmit => ctest_submit}/CDashUploadFTP-stderr.txt | 0 .../{CTestSubmit => ctest_submit}/CDashUploadNone-result.txt | 0 .../{CTestSubmit => ctest_submit}/CDashUploadNone-stderr.txt | 0 .../{CTestSubmit => ctest_submit}/CDashUploadPARTS-result.txt | 0 Tests/RunCMake/ctest_submit/CDashUploadPARTS-stderr.txt | 2 ++ .../CDashUploadRETRY_COUNT-result.txt | 0 Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-stderr.txt | 2 ++ .../CDashUploadRETRY_DELAY-result.txt | 0 Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-stderr.txt | 2 ++ .../RunCMake/{CTestSubmit => ctest_submit}/CMakeLists.txt.in | 0 .../{CTestSubmit => ctest_submit}/CTestConfig.cmake.in | 0 .../{CTestSubmit => ctest_submit}/FailDrop-cp-result.txt | 0 Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt | 4 ++++ .../{CTestSubmit => ctest_submit}/FailDrop-cp-stdout.txt | 0 .../{CTestSubmit => ctest_submit}/FailDrop-ftp-result.txt | 0 Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt | 3 +++ .../{CTestSubmit => ctest_submit}/FailDrop-ftp-stdout.txt | 0 .../{CTestSubmit => ctest_submit}/FailDrop-http-result.txt | 0 Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt | 3 +++ .../{CTestSubmit => ctest_submit}/FailDrop-http-stdout.txt | 0 .../{CTestSubmit => ctest_submit}/FailDrop-https-result.txt | 0 Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt | 3 +++ .../{CTestSubmit => ctest_submit}/FailDrop-https-stdout.txt | 0 .../{CTestSubmit => ctest_submit}/FailDrop-scp-result.txt | 0 Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt | 2 ++ .../{CTestSubmit => ctest_submit}/FailDrop-scp-stdout.txt | 0 .../{CTestSubmit => ctest_submit}/FailDrop-xmlrpc-result.txt | 0 .../{CTestSubmit => ctest_submit}/FailDrop-xmlrpc-stderr.txt | 2 +- .../{CTestSubmit => ctest_submit}/FailDrop-xmlrpc-stdout.txt | 0 .../{CTestSubmit => ctest_submit}/PARTSCDashUpload-result.txt | 0 Tests/RunCMake/ctest_submit/PARTSCDashUpload-stderr.txt | 2 ++ .../PARTSCDashUploadType-result.txt | 0 Tests/RunCMake/ctest_submit/PARTSCDashUploadType-stderr.txt | 2 ++ .../RepeatRETURN_VALUE-result.txt | 0 Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-stderr.txt | 2 ++ .../RunCMake/{CTestSubmit => ctest_submit}/RunCMakeTest.cmake | 0 Tests/RunCMake/{CTestSubmit => ctest_submit}/test.cmake.in | 0 62 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 Tests/RunCMake/CTestSubmit/BadArg-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/CDashUploadFILES-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/CDashUploadPARTS-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/FailDrop-cp-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/FailDrop-ftp-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/FailDrop-http-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/FailDrop-https-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/FailDrop-scp-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/PARTSCDashUpload-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-stderr.txt delete mode 100644 Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/BadArg-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/BadArg-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/BadFILES-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/BadFILES-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/BadPARTS-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/BadPARTS-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadFILES-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/CDashUploadFILES-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadFTP-result.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadFTP-stderr.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadNone-result.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadNone-stderr.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadPARTS-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/CDashUploadPARTS-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadRETRY_COUNT-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CDashUploadRETRY_DELAY-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CMakeLists.txt.in (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/CTestConfig.cmake.in (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-cp-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-cp-stdout.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-ftp-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-ftp-stdout.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-http-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-http-stdout.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-https-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-https-stdout.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-scp-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-scp-stdout.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-xmlrpc-result.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-xmlrpc-stderr.txt (54%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/FailDrop-xmlrpc-stdout.txt (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/PARTSCDashUpload-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/PARTSCDashUpload-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/PARTSCDashUploadType-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/PARTSCDashUploadType-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/RepeatRETURN_VALUE-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-stderr.txt rename Tests/RunCMake/{CTestSubmit => ctest_submit}/RunCMakeTest.cmake (100%) rename Tests/RunCMake/{CTestSubmit => ctest_submit}/test.cmake.in (100%) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2de82a7ce..44e6ec462 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -64,7 +64,6 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CTest) -add_RunCMake_test(CTestSubmit) if(NOT CMake_TEST_EXTERNAL_CMAKE) add_RunCMake_test(CTestMemcheck @@ -130,6 +129,7 @@ add_RunCMake_test(build_command) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) +add_RunCMake_test(ctest_submit) add_RunCMake_test(file) add_RunCMake_test(find_library) add_RunCMake_test(find_package) diff --git a/Tests/RunCMake/CTestSubmit/BadArg-stderr.txt b/Tests/RunCMake/CTestSubmit/BadArg-stderr.txt deleted file mode 100644 index 68812ab7f..000000000 --- a/Tests/RunCMake/CTestSubmit/BadArg-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/BadArg/test.cmake:[0-9]+ \(ctest_submit\): - ctest_submit called with unknown argument "bad-arg". diff --git a/Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt b/Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt deleted file mode 100644 index 703224b24..000000000 --- a/Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/BadFILES/test.cmake:[0-9]+ \(ctest_submit\): - File "bad-file" does not exist. Cannot submit a non-existent file. diff --git a/Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt b/Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt deleted file mode 100644 index 4e491a9c0..000000000 --- a/Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/BadPARTS/test.cmake:[0-9]+ \(ctest_submit\): - Part name "bad-part" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadFILES-stderr.txt b/Tests/RunCMake/CTestSubmit/CDashUploadFILES-stderr.txt deleted file mode 100644 index 48177e2c0..000000000 --- a/Tests/RunCMake/CTestSubmit/CDashUploadFILES-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/CDashUploadFILES/test.cmake:[0-9]+ \(ctest_submit\): - ctest_submit called with unknown argument "FILES". diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadPARTS-stderr.txt b/Tests/RunCMake/CTestSubmit/CDashUploadPARTS-stderr.txt deleted file mode 100644 index 497ead298..000000000 --- a/Tests/RunCMake/CTestSubmit/CDashUploadPARTS-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/CDashUploadPARTS/test.cmake:[0-9]+ \(ctest_submit\): - ctest_submit called with unknown argument "PARTS". diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-stderr.txt b/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-stderr.txt deleted file mode 100644 index 8c4e6b136..000000000 --- a/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT/test.cmake:[0-9]+ \(ctest_submit\): - ctest_submit called with unknown argument "RETRY_COUNT". diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-stderr.txt b/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-stderr.txt deleted file mode 100644 index 6c56399d9..000000000 --- a/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY/test.cmake:[0-9]+ \(ctest_submit\): - ctest_submit called with unknown argument "RETRY_DELAY". diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-cp-stderr.txt b/Tests/RunCMake/CTestSubmit/FailDrop-cp-stderr.txt deleted file mode 100644 index b451315d0..000000000 --- a/Tests/RunCMake/CTestSubmit/FailDrop-cp-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -Missing arguments for submit via cp: -.* - Problems when submitting via CP -Error in read script: .*/Tests/RunCMake/CTestSubmit/FailDrop-cp/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-ftp-stderr.txt b/Tests/RunCMake/CTestSubmit/FailDrop-ftp-stderr.txt deleted file mode 100644 index a622fac08..000000000 --- a/Tests/RunCMake/CTestSubmit/FailDrop-ftp-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -Error message was: .* - Problems when submitting via FTP -Error in read script: .*/Tests/RunCMake/CTestSubmit/FailDrop-ftp/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-http-stderr.txt b/Tests/RunCMake/CTestSubmit/FailDrop-http-stderr.txt deleted file mode 100644 index 6870d2ebe..000000000 --- a/Tests/RunCMake/CTestSubmit/FailDrop-http-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -Error message was: .* - Problems when submitting via HTTP -Error in read script: .*/Tests/RunCMake/CTestSubmit/FailDrop-http/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-https-stderr.txt b/Tests/RunCMake/CTestSubmit/FailDrop-https-stderr.txt deleted file mode 100644 index a3c0cd581..000000000 --- a/Tests/RunCMake/CTestSubmit/FailDrop-https-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -Error message was: .* - Problems when submitting via HTTP -Error in read script: .*/Tests/RunCMake/CTestSubmit/FailDrop-https/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-scp-stderr.txt b/Tests/RunCMake/CTestSubmit/FailDrop-scp-stderr.txt deleted file mode 100644 index 42b8f5070..000000000 --- a/Tests/RunCMake/CTestSubmit/FailDrop-scp-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ - Problems when submitting via SCP -Error in read script: .*/Tests/RunCMake/CTestSubmit/FailDrop-scp/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/PARTSCDashUpload-stderr.txt b/Tests/RunCMake/CTestSubmit/PARTSCDashUpload-stderr.txt deleted file mode 100644 index dfa7e33fa..000000000 --- a/Tests/RunCMake/CTestSubmit/PARTSCDashUpload-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/PARTSCDashUpload/test.cmake:[0-9]+ \(ctest_submit\): - Part name "CDASH_UPLOAD" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-stderr.txt b/Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-stderr.txt deleted file mode 100644 index 42becafd9..000000000 --- a/Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/PARTSCDashUploadType/test.cmake:[0-9]+ \(ctest_submit\): - Part name "CDASH_UPLOAD_TYPE" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt b/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt deleted file mode 100644 index d56793e0e..000000000 --- a/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -CMake Error at .*/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE/test.cmake:[0-9]+ \(ctest_submit\): - Called with more than one value for RETURN_VALUE diff --git a/Tests/RunCMake/CTestSubmit/BadArg-result.txt b/Tests/RunCMake/ctest_submit/BadArg-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/BadArg-result.txt rename to Tests/RunCMake/ctest_submit/BadArg-result.txt diff --git a/Tests/RunCMake/ctest_submit/BadArg-stderr.txt b/Tests/RunCMake/ctest_submit/BadArg-stderr.txt new file mode 100644 index 000000000..7eeef0a2d --- /dev/null +++ b/Tests/RunCMake/ctest_submit/BadArg-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/BadArg/test.cmake:[0-9]+ \(ctest_submit\): + ctest_submit called with unknown argument "bad-arg". diff --git a/Tests/RunCMake/CTestSubmit/BadFILES-result.txt b/Tests/RunCMake/ctest_submit/BadFILES-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/BadFILES-result.txt rename to Tests/RunCMake/ctest_submit/BadFILES-result.txt diff --git a/Tests/RunCMake/ctest_submit/BadFILES-stderr.txt b/Tests/RunCMake/ctest_submit/BadFILES-stderr.txt new file mode 100644 index 000000000..ab84ab932 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/BadFILES-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/BadFILES/test.cmake:[0-9]+ \(ctest_submit\): + File "bad-file" does not exist. Cannot submit a non-existent file. diff --git a/Tests/RunCMake/CTestSubmit/BadPARTS-result.txt b/Tests/RunCMake/ctest_submit/BadPARTS-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/BadPARTS-result.txt rename to Tests/RunCMake/ctest_submit/BadPARTS-result.txt diff --git a/Tests/RunCMake/ctest_submit/BadPARTS-stderr.txt b/Tests/RunCMake/ctest_submit/BadPARTS-stderr.txt new file mode 100644 index 000000000..3db54f3ed --- /dev/null +++ b/Tests/RunCMake/ctest_submit/BadPARTS-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/BadPARTS/test.cmake:[0-9]+ \(ctest_submit\): + Part name "bad-part" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadFILES-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadFILES-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadFILES-result.txt rename to Tests/RunCMake/ctest_submit/CDashUploadFILES-result.txt diff --git a/Tests/RunCMake/ctest_submit/CDashUploadFILES-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadFILES-stderr.txt new file mode 100644 index 000000000..0106fee30 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadFILES-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/CDashUploadFILES/test.cmake:[0-9]+ \(ctest_submit\): + ctest_submit called with unknown argument "FILES". diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadFTP-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadFTP-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadFTP-result.txt rename to Tests/RunCMake/ctest_submit/CDashUploadFTP-result.txt diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadFTP-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadFTP-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadFTP-stderr.txt rename to Tests/RunCMake/ctest_submit/CDashUploadFTP-stderr.txt diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadNone-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadNone-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadNone-result.txt rename to Tests/RunCMake/ctest_submit/CDashUploadNone-result.txt diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadNone-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadNone-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadNone-stderr.txt rename to Tests/RunCMake/ctest_submit/CDashUploadNone-stderr.txt diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadPARTS-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadPARTS-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadPARTS-result.txt rename to Tests/RunCMake/ctest_submit/CDashUploadPARTS-result.txt diff --git a/Tests/RunCMake/ctest_submit/CDashUploadPARTS-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadPARTS-stderr.txt new file mode 100644 index 000000000..fe94cb717 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadPARTS-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/CDashUploadPARTS/test.cmake:[0-9]+ \(ctest_submit\): + ctest_submit called with unknown argument "PARTS". diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadRETRY_COUNT-result.txt rename to Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-result.txt diff --git a/Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-stderr.txt new file mode 100644 index 000000000..21621d440 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/CDashUploadRETRY_COUNT/test.cmake:[0-9]+ \(ctest_submit\): + ctest_submit called with unknown argument "RETRY_COUNT". diff --git a/Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-result.txt b/Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/CDashUploadRETRY_DELAY-result.txt rename to Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-result.txt diff --git a/Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-stderr.txt b/Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-stderr.txt new file mode 100644 index 000000000..f726674d9 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/CDashUploadRETRY_DELAY/test.cmake:[0-9]+ \(ctest_submit\): + ctest_submit called with unknown argument "RETRY_DELAY". diff --git a/Tests/RunCMake/CTestSubmit/CMakeLists.txt.in b/Tests/RunCMake/ctest_submit/CMakeLists.txt.in similarity index 100% rename from Tests/RunCMake/CTestSubmit/CMakeLists.txt.in rename to Tests/RunCMake/ctest_submit/CMakeLists.txt.in diff --git a/Tests/RunCMake/CTestSubmit/CTestConfig.cmake.in b/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in similarity index 100% rename from Tests/RunCMake/CTestSubmit/CTestConfig.cmake.in rename to Tests/RunCMake/ctest_submit/CTestConfig.cmake.in diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-cp-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-cp-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-cp-result.txt rename to Tests/RunCMake/ctest_submit/FailDrop-cp-result.txt diff --git a/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt new file mode 100644 index 000000000..c3c084d5a --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt @@ -0,0 +1,4 @@ +Missing arguments for submit via cp: +.* + Problems when submitting via CP +Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-cp/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-cp-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-cp-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-cp-stdout.txt rename to Tests/RunCMake/ctest_submit/FailDrop-cp-stdout.txt diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-ftp-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-ftp-result.txt rename to Tests/RunCMake/ctest_submit/FailDrop-ftp-result.txt diff --git a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt new file mode 100644 index 000000000..73df5c1b2 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt @@ -0,0 +1,3 @@ +Error message was: .* + Problems when submitting via FTP +Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-ftp/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-ftp-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-ftp-stdout.txt rename to Tests/RunCMake/ctest_submit/FailDrop-ftp-stdout.txt diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-http-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-http-result.txt rename to Tests/RunCMake/ctest_submit/FailDrop-http-result.txt diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt new file mode 100644 index 000000000..c1a91265c --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt @@ -0,0 +1,3 @@ +Error message was: .* + Problems when submitting via HTTP +Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-http/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-http-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-http-stdout.txt rename to Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-https-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-https-result.txt rename to Tests/RunCMake/ctest_submit/FailDrop-https-result.txt diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt new file mode 100644 index 000000000..11db01a93 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt @@ -0,0 +1,3 @@ +Error message was: .* + Problems when submitting via HTTP +Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-https/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-https-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-https-stdout.txt rename to Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-scp-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-scp-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-scp-result.txt rename to Tests/RunCMake/ctest_submit/FailDrop-scp-result.txt diff --git a/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt new file mode 100644 index 000000000..07902977b --- /dev/null +++ b/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt @@ -0,0 +1,2 @@ + Problems when submitting via SCP +Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-scp/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-scp-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-scp-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-scp-stdout.txt rename to Tests/RunCMake/ctest_submit/FailDrop-scp-stdout.txt diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-result.txt rename to Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-result.txt diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt similarity index 54% rename from Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-stderr.txt rename to Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt index 020b615ac..23ea92cc5 100644 --- a/Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt @@ -1,2 +1,2 @@ (Problems when submitting via XML-RPC|Submission method "xmlrpc" not compiled into CTest!) -Error in read script: .*/Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc/test.cmake +Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc/test.cmake diff --git a/Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/FailDrop-xmlrpc-stdout.txt rename to Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stdout.txt diff --git a/Tests/RunCMake/CTestSubmit/PARTSCDashUpload-result.txt b/Tests/RunCMake/ctest_submit/PARTSCDashUpload-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/PARTSCDashUpload-result.txt rename to Tests/RunCMake/ctest_submit/PARTSCDashUpload-result.txt diff --git a/Tests/RunCMake/ctest_submit/PARTSCDashUpload-stderr.txt b/Tests/RunCMake/ctest_submit/PARTSCDashUpload-stderr.txt new file mode 100644 index 000000000..ad4c8cbf0 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/PARTSCDashUpload-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/PARTSCDashUpload/test.cmake:[0-9]+ \(ctest_submit\): + Part name "CDASH_UPLOAD" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-result.txt b/Tests/RunCMake/ctest_submit/PARTSCDashUploadType-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/PARTSCDashUploadType-result.txt rename to Tests/RunCMake/ctest_submit/PARTSCDashUploadType-result.txt diff --git a/Tests/RunCMake/ctest_submit/PARTSCDashUploadType-stderr.txt b/Tests/RunCMake/ctest_submit/PARTSCDashUploadType-stderr.txt new file mode 100644 index 000000000..8d8a8520f --- /dev/null +++ b/Tests/RunCMake/ctest_submit/PARTSCDashUploadType-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/PARTSCDashUploadType/test.cmake:[0-9]+ \(ctest_submit\): + Part name "CDASH_UPLOAD_TYPE" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-result.txt b/Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-result.txt similarity index 100% rename from Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-result.txt rename to Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-result.txt diff --git a/Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-stderr.txt b/Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-stderr.txt new file mode 100644 index 000000000..6e17c759e --- /dev/null +++ b/Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/ctest_submit/RepeatRETURN_VALUE/test.cmake:[0-9]+ \(ctest_submit\): + Called with more than one value for RETURN_VALUE diff --git a/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake similarity index 100% rename from Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake rename to Tests/RunCMake/ctest_submit/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CTestSubmit/test.cmake.in b/Tests/RunCMake/ctest_submit/test.cmake.in similarity index 100% rename from Tests/RunCMake/CTestSubmit/test.cmake.in rename to Tests/RunCMake/ctest_submit/test.cmake.in From 1d82105e29fc6f0bb71a474f876a7553b397cc26 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Feb 2015 11:35:51 -0500 Subject: [PATCH 0157/1029] Tests: Rename RunCMake.{CTestMemcheck => ctest_memcheck} Follow the convention of naming tests after the command they test. --- Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt | 3 --- Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt | 2 -- .../CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt | 2 -- .../CTestMemcheck/DummyValgrindCustomOptions-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt | 1 - .../CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt | 2 -- .../CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt | 1 - Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt | 1 - Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt | 2 -- Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt | 1 - .../{CTestMemcheck => ctest_memcheck}/CMakeLists.txt.in | 0 .../{CTestMemcheck => ctest_memcheck}/CTestConfig.cmake.in | 0 .../DummyAddressSanitizer-result.txt | 0 Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt | 2 ++ .../DummyAddressSanitizer-stdout.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyBC-result.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyBC-stderr.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyBC-stdout.txt | 0 .../DummyBCNoLogFile-result.txt | 0 Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt | 3 +++ .../DummyBCNoLogFile-stdout.txt | 0 .../DummyLeakSanitizer-result.txt | 0 Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt | 2 ++ .../DummyLeakSanitizer-stdout.txt | 0 .../DummyMemorySanitizer-result.txt | 0 Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt | 2 ++ .../DummyMemorySanitizer-stdout.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyPurify-result.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyPurify-stderr.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyPurify-stdout.txt | 0 .../DummyPurifyNoLogFile-result.txt | 0 Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt | 2 ++ .../DummyPurifyNoLogFile-stdout.txt | 0 .../DummyThreadSanitizer-result.txt | 0 Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt | 2 ++ .../DummyThreadSanitizer-stdout.txt | 0 .../DummyUndefinedBehaviorSanitizer-result.txt | 0 .../ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt | 2 ++ .../DummyUndefinedBehaviorSanitizer-stdout.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyValgrind-result.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyValgrind-stderr.txt | 0 .../{CTestMemcheck => ctest_memcheck}/DummyValgrind-stdout.txt | 0 .../DummyValgrindCustomOptions-result.txt | 0 .../ctest_memcheck/DummyValgrindCustomOptions-stderr.txt | 2 ++ .../DummyValgrindCustomOptions-stdout.txt | 0 .../DummyValgrindFailPost-result.txt | 0 .../DummyValgrindFailPost-stderr.txt | 2 +- .../DummyValgrindFailPost-stdout.txt | 0 .../DummyValgrindFailPre-result.txt | 0 .../DummyValgrindFailPre-stderr.txt | 2 +- Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt | 1 + .../DummyValgrindIgnoreMemcheck-result.txt | 0 .../DummyValgrindIgnoreMemcheck-stderr.txt | 0 .../DummyValgrindIgnoreMemcheck-stdout.txt | 0 .../DummyValgrindInvalidSupFile-result.txt | 0 .../ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt | 2 ++ .../ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt | 1 + .../DummyValgrindNoLogFile-result.txt | 0 .../RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt | 2 ++ .../DummyValgrindNoLogFile-stdout.txt | 0 .../DummyValgrindPrePost-result.txt | 0 .../DummyValgrindPrePost-stderr.txt | 0 .../DummyValgrindPrePost-stdout.txt | 0 .../DummyValgrindTwoTargets-result.txt | 0 .../DummyValgrindTwoTargets-stderr.txt | 0 .../DummyValgrindTwoTargets-stdout.txt | 0 .../{CTestMemcheck => ctest_memcheck}/NotExist-result.txt | 0 .../{CTestMemcheck => ctest_memcheck}/NotExist-stderr.txt | 0 Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt | 1 + .../{CTestMemcheck => ctest_memcheck}/RunCMakeTest.cmake | 0 .../{CTestMemcheck => ctest_memcheck}/Unknown-result.txt | 0 Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt | 2 ++ Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt | 1 + Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/test.cmake.in | 0 .../testAddressSanitizer.cmake | 0 .../{CTestMemcheck => ctest_memcheck}/testLeakSanitizer.cmake | 0 .../testMemorySanitizer.cmake | 0 .../testThreadSanitizer.cmake | 0 .../testUndefinedBehaviorSanitizer.cmake | 0 85 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt delete mode 100644 Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/CMakeLists.txt.in (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/CTestConfig.cmake.in (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyAddressSanitizer-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyAddressSanitizer-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyBC-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyBC-stderr.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyBC-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyBCNoLogFile-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyBCNoLogFile-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyLeakSanitizer-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyLeakSanitizer-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyMemorySanitizer-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyMemorySanitizer-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyPurify-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyPurify-stderr.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyPurify-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyPurifyNoLogFile-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyPurifyNoLogFile-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyThreadSanitizer-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyThreadSanitizer-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyUndefinedBehaviorSanitizer-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyUndefinedBehaviorSanitizer-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrind-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrind-stderr.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrind-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindCustomOptions-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindCustomOptions-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindFailPost-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindFailPost-stderr.txt (50%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindFailPost-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindFailPre-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindFailPre-stderr.txt (50%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindIgnoreMemcheck-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindIgnoreMemcheck-stderr.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindIgnoreMemcheck-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindInvalidSupFile-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt create mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindNoLogFile-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindNoLogFile-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindPrePost-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindPrePost-stderr.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindPrePost-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindTwoTargets-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindTwoTargets-stderr.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/DummyValgrindTwoTargets-stdout.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/NotExist-result.txt (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/NotExist-stderr.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/RunCMakeTest.cmake (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/Unknown-result.txt (100%) create mode 100644 Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt create mode 100644 Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/test.cmake.in (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/testAddressSanitizer.cmake (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/testLeakSanitizer.cmake (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/testMemorySanitizer.cmake (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/testThreadSanitizer.cmake (100%) rename Tests/RunCMake/{CTestMemcheck => ctest_memcheck}/testUndefinedBehaviorSanitizer.cmake (100%) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 44e6ec462..59c6918e5 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -66,7 +66,7 @@ add_RunCMake_test(CMP0055) add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) - add_RunCMake_test(CTestMemcheck + add_RunCMake_test(ctest_memcheck -DPSEUDO_BC=$ -DPSEUDO_PURIFY=$ -DPSEUDO_VALGRIND=$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt deleted file mode 100644 index 725270c91..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt deleted file mode 100644 index 634e331f3..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-build/Testing/Temporary/MemoryChecker.1.log -.*Error parsing XML in stream at line 1: no element found -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt deleted file mode 100644 index 520222f87..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt deleted file mode 100644 index 29c6ec7d9..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt deleted file mode 100644 index 2506f354a..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-build/Testing/Temporary/MemoryChecker.1.log -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt deleted file mode 100644 index ca23692fc..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt deleted file mode 100644 index fd684da4a..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt deleted file mode 100644 index 1a2ee5cb1..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-build/Testing/Temporary/MemoryChecker.1.log -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt deleted file mode 100644 index 9a6a1d618..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt +++ /dev/null @@ -1 +0,0 @@ -Memory check project .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-build diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt deleted file mode 100644 index d8d1ff05a..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory checker suppression file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-build/does-not-exist -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt deleted file mode 100644 index d46912e21..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt +++ /dev/null @@ -1 +0,0 @@ -Memory check project .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-build$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt deleted file mode 100644 index 321a2a577..000000000 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-build/Testing/Temporary/MemoryChecker.1.log -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt b/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt deleted file mode 100644 index 9e9226690..000000000 --- a/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt +++ /dev/null @@ -1 +0,0 @@ -Memory check project .*/Tests/RunCMake/CTestMemcheck/NotExist-build$ diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt b/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt deleted file mode 100644 index 2beea2d5d..000000000 --- a/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -Do not understand memory checker: .*/cmake.* -Error in read script: .*/Tests/RunCMake/CTestMemcheck/Unknown/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt b/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt deleted file mode 100644 index 7ea1af026..000000000 --- a/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt +++ /dev/null @@ -1 +0,0 @@ -Memory check project .*/Tests/RunCMake/CTestMemcheck/Unknown-build$ diff --git a/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in similarity index 100% rename from Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in rename to Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in diff --git a/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in b/Tests/RunCMake/ctest_memcheck/CTestConfig.cmake.in similarity index 100% rename from Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in rename to Tests/RunCMake/ctest_memcheck/CTestConfig.cmake.in diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt new file mode 100644 index 000000000..00f477986 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt b/Tests/RunCMake/ctest_memcheck/DummyBC-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyBC-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyBC-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyBC-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyBC-stderr.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyBC-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyBC-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt new file mode 100644 index 000000000..5c582ac2b --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt @@ -0,0 +1,3 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +.*Error parsing XML in stream at line 1: no element found +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt new file mode 100644 index 000000000..c09934019 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt new file mode 100644 index 000000000..6c42ec1ba --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyPurify-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt new file mode 100644 index 000000000..41120b593 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt new file mode 100644 index 000000000..cb353ad55 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt new file mode 100644 index 000000000..7ce798c04 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrind-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt new file mode 100644 index 000000000..97bb833cb --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt similarity index 50% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt index 2d078ef5f..0c997ff2c 100644 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt @@ -1,3 +1,3 @@ Problem running command: .*memcheck_fail.* Problem executing post-memcheck command\(s\). -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost/test.cmake +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt similarity index 50% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt index 43ccb2e14..1d1b1e7d9 100644 --- a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt @@ -1,3 +1,3 @@ Problem running command: .*memcheck_fail.* Problem executing pre-memcheck command\(s\). -Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre/test.cmake +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt new file mode 100644 index 000000000..8d8b7e9ee --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-build diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt new file mode 100644 index 000000000..65beb81ad --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory checker suppression file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-build/does-not-exist +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt new file mode 100644 index 000000000..4c58df40b --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-build$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt new file mode 100644 index 000000000..e2a836f39 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stdout.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt rename to Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stdout.txt diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-result.txt b/Tests/RunCMake/ctest_memcheck/NotExist-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/NotExist-result.txt rename to Tests/RunCMake/ctest_memcheck/NotExist-result.txt diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt b/Tests/RunCMake/ctest_memcheck/NotExist-stderr.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt rename to Tests/RunCMake/ctest_memcheck/NotExist-stderr.txt diff --git a/Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt b/Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt new file mode 100644 index 000000000..0e58936c5 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/NotExist-build$ diff --git a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake similarity index 100% rename from Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake rename to Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-result.txt b/Tests/RunCMake/ctest_memcheck/Unknown-result.txt similarity index 100% rename from Tests/RunCMake/CTestMemcheck/Unknown-result.txt rename to Tests/RunCMake/ctest_memcheck/Unknown-result.txt diff --git a/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt b/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt new file mode 100644 index 000000000..99df8b39b --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt @@ -0,0 +1,2 @@ +Do not understand memory checker: .*/cmake.* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/Unknown/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt b/Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt new file mode 100644 index 000000000..0208e80f1 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/Unknown-build$ diff --git a/Tests/RunCMake/CTestMemcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in similarity index 100% rename from Tests/RunCMake/CTestMemcheck/test.cmake.in rename to Tests/RunCMake/ctest_memcheck/test.cmake.in diff --git a/Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake similarity index 100% rename from Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake rename to Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake diff --git a/Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake similarity index 100% rename from Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake rename to Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake diff --git a/Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake similarity index 100% rename from Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake rename to Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake diff --git a/Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake similarity index 100% rename from Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake rename to Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake diff --git a/Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake similarity index 100% rename from Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake rename to Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake From 14713eebfb3152bb7b3591515da5780b4eec1dd3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 20 Feb 2015 00:01:16 -0500 Subject: [PATCH 0158/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 92f6278cb..5f5e67602 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150219) +set(CMake_VERSION_PATCH 20150220) #set(CMake_VERSION_RC 1) From 7b582d15ff4d70e77287eaf5abb4ea240eb26da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Fri, 20 Feb 2015 10:45:14 +0100 Subject: [PATCH 0159/1029] CPack: Print output from codesign if signing fails --- Source/CPack/cmCPackBundleGenerator.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index e75156810..6e7a26b22 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -214,6 +214,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) // codesign the application. if(!cpack_apple_cert_app.empty()) { + std::string output; std::string bundle_path; bundle_path = src_dir + "/"; bundle_path += this->GetOption("CPACK_BUNDLE_NAME"); @@ -240,11 +241,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) temp_sign_file_cmd << bundle_path; temp_sign_file_cmd << it->c_str() << "\""; - if(!this->RunCommand(temp_sign_file_cmd)) + if(!this->RunCommand(temp_sign_file_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error signing file:" - << bundle_path << it->c_str() << std::endl); + << bundle_path << it->c_str() << std::endl << output << std::endl); return 0; } @@ -256,11 +257,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) temp_sign_binary_cmd << " --deep -f -s \"" << cpack_apple_cert_app; temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; - if(!this->RunCommand(temp_sign_binary_cmd)) + if(!this->RunCommand(temp_sign_binary_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error signing the application binary." - << std::endl); + << std::endl << output << std::endl); return 0; } @@ -276,11 +277,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) } temp_codesign_cmd << " \"" << bundle_path << "\""; - if(!this->RunCommand(temp_codesign_cmd)) + if(!this->RunCommand(temp_codesign_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error signing the application package." - << std::endl); + << std::endl << output << std::endl); return 0; } From e1da4dc2dd55926c9d7140f830a5338512279b3f Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 16 Feb 2015 00:22:10 +0100 Subject: [PATCH 0160/1029] CheckStructHasMember: fix null deref warning (#15413) Clang Static Analyzer is so smart that it reports a defect when this intended null-deref is encountered. Use sizeof instead which has no runtime effects. --- Modules/CheckStructHasMember.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index de31d2ce2..6c1520592 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -69,7 +69,7 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) ${_INCLUDE_FILES} int main() { - (void)((${_STRUCT} *)0)->${_MEMBER}; + (void)sizeof(((${_STRUCT} *)0)->${_MEMBER}); return 0; } ") From dc0f3fb44fb9384438ece513c12d83a36e385802 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 20 Feb 2015 17:51:55 +0100 Subject: [PATCH 0161/1029] CPackWIX: Explicitly list CPack WIX headers for IDE convenience. --- Source/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 69bc2a1b6..0b077d468 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -638,14 +638,24 @@ endif() if(WIN32) set(CPACK_SRCS ${CPACK_SRCS} CPack/WiX/cmCPackWIXGenerator.cxx + CPack/WiX/cmCPackWIXGenerator.h CPack/WiX/cmWIXAccessControlList.cxx + CPack/WiX/cmWIXAccessControlList.h CPack/WiX/cmWIXDirectoriesSourceWriter.cxx + CPack/WiX/cmWIXDirectoriesSourceWriter.h CPack/WiX/cmWIXFeaturesSourceWriter.cxx + CPack/WiX/cmWIXFeaturesSourceWriter.h CPack/WiX/cmWIXFilesSourceWriter.cxx + CPack/WiX/cmWIXFilesSourceWriter.h CPack/WiX/cmWIXPatch.cxx + CPack/WiX/cmWIXPatch.h CPack/WiX/cmWIXPatchParser.cxx + CPack/WiX/cmWIXPatchParser.h CPack/WiX/cmWIXRichTextFormatWriter.cxx + CPack/WiX/cmWIXRichTextFormatWriter.h + CPack/WiX/cmWIXShortcut.h CPack/WiX/cmWIXSourceWriter.cxx + CPack/WiX/cmWIXSourceWriter.h ) endif() From 05fec779d33b872721b9731e872125ebeb89403b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 13:40:56 +0100 Subject: [PATCH 0162/1029] cmTarget: Port loop to algorithm. --- Source/cmTarget.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1ad0d486a..ebcd8100e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1542,12 +1542,9 @@ void cmTarget::DeleteDependencyForVS6( DependencyMap& depMap, if( map_itr != depMap.end() ) { DependencyList& depList = map_itr->second; - DependencyList::iterator itr; - while( (itr = std::find(depList.begin(), depList.end(), dep)) != - depList.end() ) - { - depList.erase( itr ); - } + DependencyList::iterator begin = + std::remove(depList.begin(), depList.end(), dep); + depList.erase(begin, depList.end()); } } From 60c3bb73e39f7b19a17c989a0f9bf70bbfe73683 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 22:29:11 +0100 Subject: [PATCH 0163/1029] cmGlobalGenerator: Replace loop with algorithm. --- Source/cmGlobalGenerator.cxx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c976c699b..ac4489afc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2571,17 +2571,12 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name) "test", "RUN_TESTS", "package", "PACKAGE", "package_source", - "ZERO_CHECK", - 0 + "ZERO_CHECK" }; - for(const char** reservedTarget = reservedTargets; - *reservedTarget; ++reservedTarget) - { - if(name == *reservedTarget) return true; - } - - return false; + return std::find(cmArrayBegin(reservedTargets), + cmArrayEnd(reservedTargets), name) + != cmArrayEnd(reservedTargets); } void cmGlobalGenerator::SetExternalMakefileProjectGenerator( From 76207b0861478318115d65c2e983f4d88c937724 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 19:50:09 +0100 Subject: [PATCH 0164/1029] cmCacheManager: Replace loop with algorithm. --- Source/cmCacheManager.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 45e92cef9..0c77891e7 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -186,11 +186,7 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path) cmsys::Glob globIt; globIt.FindFiles(glob); std::vector files = globIt.GetFiles(); - for(std::vector::iterator i = files.begin(); - i != files.end(); ++i) - { - cmSystemTools::RemoveFile(*i); - } + std::for_each(files.begin(), files.end(), cmSystemTools::RemoveFile); } bool cmCacheManager::LoadCache(const std::string& path, From a281809384cc19cc9a7d1726b243020b380b9395 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 12 Feb 2015 20:53:43 +0100 Subject: [PATCH 0165/1029] Use cmJoin where possible. --- Source/cmCoreTryCompile.cxx | 15 +++------------ Source/cmFindBase.cxx | 13 ++----------- Source/cmLocalUnixMakefileGenerator3.cxx | 8 +------- Source/cmcmd.cxx | 24 +++--------------------- 4 files changed, 9 insertions(+), 51 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 8e20c14e8..bcd2d812c 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -260,14 +260,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) err << "Unknown extension \"" << ext << "\" for file\n" << " " << *si << "\n" << "try_compile() works only for enabled languages. " - << "Currently these are:\n "; + << "Currently these are:\n "; std::vector langs; gg->GetEnabledLanguages(langs); - for(std::vector::iterator l = langs.begin(); - l != langs.end(); ++l) - { - err << " " << *l; - } + err << cmJoin(langs, " "); err << "\nSee project() command to enable other languages."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str()); return -1; @@ -373,12 +369,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) // handle any compile flags we need to pass on if (!compileDefs.empty()) { - fprintf(fout, "add_definitions( "); - for (size_t i = 0; i < compileDefs.size(); ++i) - { - fprintf(fout,"%s ",compileDefs[i].c_str()); - } - fprintf(fout, ")\n"); + fprintf(fout, "add_definitions(%s)\n", cmJoin(compileDefs, " ").c_str()); } /* Use a random file name to avoid rapid creation and deletion diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 6e555333d..fd3aa0b1d 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -350,19 +350,10 @@ void cmFindBase::PrintFindStuff() std::cerr << "NoCMakeSystemPath " << this->NoCMakeSystemPath << "\n"; std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n"; std::cerr << "CMakePathName " << this->CMakePathName << "\n"; - std::cerr << "Names "; - for(unsigned int i =0; i < this->Names.size(); ++i) - { - std::cerr << this->Names[i] << " "; - } - std::cerr << "\n"; + std::cerr << "Names " << cmJoin(this->Names, " ") << "\n"; std::cerr << "\n"; std::cerr << "SearchPathSuffixes "; - for(unsigned int i =0; i < this->SearchPathSuffixes.size(); ++i) - { - std::cerr << this->SearchPathSuffixes[i] << "\n"; - } - std::cerr << "\n"; + std::cerr << cmJoin(this->SearchPathSuffixes, "\n") << "\n"; std::cerr << "SearchPaths\n"; for(std::vector::const_iterator i = this->SearchPaths.begin(); i != this->SearchPaths.end(); ++i) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c275e6b94..68657ad82 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1330,13 +1330,7 @@ cmLocalUnixMakefileGenerator3 this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); fout << "\n" << "# Per-language clean rules from dependency scanning.\n" - << "foreach(lang"; - for(std::set::const_iterator l = languages.begin(); - l != languages.end(); ++l) - { - fout << " " << *l; - } - fout << ")\n" + << "foreach(lang " << cmJoin(languages, " ") << ")\n" << " include(" << this->GetTargetDirectory(target) << "/cmake_clean_${lang}.cmake OPTIONAL)\n" << "endforeach()\n"; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 6a7dc6ea5..eb637eff3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -213,27 +213,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Echo string else if (args[1] == "echo" ) { - unsigned int cc; - const char* space = ""; - for ( cc = 2; cc < args.size(); cc ++ ) - { - std::cout << space << args[cc]; - space = " "; - } - std::cout << std::endl; + std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl; return 0; } // Echo string no new line else if (args[1] == "echo_append" ) { - unsigned int cc; - const char* space = ""; - for ( cc = 2; cc < args.size(); cc ++ ) - { - std::cout << space << args[cc]; - space = " "; - } + std::cout << cmJoin(cmRange(args).advance(2), " "); return 0; } @@ -1329,12 +1316,7 @@ bool cmcmd::RunCommand(const char* comment, if(verbose) { std::cout << comment << ":\n"; - for(std::vector::iterator i = command.begin(); - i != command.end(); ++i) - { - std::cout << *i << " "; - } - std::cout << "\n"; + std::cout << cmJoin(command, " ") << "\n"; } std::string output; int retCode =0; From 37b88d348a20921c835ce7aa99f6db62271503a7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 23:50:36 +0100 Subject: [PATCH 0166/1029] cmAlgorithms: Add cmWrap. Port some existing cmJoin to use it. cmJoin is cumbersome to use in cases where the objective is to somehow 'quote' each item and then join it with a separator. In that case, the joiner string is harder to read and reason about. cmWrap aims to solve that. Provide an overload taking char wrappers to simplify the case of surrounding every element in quotes without needing to escape the quote character. --- Source/cmAlgorithms.h | 17 +++++++++++++++++ Source/cmGlobalGenerator.cxx | 11 ++--------- Source/cmLocalUnixMakefileGenerator3.cxx | 7 +------ Source/cmSystemTools.cxx | 2 +- Source/cmcmd.cxx | 4 +--- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 8491838e5..43e113b3a 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -278,4 +278,21 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) return cmRemoveIndices(r, indices); } +template +std::string cmWrap(std::string prefix, Range const& r, std::string suffix, + std::string sep) +{ + if (r.empty()) + { + return std::string(); + } + return prefix + cmJoin(r, (suffix + sep + prefix).c_str()) + suffix; +} + +template +std::string cmWrap(char prefix, Range const& r, char suffix, std::string sep) +{ + return cmWrap(std::string(1, prefix), r, std::string(1, suffix), sep); +} + #endif diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ac4489afc..93692f61e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2295,15 +2295,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) std::ostringstream ostr; if (!componentsSet->empty()) { - ostr << "Available install components are:"; - std::set::iterator it; - for ( - it = componentsSet->begin(); - it != componentsSet->end(); - ++ it ) - { - ostr << " \"" << *it << "\""; - } + ostr << "Available install components are: "; + ostr << cmWrap('"', *componentsSet, '"', " "); } else { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 68657ad82..432cb3af3 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -724,12 +724,7 @@ cmLocalUnixMakefileGenerator3 } // Write the list of commands. - for(std::vector::const_iterator i = commands.begin(); - i != commands.end(); ++i) - { - replace = *i; - os << "\t" << replace << "\n"; - } + os << cmWrap("\t", commands, "", "\n") << "\n"; if(symbolic && !this->WatcomWMake) { os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index bf496e948..5264123d7 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -835,7 +835,7 @@ cmSystemTools::PrintSingleCommand(std::vector const& command) return std::string(); } - return "\"" + cmJoin(command, "\" \"") + "\""; + return cmWrap('"', command, '"', " "); } bool cmSystemTools::DoesFileExistWithExtensions( diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index eb637eff3..7d67bd82a 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -450,9 +450,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) return 1; } - std::string command = "\""; - command += cmJoin(cmRange(args).advance(3), "\" \""); - command += "\""; + std::string command = cmWrap('"', cmRange(args).advance(3), '"', " "); int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, From 416df93aa93d0a633f0e7354d0562934f676768b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 22:14:26 +0100 Subject: [PATCH 0167/1029] Convert some raw loops to cmWrap. --- Source/cmComputeLinkDepends.cxx | 5 +---- Source/cmCoreTryCompile.cxx | 8 +++----- Source/cmFindBase.cxx | 6 +----- Source/cmFindPackageCommand.cxx | 14 +++----------- Source/cmMakefile.cxx | 8 +------- 5 files changed, 9 insertions(+), 32 deletions(-) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 86526905a..be28b2f54 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -705,10 +705,7 @@ void cmComputeLinkDepends::DisplayConstraintGraph() { EdgeList const& nl = this->EntryConstraintGraph[i]; e << "item " << i << " is [" << this->EntryList[i].Item << "]\n"; - for(EdgeList::const_iterator j = nl.begin(); j != nl.end(); ++j) - { - e << " item " << *j << " must follow it\n"; - } + e << cmWrap(" item ", nl, " must follow it", "\n") << "\n"; } fprintf(stderr, "%s\n", e.str().c_str()); } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index bcd2d812c..e9390e430 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -683,11 +683,9 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName) std::ostringstream emsg; emsg << "Unable to find the executable at any of:\n"; - for (unsigned int i = 0; i < searchDirs.size(); ++i) - { - emsg << " " << this->BinaryDirectory << searchDirs[i] - << tmpOutputFile << "\n"; - } + emsg << cmWrap(" " + this->BinaryDirectory, + searchDirs, + tmpOutputFile, "\n") << "\n"; this->FindErrorMessage = emsg.str(); return; } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index fd3aa0b1d..6fe055a19 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -355,11 +355,7 @@ void cmFindBase::PrintFindStuff() std::cerr << "SearchPathSuffixes "; std::cerr << cmJoin(this->SearchPathSuffixes, "\n") << "\n"; std::cerr << "SearchPaths\n"; - for(std::vector::const_iterator i = this->SearchPaths.begin(); - i != this->SearchPaths.end(); ++i) - { - std::cerr << "[" << *i << "]\n"; - } + std::cerr << cmWrap("[", this->SearchPaths, "]", "\n") << "\n"; } bool cmFindBase::CheckForVariableInCache() diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index fd9b236a8..26bd4b98e 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -329,10 +329,7 @@ bool cmFindPackageCommand { std::ostringstream e; e << "called with components that are both required and optional:\n"; - for(unsigned int i=0; iSetError(e.str()); return false; } @@ -808,13 +805,8 @@ bool cmFindPackageCommand::HandlePackageMode() { e << "Could not find a package configuration file provided by \"" << this->Name << "\"" << requestedVersionString - << " with any of the following names:\n"; - for(std::vector::const_iterator ci = - this->Configs.begin(); - ci != this->Configs.end(); ++ci) - { - e << " " << *ci << "\n"; - } + << " with any of the following names:\n" + << cmWrap(" ", this->Configs, "", "\n") << "\n"; } e << "Add the installation prefix of \"" << this->Name << "\" to " diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6fd569e64..3c92fca24 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -213,13 +213,7 @@ cmMakefile::~cmMakefile() void cmMakefile::PrintStringVector(const char* s, const std::vector& v) const { - std::cout << s << ": ( \n"; - for(std::vector::const_iterator i = v.begin(); - i != v.end(); ++i) - { - std::cout << *i << " "; - } - std::cout << " )\n"; + std::cout << s << ": ( \n" << cmWrap('"', v, '"', " ") << ")\n"; } void cmMakefile From 21b0654ace2ce58d191c2e42a8583b05614cd037 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Feb 2015 23:29:18 +0100 Subject: [PATCH 0168/1029] cmGlobalGenerator: Convert set insert algorithm to vector algorithms. Adjust test for new error output. --- Source/cmGlobalGenerator.cxx | 26 ++++++++++++------- .../File_Generate/CommandConflict-stderr.txt | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 93692f61e..61470092f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -3015,7 +3015,7 @@ void cmGlobalGenerator::AddEvaluationFile(const std::string &inputFile, //---------------------------------------------------------------------------- void cmGlobalGenerator::ProcessEvaluationFiles() { - std::set generatedFiles; + std::vector generatedFiles; for(std::vector::const_iterator li = this->EvaluationFiles.begin(); li != this->EvaluationFiles.end(); @@ -3027,16 +3027,24 @@ void cmGlobalGenerator::ProcessEvaluationFiles() return; } std::vector files = (*li)->GetFiles(); - for(std::vector::const_iterator fi = files.begin(); - fi != files.end(); ++fi) + std::sort(files.begin(), files.end()); + + std::vector intersection; + std::set_intersection(files.begin(), files.end(), + generatedFiles.begin(), generatedFiles.end(), + std::back_inserter(intersection)); + if (!intersection.empty()) { - if (!generatedFiles.insert(*fi).second) - { - cmSystemTools::Error("File to be generated by multiple different " - "commands: ", fi->c_str()); - return; - } + cmSystemTools::Error("Files to be generated by multiple different " + "commands: ", cmWrap('"', intersection, '"', " ").c_str()); + return; } + + generatedFiles.insert(generatedFiles.end(), + files.begin(), files.end()); + std::vector::iterator newIt = + generatedFiles.end() - files.size(); + std::inplace_merge(generatedFiles.begin(), newIt, generatedFiles.end()); } } diff --git a/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt b/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt index da97ba476..4fa3f2033 100644 --- a/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/CommandConflict-stderr.txt @@ -1 +1 @@ -CMake Error: File to be generated by multiple different commands: .*CommandConflict-build/output_.*.txt +CMake Error: Files to be generated by multiple different commands: ".*CommandConflict-build/output_.*.txt" From dfe49c205654a51f860507ea5d8ad133b2a4f064 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 23:43:55 +0100 Subject: [PATCH 0169/1029] cmRST: Use std::min where appropriate. --- Source/cmRST.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index d20d99962..da72ab702 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -463,10 +463,7 @@ void cmRST::UnindentLines(std::vector& lines) } // Truncate indentation to match that on this line. - if(line.size() < indentEnd) - { - indentEnd = line.size(); - } + indentEnd = std::min(indentEnd, line.size()); for(std::string::size_type j = 0; j != indentEnd; ++j) { if(line[j] != indentText[j]) From 8ed6ecac3fb0f832333e2d5d6f3551ab8e335d0f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 30 Jan 2015 00:01:06 +0100 Subject: [PATCH 0170/1029] cmRST: Move two algorithms beside each other. --- Source/cmRST.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index da72ab702..14e8ad952 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -490,7 +490,6 @@ void cmRST::UnindentLines(std::vector& lines) { ++leadingEmpty; } - lines.erase(lines.begin(), lines.begin()+leadingEmpty); // Drop trailing blank lines. size_t trailingEmpty = 0; @@ -498,5 +497,6 @@ void cmRST::UnindentLines(std::vector& lines) { ++trailingEmpty; } + lines.erase(lines.begin(), lines.begin()+leadingEmpty); lines.erase(lines.end()-trailingEmpty, lines.end()); } From 09d6125bfe4034f332956f4bcc5b0a1ba0b82e27 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 23:39:38 +0100 Subject: [PATCH 0171/1029] cmAlgorithms: Move cmRotate out of 'implementation detail' namespace. This should be generally usable in cmake. --- Source/cmAlgorithms.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 43e113b3a..30a062a45 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -81,6 +81,16 @@ private: const std::string m_test; }; +template +BiDirIt cmRotate(BiDirIt first, BiDirIt middle, BiDirIt last) +{ + typename std::iterator_traits::difference_type dist = + std::distance(first, middle); + std::rotate(first, middle, last); + std::advance(last, -dist); + return last; +} + namespace ContainerAlgorithms { template @@ -138,20 +148,10 @@ private: const_iterator End; }; -template -BiDirIt Rotate(BiDirIt first, BiDirIt middle, BiDirIt last) -{ - typename std::iterator_traits::difference_type dist = - std::distance(first, middle); - std::rotate(first, middle, last); - std::advance(last, -dist); - return last; -} - template Iter RemoveN(Iter i1, Iter i2, size_t n) { - return ContainerAlgorithms::Rotate(i1, i1 + n, i2); + return cmRotate(i1, i1 + n, i2); } template From 61fe1919de8c0455a6baff543ccfcb35fce8f37b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 17 Feb 2015 21:59:26 +0100 Subject: [PATCH 0172/1029] cmAlgorithms: Update concept requirement to FowardIterator --- Source/cmAlgorithms.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 30a062a45..53e2dc877 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -81,14 +81,14 @@ private: const std::string m_test; }; -template -BiDirIt cmRotate(BiDirIt first, BiDirIt middle, BiDirIt last) +template +FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) { - typename std::iterator_traits::difference_type dist = - std::distance(first, middle); + typename std::iterator_traits::difference_type dist = + std::distance(middle, last); std::rotate(first, middle, last); - std::advance(last, -dist); - return last; + std::advance(first, dist); + return first; } namespace ContainerAlgorithms { From 8c74a41ff3b6fce1bb7d088d16f5e0a9ae8ab55d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 30 Jan 2015 00:03:24 +0100 Subject: [PATCH 0173/1029] cmRST: Replace two erase with a rotate and larger erase. --- Source/cmRST.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 14e8ad952..c261d5796 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -497,6 +497,10 @@ void cmRST::UnindentLines(std::vector& lines) { ++trailingEmpty; } - lines.erase(lines.begin(), lines.begin()+leadingEmpty); - lines.erase(lines.end()-trailingEmpty, lines.end()); + + std::vector::iterator contentEnd + = cmRotate(lines.begin(), + lines.begin() + leadingEmpty, + lines.end() - trailingEmpty); + lines.erase(contentEnd, lines.end()); } From a3a0a8c222b59f15502f52192bf41c4af2882392 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 11 Feb 2015 23:53:41 +0100 Subject: [PATCH 0174/1029] cmAlgorithms: Add cmFindNot algorithm. --- Source/cmAlgorithms.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 53e2dc877..d88de1ed3 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -295,4 +295,11 @@ std::string cmWrap(char prefix, Range const& r, char suffix, std::string sep) return cmWrap(std::string(1, prefix), r, std::string(1, suffix), sep); } +template +typename Range::const_iterator cmFindNot(Range const& r, T const& t) +{ + return std::find_if(r.begin(), r.end(), + std::bind1st(std::not_equal_to(), t)); +} + #endif From 4afe6c26c66556827e6089982c49b8dea3a2efcb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 17 Feb 2015 22:04:25 +0100 Subject: [PATCH 0175/1029] cmAlgorithms: Add cmReverseRange adaptor. Use it to implement list(REVERSE). --- Source/cmAlgorithms.h | 8 ++++++++ Source/cmListCommand.cxx | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index d88de1ed3..b9bd67b57 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -302,4 +302,12 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) std::bind1st(std::not_equal_to(), t)); } +template +ContainerAlgorithms::Range +cmReverseRange(Range const& range) +{ + return ContainerAlgorithms::Range( + range.rbegin(), range.rend()); +} + #endif diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 0c6adfd11..17617aae8 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -390,8 +390,7 @@ bool cmListCommand return false; } - std::reverse(varArgsExpanded.begin(), varArgsExpanded.end()); - std::string value = cmJoin(varArgsExpanded, ";"); + std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true; From bb9d71b4fee2cc4abf55e0dcbadf85c6cbe0d07d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 2 Feb 2015 02:13:54 +0100 Subject: [PATCH 0176/1029] Replace loops with algorithms. --- Source/cmRST.cxx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index c261d5796..cb61ed995 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -484,19 +484,12 @@ void cmRST::UnindentLines(std::vector& lines) } } - // Drop leading blank lines. - size_t leadingEmpty = 0; - for(size_t i = 0; i < lines.size() && lines[i].empty(); ++i) - { - ++leadingEmpty; - } + std::vector::const_iterator it = lines.begin(); + size_t leadingEmpty = std::distance(it, cmFindNot(lines, std::string())); - // Drop trailing blank lines. - size_t trailingEmpty = 0; - for(size_t i = lines.size(); i > 0 && lines[i-1].empty(); --i) - { - ++trailingEmpty; - } + std::vector::const_reverse_iterator rit = lines.rbegin(); + size_t trailingEmpty = std::distance(rit, + cmFindNot(cmReverseRange(lines), std::string())); std::vector::iterator contentEnd = cmRotate(lines.begin(), From 8804c3e0e419eb692ba487ffb2a7e36b1f8e728d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 21 Feb 2015 00:01:16 -0500 Subject: [PATCH 0177/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5f5e67602..5311b3680 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150220) +set(CMake_VERSION_PATCH 20150221) #set(CMake_VERSION_RC 1) From f93438cd839fa209afbf227b5a6a0b58214004b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 21 Feb 2015 10:27:54 +0100 Subject: [PATCH 0178/1029] Fix typo, graphiz -> graphviz. --- Modules/CMakeGraphVizOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake index 64c89b91d..ff182672e 100644 --- a/Modules/CMakeGraphVizOptions.cmake +++ b/Modules/CMakeGraphVizOptions.cmake @@ -10,7 +10,7 @@ # CMake # can generate graphviz files, showing the dependencies between the # targets in a project and also external libraries which are linked -# against. When CMake is run with the --graphiz=foo option, it will +# against. When CMake is run with the --graphviz=foo option, it will # produce # # * a foo.dot file showing all dependencies in the project From 1116698a89e4057300481bac8f38bfd95f4e9ce5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 21 Feb 2015 11:00:14 +0100 Subject: [PATCH 0179/1029] cmTarget: Don't needlessly clear vectors in the destructor. This will be done anyway for us. --- Source/cmTarget.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1ad0d486a..1e47294d3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6875,11 +6875,11 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - deleteAndClear(this->Pointer->IncludeDirectoriesEntries); - deleteAndClear(this->Pointer->CompileOptionsEntries); - deleteAndClear(this->Pointer->CompileFeaturesEntries); - deleteAndClear(this->Pointer->CompileDefinitionsEntries); - deleteAndClear(this->Pointer->SourceEntries); + cmDeleteAll(this->Pointer->IncludeDirectoriesEntries); + cmDeleteAll(this->Pointer->CompileOptionsEntries); + cmDeleteAll(this->Pointer->CompileFeaturesEntries); + cmDeleteAll(this->Pointer->CompileDefinitionsEntries); + cmDeleteAll(this->Pointer->SourceEntries); delete this->Pointer; } From f19692342ba41ddb2638e118e2864bceca77af59 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 21 Feb 2015 11:01:21 +0100 Subject: [PATCH 0180/1029] cmFunctionCommand: Remove ineffectual code. The name variable is never used. --- Source/cmFunctionCommand.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index a4d93579e..9297688c5 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -175,11 +175,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endfunction for this function then execute if (!this->Depth) { - std::string name = this->Args[0]; - name += "( "; - name += cmJoin(this->Args, " "); - name += " )"; - // create a new command and add it to cmake cmFunctionHelperCommand *f = new cmFunctionHelperCommand(); f->Args = this->Args; From 2d130896a05ef14f2ef53ed472c6926a85cc5399 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 21 Feb 2015 11:24:24 +0100 Subject: [PATCH 0181/1029] cmMakefile: Fix list of macros generation. It was broken by commit 7ee56f03 (Convert loops into the commonly used pattern., 2015-01-17). --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ac5fec9c3..ab0d60ac3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3757,7 +3757,7 @@ void cmMakefile::GetListOfMacros(std::string& macros) const { macros += sep; macros += it->first; - sep = ""; + sep = ";"; } } From c021f59c1f2f3d892b621a9ba163b069f2a2f0a9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 21 Feb 2015 11:25:47 +0100 Subject: [PATCH 0182/1029] cmMakefile: Store macro list in a vector not in a map. The signature was computed (incorrectly) and stored as the map value, but never used. Remove it now. --- Source/cmGetCMakePropertyCommand.cxx | 1 + Source/cmMacroCommand.cxx | 10 +--------- Source/cmMakefile.cxx | 22 ++++++---------------- Source/cmMakefile.h | 5 ++--- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 84c00bac4..fd1859692 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -39,6 +39,7 @@ bool cmGetCMakePropertyCommand } else if ( args[1] == "MACROS" ) { + output.clear(); this->Makefile->GetListOfMacros(output); } else if ( args[1] == "COMPONENTS" ) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 29e8cb1f9..12c8576fd 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -224,15 +224,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endmacro for this macro then execute if (!this->Depth) { - std::string name = this->Args[0]; - name += "("; - if (!this->Args.empty()) - { - name += " "; - name += cmJoin(this->Args, " "); - } - name += " )"; - mf.AddMacro(this->Args[0].c_str(), name.c_str()); + mf.AddMacro(this->Args[0].c_str()); // create a new command and add it to cmake cmMacroHelperCommand *f = new cmMacroHelperCommand(); f->Args = this->Args; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ab0d60ac3..93b2ce61c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -143,7 +143,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->LocalGenerator = mf.LocalGenerator; this->FunctionBlockers = mf.FunctionBlockers; - this->MacrosMap = mf.MacrosMap; + this->MacrosList = mf.MacrosList; this->SubDirectoryOrder = mf.SubDirectoryOrder; this->Properties = mf.Properties; this->PreOrder = mf.PreOrder; @@ -3739,26 +3739,16 @@ cmVariableWatch *cmMakefile::GetVariableWatch() const } #endif -void cmMakefile::AddMacro(const char* name, const char* signature) +void cmMakefile::AddMacro(const char* name) { - if ( !name || !signature ) - { - return; - } - this->MacrosMap[name] = signature; + assert(name); + this->MacrosList.push_back(name); } void cmMakefile::GetListOfMacros(std::string& macros) const { - StringStringMap::const_iterator it; - macros = ""; - const char* sep = ""; - for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it ) - { - macros += sep; - macros += it->first; - sep = ";"; - } + assert(macros.empty()); + macros = cmJoin(this->MacrosList, ";"); } cmCacheManager *cmMakefile::GetCacheManager() const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 895a2fc21..e98f1d9ce 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -841,7 +841,7 @@ public: * Add a macro to the list of macros. The arguments should be name of the * macro and a documentation signature of it */ - void AddMacro(const char* name, const char* signature); + void AddMacro(const char* name); ///! Add a new cmTest to the list of tests for this makefile. cmTest* CreateTest(const std::string& testName); @@ -1065,8 +1065,7 @@ private: std::stack LoopBlockCounter; - typedef std::map StringStringMap; - StringStringMap MacrosMap; + std::vector MacrosList; std::map SubDirectoryOrder; From 53d7dafface62d40ea795456394f7ab1d5ee6712 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 21 Feb 2015 12:38:14 +0100 Subject: [PATCH 0183/1029] CPackWIX: Refactor start menu and desktop shortcut creation. --- Source/CMakeLists.txt | 1 + Source/CPack/WiX/cmCPackWIXGenerator.cxx | 189 ++++++++++---------- Source/CPack/WiX/cmCPackWIXGenerator.h | 26 ++- Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 31 +--- Source/CPack/WiX/cmWIXFilesSourceWriter.h | 19 +- Source/CPack/WiX/cmWIXShortcut.cxx | 86 +++++++++ Source/CPack/WiX/cmWIXShortcut.h | 49 ++++- 7 files changed, 250 insertions(+), 151 deletions(-) create mode 100644 Source/CPack/WiX/cmWIXShortcut.cxx diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 0b077d468..5b518b8f0 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -653,6 +653,7 @@ if(WIN32) CPack/WiX/cmWIXPatchParser.h CPack/WiX/cmWIXRichTextFormatWriter.cxx CPack/WiX/cmWIXRichTextFormatWriter.h + CPack/WiX/cmWIXShortcut.cxx CPack/WiX/cmWIXShortcut.h CPack/WiX/cmWIXSourceWriter.cxx CPack/WiX/cmWIXSourceWriter.h diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 11d5437e7..f18eaeb47 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -33,7 +33,6 @@ #include // for GUID generation cmCPackWIXGenerator::cmCPackWIXGenerator(): - HasDesktopShortcuts(false), Patch(0) { @@ -490,18 +489,16 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.EndElement("Feature"); - bool hasShortcuts = false; + std::set emittedShortcutTypes; - shortcut_map_t globalShortcuts; + cmWIXShortcuts globalShortcuts; if(Components.empty()) { AddComponentsToFeature(toplevel, "ProductFeature", directoryDefinitions, fileDefinitions, featureDefinitions, globalShortcuts); - if(globalShortcuts.size()) - { - hasShortcuts = true; - } + + globalShortcuts.AddShortcutTypes(emittedShortcutTypes); } else { @@ -516,33 +513,29 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() std::string componentFeatureId = "CM_C_" + component.Name; - shortcut_map_t featureShortcuts; + cmWIXShortcuts featureShortcuts; AddComponentsToFeature(componentPath, componentFeatureId, directoryDefinitions, fileDefinitions, featureDefinitions, featureShortcuts); - if(featureShortcuts.size()) - { - hasShortcuts = true; - } - if(featureShortcuts.size()) + featureShortcuts.AddShortcutTypes(emittedShortcutTypes); + + if(!CreateShortcuts(component.Name, componentFeatureId, + featureShortcuts, false, fileDefinitions, featureDefinitions)) { - if(!CreateStartMenuShortcuts(component.Name, componentFeatureId, - featureShortcuts, fileDefinitions, featureDefinitions)) - { - return false; - } + return false; } } } - if(hasShortcuts) + bool emitUninstallShortcut = emittedShortcutTypes.find( + cmWIXShortcuts::START_MENU) != emittedShortcutTypes.end(); + + if(!CreateShortcuts(std::string(), "ProductFeature", + globalShortcuts, emitUninstallShortcut, + fileDefinitions, featureDefinitions)) { - if(!CreateStartMenuShortcuts(std::string(), "ProductFeature", - globalShortcuts, fileDefinitions, featureDefinitions)) - { - return false; - } + return false; } featureDefinitions.EndElement("Fragment"); @@ -551,13 +544,15 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() directoryDefinitions.EndInstallationPrefixDirectory( installRootSize); - if(hasShortcuts) + if(emittedShortcutTypes.find(cmWIXShortcuts::START_MENU) != + emittedShortcutTypes.end()) { directoryDefinitions.EmitStartMenuFolder( GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER")); } - if(this->HasDesktopShortcuts) + if(emittedShortcutTypes.find(cmWIXShortcuts::DESKTOP) != + emittedShortcutTypes.end()) { directoryDefinitions.EmitDesktopFolder(); } @@ -649,7 +644,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature( cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions, - shortcut_map_t& shortcutMap) + cmWIXShortcuts& shortcuts) { featureDefinitions.BeginElement("FeatureRef"); featureDefinitions.AddAttribute("Id", featureId); @@ -682,21 +677,68 @@ bool cmCPackWIXGenerator::AddComponentsToFeature( rootPath, "INSTALL_ROOT", directoryDefinitions, fileDefinitions, featureDefinitions, cpackPackageExecutablesList, cpackPackageDesktopLinksList, - shortcutMap); + shortcuts); featureDefinitions.EndElement("FeatureRef"); return true; } -bool cmCPackWIXGenerator::CreateStartMenuShortcuts( +bool cmCPackWIXGenerator::CreateShortcuts( std::string const& cpackComponentName, std::string const& featureId, - shortcut_map_t& shortcutMap, + cmWIXShortcuts const& shortcuts, + bool emitUninstallShortcut, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions) { - bool thisHasDesktopShortcuts = false; + if(!shortcuts.empty(cmWIXShortcuts::START_MENU)) + { + if(!this->CreateShortcutsOfSpecificType(cmWIXShortcuts::START_MENU, + cpackComponentName, featureId, "", + shortcuts, emitUninstallShortcut, + fileDefinitions, featureDefinitions)) + { + return false; + } + } + + if(!shortcuts.empty(cmWIXShortcuts::DESKTOP)) + { + if(!this->CreateShortcutsOfSpecificType(cmWIXShortcuts::DESKTOP, + cpackComponentName, featureId, "DESKTOP", + shortcuts, false, + fileDefinitions, featureDefinitions)) + { + return false; + } + } + + return true; +} + +bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( + cmWIXShortcuts::Type type, + std::string const& cpackComponentName, + std::string const& featureId, + std::string const& idPrefix, + cmWIXShortcuts const& shortcuts, + bool emitUninstallShortcut, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions) +{ + std::string directoryId; + switch(type) + { + case cmWIXShortcuts::START_MENU: + directoryId = "PROGRAM_MENU_FOLDER"; + break; + case cmWIXShortcuts::DESKTOP: + directoryId = "DesktopFolder"; + break; + default: + return false; + } featureDefinitions.BeginElement("FeatureRef"); featureDefinitions.AddAttribute("Id", featureId); @@ -720,80 +762,42 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( idSuffix += cpackComponentName; } - std::string componentId = "CM_SHORTCUT" + idSuffix; + std::string componentId = "CM_SHORTCUT"; + if(idPrefix.size()) + { + componentId += "_" + idPrefix; + } + + componentId += idSuffix; fileDefinitions.BeginElement("DirectoryRef"); - fileDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER"); + fileDefinitions.AddAttribute("Id", directoryId); fileDefinitions.BeginElement("Component"); fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Guid", "*"); - for(shortcut_map_t::const_iterator - i = shortcutMap.begin(); i != shortcutMap.end(); ++i) + std::string registryKey = std::string("Software\\") + + cpackVendor + "\\" + cpackPackageName; + + shortcuts.EmitShortcuts(type, registryKey, + cpackComponentName, fileDefinitions); + + if(type == cmWIXShortcuts::START_MENU) { - std::string const& id = i->first; - cmWIXShortcut const& shortcut = i->second; - - fileDefinitions.EmitShortcut(id, shortcut, false); - - if(shortcut.desktop) - { - thisHasDesktopShortcuts = true; - } + fileDefinitions.EmitRemoveFolder( + "CM_REMOVE_PROGRAM_MENU_FOLDER" + idSuffix); } - if(cpackComponentName.empty()) + if(emitUninstallShortcut) { fileDefinitions.EmitUninstallShortcut(cpackPackageName); } - fileDefinitions.EmitRemoveFolder( - "CM_REMOVE_PROGRAM_MENU_FOLDER" + idSuffix); - - std::string registryKey = - std::string("Software\\") + cpackVendor + "\\" + cpackPackageName; - - fileDefinitions.EmitStartMenuShortcutRegistryValue( - registryKey, cpackComponentName); - fileDefinitions.EndElement("Component"); fileDefinitions.EndElement("DirectoryRef"); featureDefinitions.EmitComponentRef(componentId); - - if(thisHasDesktopShortcuts) - { - this->HasDesktopShortcuts = true; - componentId = "CM_DESKTOP_SHORTCUT" + idSuffix; - - fileDefinitions.BeginElement("DirectoryRef"); - fileDefinitions.AddAttribute("Id", "DesktopFolder"); - fileDefinitions.BeginElement("Component"); - fileDefinitions.AddAttribute("Id", componentId); - fileDefinitions.AddAttribute("Guid", "*"); - - for(shortcut_map_t::const_iterator - i = shortcutMap.begin(); i != shortcutMap.end(); ++i) - { - std::string const& id = i->first; - cmWIXShortcut const& shortcut = i->second; - - if (!shortcut.desktop) - continue; - - fileDefinitions.EmitShortcut(id, shortcut, true); - } - - fileDefinitions.EmitDesktopShortcutRegistryValue( - registryKey, cpackComponentName); - - fileDefinitions.EndElement("Component"); - fileDefinitions.EndElement("DirectoryRef"); - - featureDefinitions.EmitComponentRef(componentId); - } - featureDefinitions.EndElement("FeatureRef"); return true; @@ -854,7 +858,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( cmWIXFeaturesSourceWriter& featureDefinitions, const std::vector& packageExecutables, const std::vector& desktopExecutables, - shortcut_map_t& shortcutMap) + cmWIXShortcuts& shortcuts) { cmsys::Directory dir; dir.Load(topdir.c_str()); @@ -929,7 +933,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( featureDefinitions, packageExecutables, desktopExecutables, - shortcutMap); + shortcuts); this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions); directoryDefinitions.EndElement("Directory"); @@ -952,9 +956,10 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( if(cmSystemTools::LowerCase(fileName) == cmSystemTools::LowerCase(executableName) + ".exe") { - cmWIXShortcut &shortcut = shortcutMap[id]; - shortcut.textLabel= textLabel; + cmWIXShortcut shortcut; + shortcut.label= textLabel; shortcut.workingDirectoryId = directoryId; + shortcuts.insert(cmWIXShortcuts::START_MENU, id, shortcut); if(desktopExecutables.size() && std::find(desktopExecutables.begin(), @@ -962,7 +967,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( executableName) != desktopExecutables.end()) { - shortcut.desktop = true; + shortcuts.insert(cmWIXShortcuts::DESKTOP, id, shortcut); } } } diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 703529703..d75c69d8d 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -65,7 +65,6 @@ protected: private: typedef std::map id_map_t; typedef std::map ambiguity_map_t; - typedef std::map shortcut_map_t; typedef std::set extension_set_t; bool InitializeWiXConfiguration(); @@ -99,12 +98,23 @@ private: cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions, - shortcut_map_t& shortcutMap); + cmWIXShortcuts& shortcuts); - bool CreateStartMenuShortcuts( + bool CreateShortcuts( std::string const& cpackComponentName, std::string const& featureId, - shortcut_map_t& shortcutMap, + cmWIXShortcuts const& shortcuts, + bool emitUninstallShortcut, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions); + + bool CreateShortcutsOfSpecificType( + cmWIXShortcuts::Type type, + std::string const& cpackComponentName, + std::string const& featureId, + std::string const& idPrefix, + cmWIXShortcuts const& shortcuts, + bool emitUninstallShortcut, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions); @@ -126,9 +136,9 @@ private: cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions, - const std::vector& pkgExecutables, - const std::vector& desktopExecutables, - shortcut_map_t& shortcutMap); + std::vector const& pkgExecutables, + std::vector const& desktopExecutables, + cmWIXShortcuts& shortcuts); bool RequireOption(std::string const& name, std::string& value) const; @@ -165,8 +175,6 @@ private: extension_set_t CandleExtensions; extension_set_t LightExtensions; - bool HasDesktopShortcuts; - std::string CPackTopLevel; cmWIXPatch* Patch; diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 1adb06ade..ca3769974 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2014 Kitware, Inc. + Copyright 2014-2015 Kitware, Inc. Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -28,18 +28,9 @@ cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, void cmWIXFilesSourceWriter::EmitShortcut( std::string const& id, cmWIXShortcut const& shortcut, - bool desktop) + std::string const& shortcutPrefix) { - std::string shortcutId; - - if(desktop) - { - shortcutId = "CM_DS"; - } - else - { - shortcutId = "CM_S"; - } + std::string shortcutId = shortcutPrefix; shortcutId += id; @@ -47,7 +38,7 @@ void cmWIXFilesSourceWriter::EmitShortcut( BeginElement("Shortcut"); AddAttribute("Id", shortcutId); - AddAttribute("Name", shortcut.textLabel); + AddAttribute("Name", shortcut.label); std::string target = "[#" + fileId + "]"; AddAttribute("Target", target); AddAttribute("WorkingDirectory", shortcut.workingDirectoryId); @@ -62,20 +53,6 @@ void cmWIXFilesSourceWriter::EmitRemoveFolder(std::string const& id) EndElement("RemoveFolder"); } -void cmWIXFilesSourceWriter::EmitStartMenuShortcutRegistryValue( - std::string const& registryKey, - std::string const& cpackComponentName) -{ - EmitInstallRegistryValue(registryKey, cpackComponentName, std::string()); -} - -void cmWIXFilesSourceWriter::EmitDesktopShortcutRegistryValue( - std::string const& registryKey, - std::string const& cpackComponentName) -{ - EmitInstallRegistryValue(registryKey, cpackComponentName, "_desktop"); -} - void cmWIXFilesSourceWriter::EmitInstallRegistryValue( std::string const& registryKey, std::string const& cpackComponentName, diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index b0a4af8f8..67808fb0c 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2014 Kitware, Inc. + Copyright 2014-2015 Kitware, Inc. Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -31,17 +31,14 @@ public: void EmitShortcut( std::string const& id, cmWIXShortcut const& shortcut, - bool desktop); + std::string const& shortcutPrefix); void EmitRemoveFolder(std::string const& id); - void EmitStartMenuShortcutRegistryValue( + void EmitInstallRegistryValue( std::string const& registryKey, - std::string const& cpackComponentName); - - void EmitDesktopShortcutRegistryValue( - std::string const& registryKey, - std::string const& cpackComponentName); + std::string const& cpackComponentName, + std::string const& suffix); void EmitUninstallShortcut(std::string const& packageName); @@ -56,12 +53,6 @@ public: std::string const& filePath, cmWIXPatch &patch, cmInstalledFile const* installedFile); - -private: - void EmitInstallRegistryValue( - std::string const& registryKey, - std::string const& cpackComponentName, - std::string const& suffix); }; diff --git a/Source/CPack/WiX/cmWIXShortcut.cxx b/Source/CPack/WiX/cmWIXShortcut.cxx new file mode 100644 index 000000000..1c755ece0 --- /dev/null +++ b/Source/CPack/WiX/cmWIXShortcut.cxx @@ -0,0 +1,86 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 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. +============================================================================*/ + +#include "cmWIXShortcut.h" + +#include "cmWIXFilesSourceWriter.h" + +void cmWIXShortcuts::insert( + Type type, std::string const& id, cmWIXShortcut const& shortcut) +{ + this->Shortcuts[type][id].push_back(shortcut); +} + +bool cmWIXShortcuts::empty(Type type) const +{ + return this->Shortcuts.find(type) == this->Shortcuts.end(); +} + +bool cmWIXShortcuts::EmitShortcuts( + Type type, + std::string const& registryKey, + std::string const& cpackComponentName, + cmWIXFilesSourceWriter& fileDefinitions) const +{ + shortcut_type_map_t::const_iterator i = this->Shortcuts.find(type); + + if(i == this->Shortcuts.end()) + { + return false; + } + + shortcut_id_map_t const& id_map = i->second; + + std::string shortcutPrefix; + std::string registrySuffix; + + switch(type) + { + case START_MENU: + shortcutPrefix = "CM_S"; + break; + case DESKTOP: + shortcutPrefix = "CM_DS"; + registrySuffix = "_desktop"; + break; + default: + return false; + } + + for(shortcut_id_map_t::const_iterator j = id_map.begin(); + j != id_map.end(); ++j) + { + std::string const& id = j->first; + shortcut_list_t const& shortcutList = j->second; + + for(shortcut_list_t::const_iterator k = shortcutList.begin(); + k != shortcutList.end(); ++k) + { + cmWIXShortcut const& shortcut = *k; + fileDefinitions.EmitShortcut(id, shortcut, shortcutPrefix); + } + } + + fileDefinitions.EmitInstallRegistryValue( + registryKey, cpackComponentName, registrySuffix); + + return true; +} + +void cmWIXShortcuts::AddShortcutTypes(std::set& types) +{ + for(shortcut_type_map_t::const_iterator i = this->Shortcuts.begin(); + i != this->Shortcuts.end(); ++i) + { + types.insert(i->first); + } +} diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h index 93095e03f..a18cbb34c 100644 --- a/Source/CPack/WiX/cmWIXShortcut.h +++ b/Source/CPack/WiX/cmWIXShortcut.h @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2014 Kitware, Inc. + Copyright 2014-2015 Kitware, Inc. Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -10,20 +10,51 @@ See the License for more information. ============================================================================*/ -#ifndef cmWIXFilesShortcut_h -#define cmWIXFilesShortcut_h +#ifndef cmWIXShortcut_h +#define cmWIXShortcut_h #include +#include +#include +#include + +class cmWIXFilesSourceWriter; struct cmWIXShortcut { - cmWIXShortcut() - :desktop(false) - {} - - std::string textLabel; + std::string label; std::string workingDirectoryId; - bool desktop; +}; + +class cmWIXShortcuts +{ +public: + enum Type + { + START_MENU, + DESKTOP + }; + + typedef std::vector shortcut_list_t; + typedef std::map shortcut_id_map_t; + + void insert(Type type, std::string const& id, cmWIXShortcut const& shortcut); + + bool empty(Type type) const; + + bool EmitShortcuts( + Type type, + std::string const& registryKey, + std::string const& cpackComponentName, + cmWIXFilesSourceWriter& fileDefinitions) const; + + void AddShortcutTypes(std::set& types); + +private: + typedef std::map shortcut_type_map_t; + + shortcut_type_map_t Shortcuts; + shortcut_id_map_t EmptyIdMap; }; #endif From 279605f560312aab4dfeef4cce1c8c67d4083b4e Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 21 Feb 2015 17:30:31 +0100 Subject: [PATCH 0184/1029] CPackWIX: Add installed file properties for the creation of shortcuts. --- Help/manual/cmake-properties.7.rst | 2 + Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst | 7 ++++ Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst | 7 ++++ Source/CPack/WiX/cmCPackWIXGenerator.cxx | 9 ++++- Source/CPack/WiX/cmCPackWIXGenerator.h | 2 +- Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 13 ++++-- Source/CPack/WiX/cmWIXFilesSourceWriter.h | 3 +- Source/CPack/WiX/cmWIXShortcut.cxx | 40 +++++++++++++++++-- Source/CPack/WiX/cmWIXShortcut.h | 12 ++++++ 9 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst create mode 100644 Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 25f989f18..e3be39963 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -320,8 +320,10 @@ Properties on Installed Files .. toctree:: :maxdepth: 1 + /prop_inst/CPACK_DESKTOP_SHORTCUTS.rst /prop_inst/CPACK_NEVER_OVERWRITE.rst /prop_inst/CPACK_PERMANENT.rst + /prop_inst/CPACK_START_MENU_SHORTCUTS.rst /prop_inst/CPACK_WIX_ACL.rst diff --git a/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst b/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst new file mode 100644 index 000000000..11f2c036c --- /dev/null +++ b/Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst @@ -0,0 +1,7 @@ +CPACK_DESKTOP_SHORTCUTS +----------------------- + +Species a list of shortcut names that should be created on the Desktop +for this file. + +The property is currently only supported by the WIX generator. diff --git a/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst b/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst new file mode 100644 index 000000000..d30ea39fd --- /dev/null +++ b/Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst @@ -0,0 +1,7 @@ +CPACK_START_MENU_SHORTCUTS +-------------------------- + +Species a list of shortcut names that should be created in the Start Menu +for this file. + +The property is currently only supported by the WIX generator. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index f18eaeb47..c6daeda6c 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -856,8 +856,8 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions, - const std::vector& packageExecutables, - const std::vector& desktopExecutables, + std::vector const& packageExecutables, + std::vector const& desktopExecutables, cmWIXShortcuts& shortcuts) { cmsys::Directory dir; @@ -943,6 +943,11 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( cmInstalledFile const* installedFile = this->GetInstalledFile(relativePath); + if(installedFile) + { + shortcuts.CreateFromProperties(id, directoryId, *installedFile); + } + std::string componentId = fileDefinitions.EmitComponentFile( directoryId, id, fullPath, *(this->Patch), installedFile); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index d75c69d8d..d50160953 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -136,7 +136,7 @@ private: cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions, - std::vector const& pkgExecutables, + std::vector const& packageExecutables, std::vector const& desktopExecutables, cmWIXShortcuts& shortcuts); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index ca3769974..d4698a764 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -28,16 +28,21 @@ cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, void cmWIXFilesSourceWriter::EmitShortcut( std::string const& id, cmWIXShortcut const& shortcut, - std::string const& shortcutPrefix) + std::string const& shortcutPrefix, + size_t shortcutIndex) { - std::string shortcutId = shortcutPrefix; + std::stringstream shortcutId; + shortcutId << shortcutPrefix << id; - shortcutId += id; + if(shortcutIndex > 0) + { + shortcutId << "_" << shortcutIndex; + } std::string fileId = std::string("CM_F") + id; BeginElement("Shortcut"); - AddAttribute("Id", shortcutId); + AddAttribute("Id", shortcutId.str()); AddAttribute("Name", shortcut.label); std::string target = "[#" + fileId + "]"; AddAttribute("Target", target); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index 67808fb0c..c48bc15ba 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -31,7 +31,8 @@ public: void EmitShortcut( std::string const& id, cmWIXShortcut const& shortcut, - std::string const& shortcutPrefix); + std::string const& shortcutPrefix, + size_t shortcutIndex); void EmitRemoveFolder(std::string const& id); diff --git a/Source/CPack/WiX/cmWIXShortcut.cxx b/Source/CPack/WiX/cmWIXShortcut.cxx index 1c755ece0..aef2b0826 100644 --- a/Source/CPack/WiX/cmWIXShortcut.cxx +++ b/Source/CPack/WiX/cmWIXShortcut.cxx @@ -62,11 +62,12 @@ bool cmWIXShortcuts::EmitShortcuts( std::string const& id = j->first; shortcut_list_t const& shortcutList = j->second; - for(shortcut_list_t::const_iterator k = shortcutList.begin(); - k != shortcutList.end(); ++k) + for(size_t shortcutListIndex = 0; + shortcutListIndex < shortcutList.size(); ++shortcutListIndex) { - cmWIXShortcut const& shortcut = *k; - fileDefinitions.EmitShortcut(id, shortcut, shortcutPrefix); + cmWIXShortcut const& shortcut = shortcutList[shortcutListIndex]; + fileDefinitions.EmitShortcut(id, shortcut, + shortcutPrefix, shortcutListIndex); } } @@ -84,3 +85,34 @@ void cmWIXShortcuts::AddShortcutTypes(std::set& types) types.insert(i->first); } } + +void cmWIXShortcuts::CreateFromProperties( + std::string const& id, + std::string const& directoryId, + cmInstalledFile const& installedFile) +{ + CreateFromProperty("CPACK_START_MENU_SHORTCUTS", + START_MENU, id, directoryId, installedFile); + + CreateFromProperty("CPACK_DESKTOP_SHORTCUTS", + DESKTOP, id, directoryId, installedFile); +} + +void cmWIXShortcuts::CreateFromProperty( + std::string const& propertyName, + Type type, + std::string const& id, + std::string const& directoryId, + cmInstalledFile const& installedFile) +{ + std::vector list; + installedFile.GetPropertyAsList(propertyName, list); + + for(size_t i = 0; i < list.size(); ++i) + { + cmWIXShortcut shortcut; + shortcut.label = list[i]; + shortcut.workingDirectoryId = directoryId; + insert(type, id, shortcut); + } +} diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h index a18cbb34c..5e18bdd3a 100644 --- a/Source/CPack/WiX/cmWIXShortcut.h +++ b/Source/CPack/WiX/cmWIXShortcut.h @@ -18,6 +18,8 @@ #include #include +#include + class cmWIXFilesSourceWriter; struct cmWIXShortcut @@ -50,9 +52,19 @@ public: void AddShortcutTypes(std::set& types); + void CreateFromProperties(std::string const& id, + std::string const& directoryId, cmInstalledFile const& installedFile); + private: typedef std::map shortcut_type_map_t; + void CreateFromProperty( + std::string const& propertyName, + Type type, + std::string const& id, + std::string const& directoryId, + cmInstalledFile const& installedFile); + shortcut_type_map_t Shortcuts; shortcut_id_map_t EmptyIdMap; }; From e6731f486e466ddd58550851fb935dbda7939cac Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 21 Feb 2015 18:07:36 +0100 Subject: [PATCH 0185/1029] CPackWIX: Add new CPACK_STARTUP_SHORTCUTS property. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst | 7 +++++++ Source/CPack/WiX/cmCPackWIXGenerator.cxx | 20 +++++++++++++++++++ .../WiX/cmWIXDirectoriesSourceWriter.cxx | 8 ++++++++ .../CPack/WiX/cmWIXDirectoriesSourceWriter.h | 2 ++ Source/CPack/WiX/cmWIXShortcut.cxx | 7 +++++++ Source/CPack/WiX/cmWIXShortcut.h | 3 ++- 7 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index e3be39963..19fdf23f3 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -324,6 +324,7 @@ Properties on Installed Files /prop_inst/CPACK_NEVER_OVERWRITE.rst /prop_inst/CPACK_PERMANENT.rst /prop_inst/CPACK_START_MENU_SHORTCUTS.rst + /prop_inst/CPACK_STARTUP_SHORTCUTS.rst /prop_inst/CPACK_WIX_ACL.rst diff --git a/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst new file mode 100644 index 000000000..8a160223d --- /dev/null +++ b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst @@ -0,0 +1,7 @@ +CPACK_STARTUP_SHORTCUTS +----------------------- + +Species a list of shortcut names that should be created in the Startup folder +for this file. + +The property is currently only supported by the WIX generator. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index c6daeda6c..4b8daf827 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -557,6 +557,12 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() directoryDefinitions.EmitDesktopFolder(); } + if(emittedShortcutTypes.find(cmWIXShortcuts::STARTUP) != + emittedShortcutTypes.end()) + { + directoryDefinitions.EmitStartupFolder(); + } + directoryDefinitions.EndElement("Directory"); directoryDefinitions.EndElement("Fragment"); @@ -714,6 +720,17 @@ bool cmCPackWIXGenerator::CreateShortcuts( } } + if(!shortcuts.empty(cmWIXShortcuts::STARTUP)) + { + if(!this->CreateShortcutsOfSpecificType(cmWIXShortcuts::STARTUP, + cpackComponentName, featureId, "STARTUP", + shortcuts, false, + fileDefinitions, featureDefinitions)) + { + return false; + } + } + return true; } @@ -736,6 +753,9 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( case cmWIXShortcuts::DESKTOP: directoryId = "DesktopFolder"; break; + case cmWIXShortcuts::STARTUP: + directoryId = "StartupFolder"; + break; default: return false; } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index a93f89bae..7bd4315e5 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -41,6 +41,14 @@ void cmWIXDirectoriesSourceWriter::EmitDesktopFolder() EndElement("Directory"); } +void cmWIXDirectoriesSourceWriter::EmitStartupFolder() +{ + BeginElement("Directory"); + AddAttribute("Id", "StartupFolder"); + AddAttribute("Name", "Startup"); + EndElement("Directory"); +} + size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory( std::string const& programFilesFolderId, std::string const& installRootString) diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index f51fdb4bb..f8c816640 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -32,6 +32,8 @@ public: void EmitDesktopFolder(); + void EmitStartupFolder(); + size_t BeginInstallationPrefixDirectory( std::string const& programFilesFolderId, std::string const& installRootString); diff --git a/Source/CPack/WiX/cmWIXShortcut.cxx b/Source/CPack/WiX/cmWIXShortcut.cxx index aef2b0826..d72187284 100644 --- a/Source/CPack/WiX/cmWIXShortcut.cxx +++ b/Source/CPack/WiX/cmWIXShortcut.cxx @@ -52,6 +52,10 @@ bool cmWIXShortcuts::EmitShortcuts( shortcutPrefix = "CM_DS"; registrySuffix = "_desktop"; break; + case STARTUP: + shortcutPrefix = "CM_SS"; + registrySuffix = "_startup"; + break; default: return false; } @@ -96,6 +100,9 @@ void cmWIXShortcuts::CreateFromProperties( CreateFromProperty("CPACK_DESKTOP_SHORTCUTS", DESKTOP, id, directoryId, installedFile); + + CreateFromProperty("CPACK_STARTUP_SHORTCUTS", + STARTUP, id, directoryId, installedFile); } void cmWIXShortcuts::CreateFromProperty( diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h index 5e18bdd3a..5945e4367 100644 --- a/Source/CPack/WiX/cmWIXShortcut.h +++ b/Source/CPack/WiX/cmWIXShortcut.h @@ -34,7 +34,8 @@ public: enum Type { START_MENU, - DESKTOP + DESKTOP, + STARTUP }; typedef std::vector shortcut_list_t; From 5cf629c3bc0c7a15d363d6d60e8c3cc04c0618f2 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 22 Feb 2015 00:01:09 -0500 Subject: [PATCH 0186/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5311b3680..94c9d5d22 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150221) +set(CMake_VERSION_PATCH 20150222) #set(CMake_VERSION_RC 1) From 51f8de810223139ea0dcb7bafcabe12fc8e075c1 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 22 Feb 2015 13:48:30 +0100 Subject: [PATCH 0187/1029] if(): avoid one needless string compare for all if() statements If it's known that it is an "if" it can't be an "elseif". --- Source/cmIfCommand.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 3362abbb0..6dea5c17c 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -45,7 +45,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, { this->ScopeDepth++; } - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif")) + else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif")) { this->ScopeDepth--; // if this is the endif for this if statement, then start executing From 135febf069e7ff5305a3729b81171933ec89dc90 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sun, 22 Feb 2015 15:20:33 +0100 Subject: [PATCH 0188/1029] CPackWIX: Enhance CMake CPack WIX generated installer. --- CMakeCPackOptions.cmake.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 57ed4cafd..cc8f5e986 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -87,4 +87,26 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") if(patch MATCHES "^[0-9]+$" AND patch LESS 65535) set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${patch}") endif() + + set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "http://www.cmake.org") + + set(CPACK_WIX_PROPERTY_ARPCONTACT "@CPACK_PACKAGE_CONTACT@") + + set(CPACK_WIX_PROPERTY_ARPCOMMENTS + "CMake is a cross-platform, open-source build system." + ) + + set(CPACK_WIX_PRODUCT_ICON + "@CMake_SOURCE_DIR@/Utilities/Release/CMakeLogo.ico" + ) + + set_property(INSTALL "@CMAKE_DOC_DIR@/html/index.html" PROPERTY + CPACK_START_MENU_SHORTCUTS "CMake Documentation" + ) + + set_property(INSTALL "cmake.org.html" PROPERTY + CPACK_START_MENU_SHORTCUTS "CMake Web Site" + ) + + set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") endif() From 6adff767208c2238efb2649395a76bc2ea78fb08 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 23 Feb 2015 00:01:08 -0500 Subject: [PATCH 0189/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 94c9d5d22..bee52913c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150222) +set(CMake_VERSION_PATCH 20150223) #set(CMake_VERSION_RC 1) From b04c8ec3f840a5cb34a97b2fe8417882b49b3820 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Feb 2015 08:54:45 -0500 Subject: [PATCH 0190/1029] Tests: Match curl error in RunCMake.ctest_submit FailDrop-* cases Port the regexes over from the CTestTestFailedSubmit tests for ftp, http, and https. No such match is needed for the other protocols. --- Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt | 2 +- Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt | 2 +- Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt index 73df5c1b2..4345918bf 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt @@ -1,3 +1,3 @@ -Error message was: .* +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) Problems when submitting via FTP Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-ftp/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt index c1a91265c..9895181a6 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt @@ -1,3 +1,3 @@ -Error message was: .* +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) Problems when submitting via HTTP Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-http/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt index 11db01a93..a9c5d58d7 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt @@ -1,3 +1,3 @@ -Error message was: .* +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*|Protocol "https" not supported or disabled in .*|.* was built with SSL disabled.*) Problems when submitting via HTTP Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-https/test.cmake From 57f2aa7c37e3e4d09a43c6790772d11d5b63e9a6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Feb 2015 09:02:21 -0500 Subject: [PATCH 0191/1029] Tests: Teach RunCMake to tolerate BullseyeCoverage lines in test output When RunCMake tests run under dynamic analysis, Bullseye may add lines of the form "BullseyeCoverage..." to the output. Remove such lines from the actual output before matching it against the expected output. --- Tests/RunCMake/RunCMake.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 6389ef4fb..ffa1e2b0d 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -83,7 +83,7 @@ function(run_cmake test) endif() foreach(o out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "(^|\n)(==[0-9]+==[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") + string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) From 69de0f7ea4163f350dd6683b6d7f47377157ae7d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Feb 2015 09:05:22 -0500 Subject: [PATCH 0192/1029] Tests: Teach RunCMake to tolerate Guard Malloc lines in test output When RunCMake tests run under Xcode Guard Malloc, Guard Malloc may add lines of the form "() malloc:..." to the output. Remove such lines from the actual output before matching it against the expected output. --- Tests/RunCMake/RunCMake.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ffa1e2b0d..3ad1babc2 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -83,7 +83,7 @@ function(run_cmake test) endif() foreach(o out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") + string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) From 12db113944860269b72093424b17ad2f86bccf2f Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Mon, 16 Feb 2015 15:24:55 -0500 Subject: [PATCH 0193/1029] CTest: Add cmCTestOptionalLog macro cmCTestOptionalLog takes a boolean argument that indicates whether or not the message should be suppressed. Note that error messages will still be printed, even if suppression is requested. This macro will allow us to provide more fine-grained control over what messages CTest prints to the console. --- Source/cmCTest.cxx | 24 +++++++++++++++--------- Source/cmCTest.h | 16 +++++++++++++--- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index f08b87c9c..997580287 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2741,10 +2741,11 @@ void cmCTest::DetermineNextDayStop() } //---------------------------------------------------------------------- -void cmCTest::SetCTestConfiguration(const char *name, const char* value) +void cmCTest::SetCTestConfiguration(const char *name, const char* value, + bool suppress) { - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:" - << name << ":" << (value ? value : "(null)") << "\n"); + cmCTestOptionalLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:" + << name << ":" << (value ? value : "(null)") << "\n", suppress); if ( !name ) { @@ -2858,7 +2859,7 @@ void cmCTest::SetConfigType(const char* ct) //---------------------------------------------------------------------- bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const std::string& cmake_var) + const char* dconfig, const std::string& cmake_var, bool suppress) { const char* ctvar; ctvar = mf->GetDefinition(cmake_var); @@ -2866,10 +2867,10 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, { return false; } - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, - "SetCTestConfigurationFromCMakeVariable:" - << dconfig << ":" << cmake_var << std::endl); - this->SetCTestConfiguration(dconfig, ctvar); + cmCTestOptionalLog(this, HANDLER_VERBOSE_OUTPUT, + "SetCTestConfigurationFromCMakeVariable:" << dconfig << ":" << + cmake_var << std::endl, suppress); + this->SetCTestConfiguration(dconfig, ctvar, suppress); return true; } @@ -3034,12 +3035,17 @@ void cmCTest::InitStreams() this->StreamErr = &std::cerr; } -void cmCTest::Log(int logType, const char* file, int line, const char* msg) +void cmCTest::Log(int logType, const char* file, int line, const char* msg, + bool suppress) { if ( !msg || !*msg ) { return; } + if ( suppress && logType != cmCTest::ERROR_MESSAGE ) + { + return; + } if ( this->OutputLogFile ) { bool display = true; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index deb889698..88191c4f3 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -33,6 +33,14 @@ class cmCTestStartCommand; cmCTestLog_msg.str().c_str());\ } while ( 0 ) +#define cmCTestOptionalLog(ctSelf, logType, msg, suppress) \ + do { \ + std::ostringstream cmCTestLog_msg; \ + cmCTestLog_msg << msg; \ + (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__,\ + cmCTestLog_msg.str().c_str(), suppress);\ + } while ( 0 ) + #ifdef cerr # undef cerr #endif @@ -173,7 +181,8 @@ public: static int GetTestModelFromString(const char* str); static std::string CleanString(const std::string& str); std::string GetCTestConfiguration(const std::string& name); - void SetCTestConfiguration(const char *name, const char* value); + void SetCTestConfiguration(const char *name, const char* value, + bool suppress=false); void EmptyCTestConfiguration(); /** @@ -332,7 +341,7 @@ public: * Set the CTest variable from CMake variable */ bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const std::string& cmake_var); + const char* dconfig, const std::string& cmake_var, bool suppress=false); //! Make string safe to be send as an URL static std::string MakeURLSafe(const std::string&); @@ -376,7 +385,8 @@ public: }; //! Add log to the output - void Log(int logType, const char* file, int line, const char* msg); + void Log(int logType, const char* file, int line, const char* msg, + bool suppress=false); //! Get the version of dart server int GetDartVersion() { return this->DartVersion; } From 7ce9f6e29ee143d2a63d55354c00d5ea50d6d0d1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Feb 2015 09:12:47 -0500 Subject: [PATCH 0194/1029] Tests: Teach RunCMake to tolerate 'Error kstat returned' lines in test output When RunCMake tests run on Solaris, the output may contain unexpected lines of the form "Error kstat returned...". These lines are printed by SystemInformationImplementation::RunProcess when called from SystemInformationImplementation::ParseValueFromKStat (see issue #12066). Until someone investigates why kstat returns values outside the range it documents, simply remove such lines from the actual output before matching it against the expected output. --- Tests/RunCMake/RunCMake.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 3ad1babc2..abac66e56 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -83,7 +83,7 @@ function(run_cmake test) endif() foreach(o out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") + string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) From 1643b905e02473536d60ef4102d3154a6c8816d1 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Mon, 16 Feb 2015 16:02:14 -0500 Subject: [PATCH 0195/1029] ctest_submit: Add QUIET option Specifying this option prevents CTest from printing any non-error messages to the console for this call to ctest_submit(). --- Help/command/ctest_submit.rst | 4 + Source/CTest/cmCTestGenericHandler.cxx | 1 + Source/CTest/cmCTestGenericHandler.h | 3 + Source/CTest/cmCTestHandlerCommand.cxx | 16 +- Source/CTest/cmCTestHandlerCommand.h | 1 + Source/CTest/cmCTestSubmitCommand.cxx | 26 +- Source/CTest/cmCTestSubmitHandler.cxx | 239 ++++++++++-------- .../ctest_submit/CDashSubmitQuiet-result.txt | 1 + .../ctest_submit/CDashSubmitQuiet-stderr.txt | 4 + .../ctest_submit/CDashSubmitQuiet-stdout.txt | 3 + .../RunCMake/ctest_submit/RunCMakeTest.cmake | 1 + 11 files changed, 173 insertions(+), 126 deletions(-) create mode 100644 Tests/RunCMake/ctest_submit/CDashSubmitQuiet-result.txt create mode 100644 Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt create mode 100644 Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stdout.txt diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst index 2b83ed967..6fa119193 100644 --- a/Help/command/ctest_submit.rst +++ b/Help/command/ctest_submit.rst @@ -9,6 +9,7 @@ Submit results to a dashboard server. [RETRY_COUNT count] [RETRY_DELAY delay] [RETURN_VALUE res] + [QUIET] ) By default all available parts are submitted if no PARTS or FILES are @@ -38,6 +39,9 @@ timed-out submission before attempting to re-submit. The RETRY_COUNT option specifies how many times to retry a timed-out submission. +The QUIET option suppresses all non-error messages that would have +otherwise been printed by this call to ctest_submit(). + Submit to CDash Upload API ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 13c8ca5f1..81eb0a808 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -22,6 +22,7 @@ cmCTestGenericHandler::cmCTestGenericHandler() this->CTest = 0; this->SubmitIndex = 0; this->AppendXML = false; + this->Quiet = false; } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 2788cba57..8567dd7cd 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -87,6 +87,8 @@ public: int GetSubmitIndex() { return this->SubmitIndex; } void SetAppendXML(bool b) { this->AppendXML = b; } + void SetQuiet(bool b) { this->Quiet = b; } + bool GetQuiet() { return this->Quiet; } protected: bool StartResultingXML(cmCTest::Part part, @@ -94,6 +96,7 @@ protected: bool StartLogFile(const char* name, cmGeneratedFileStream& xofs); bool AppendXML; + bool Quiet; cmSystemTools::OutputOption HandlerVerbose; cmCTest *CTest; t_StringToString Options; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index b886777a9..3003e8a1c 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -29,6 +29,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand() this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX"; this->Last = ct_LAST; this->AppendXML = false; + this->Quiet = false; } bool cmCTestHandlerCommand @@ -74,7 +75,7 @@ bool cmCTestHandlerCommand { this->CTest->SetCTestConfiguration("BuildDirectory", cmSystemTools::CollapseFullPath( - this->Values[ct_BUILD]).c_str()); + this->Values[ct_BUILD]).c_str(), this->Quiet); } else { @@ -84,7 +85,7 @@ bool cmCTestHandlerCommand { this-> CTest->SetCTestConfiguration("BuildDirectory", - cmSystemTools::CollapseFullPath(bdir).c_str()); + cmSystemTools::CollapseFullPath(bdir).c_str(), this->Quiet); } else { @@ -98,13 +99,14 @@ bool cmCTestHandlerCommand "Set source directory to: " << this->Values[ct_SOURCE] << std::endl); this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Values[ct_SOURCE]).c_str()); + this->Values[ct_SOURCE]).c_str(), this->Quiet); } else { this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str()); + this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str(), + this->Quiet); } cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); @@ -160,6 +162,12 @@ bool cmCTestHandlerCommand::CheckArgumentKeyword(std::string const& arg) this->AppendXML = true; return true; } + if(arg == "QUIET") + { + this->ArgumentDoing = ArgumentDoingNone; + this->Quiet = true; + return true; + } // Check for a keyword in our argument/value table. for(unsigned int k=0; k < this->Arguments.size(); ++k) diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 8ef2b8028..87b2cd871 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -62,6 +62,7 @@ protected: unsigned int ArgumentIndex; bool AppendXML; + bool Quiet; std::string ReturnVariable; std::vector Arguments; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index cc3514ff3..5a8090c7c 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -44,29 +44,33 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() // error: CDash requires CTEST_DROP_LOCATION definition // in CTestConfig.cmake } - this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName); - this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod); - this->CTest->SetCTestConfiguration("DropSite", ctestDropSite); - this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation); + this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName, + this->Quiet); + this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod, + this->Quiet); + this->CTest->SetCTestConfiguration("DropSite", ctestDropSite, this->Quiet); + this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation, + this->Quiet); this->CTest->SetCTestConfiguration("IsCDash", - ctestDropSiteCDash ? "TRUE" : "FALSE"); + ctestDropSiteCDash ? "TRUE" : "FALSE", this->Quiet); // Only propagate TriggerSite for non-CDash projects: // if ( !ctestDropSiteCDash ) { - this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); + this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite, + this->Quiet); } this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CurlOptions", "CTEST_CURL_OPTIONS"); + "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "DropSiteUser", "CTEST_DROP_SITE_USER"); + "DropSiteUser", "CTEST_DROP_SITE_USER", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "DropSitePassword", "CTEST_DROP_SITE_PASSWORD"); + "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "ScpCommand", "CTEST_SCP_COMMAND"); + "ScpCommand", "CTEST_SCP_COMMAND", this->Quiet); const char* notesFilesVariable = this->Makefile->GetDefinition("CTEST_NOTES_FILES"); @@ -145,6 +149,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() static_cast(handler)->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF"); + handler->SetQuiet(this->Quiet); + if (this->CDashUpload) { static_cast(handler)-> diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 5b52df74d..d585863d0 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -242,9 +242,9 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); *this->LogFile << "\tUpload file: " << local_file << " to " << upload_as << std::endl; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file << " to " - << upload_as << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Upload file: " << local_file << " to " << upload_as << std::endl, + this->Quiet); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); @@ -278,15 +278,15 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } if (!chunkDebug.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } fclose(ftpfile); @@ -318,8 +318,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, } // always cleanup ::curl_easy_cleanup(curl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Uploaded: " + local_file << std::endl, this->Quiet); } } ::curl_global_cleanup(); @@ -369,14 +369,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmCurlSetCAInfo(curl); if(verifyPeerOff) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Set CURLOPT_SSL_VERIFYPEER to off\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Set CURLOPT_SSL_VERIFYPEER to off\n", this->Quiet); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); } if(verifyHostOff) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Set CURLOPT_SSL_VERIFYHOST to off\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Set CURLOPT_SSL_VERIFYHOST to off\n", this->Quiet); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); } @@ -482,9 +482,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, unsigned long filelen = cmSystemTools::FileLength(local_file); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file << " to " - << upload_as << " Size: " << filelen << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Upload file: " << local_file << " to " + << upload_as << " Size: " << filelen << std::endl, this->Quiet); // specify target ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); @@ -529,16 +529,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); this->ParseResponse(chunk); } if (!chunkDebug.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } // If curl failed for any reason, or checksum fails, wait and retry @@ -557,8 +557,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, for(int i = 0; i < count; i++) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Submit failed, waiting " << delay << " seconds...\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submit failed, waiting " << delay << " seconds...\n", + this->Quiet); double stop = cmSystemTools::GetTime() + delay; while(cmSystemTools::GetTime() < stop) @@ -566,9 +567,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmSystemTools::Delay(100); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Retry submission: Attempt " << (i + 1) << " of " - << count << std::endl); + << count << std::endl, this->Quiet); ::fclose(ftpfile); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); @@ -582,9 +583,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); this->ParseResponse(chunk); } @@ -624,8 +625,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } // always cleanup ::curl_easy_cleanup(curl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Uploaded: " + local_file << std::endl, this->Quiet); } } ::curl_global_cleanup(); @@ -677,6 +678,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( { CURL *curl; char error_buffer[1024]; + /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); @@ -756,8 +758,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl << std::endl; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " - << turl << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Trigger url: " << turl << std::endl, this->Quiet); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); if ( curl_easy_perform(curl) ) @@ -786,25 +788,26 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } if (!chunkDebug.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) - << "]" << std::endl); + << "]" << std::endl, this->Quiet); } // always cleanup ::curl_easy_cleanup(curl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, + this->Quiet); } } ::curl_global_cleanup(); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..." - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..." + << std::endl, this->Quiet); return true; } @@ -821,6 +824,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( { return 0; } + std::vector argv; argv.push_back(scp_command.c_str()); // Scp command argv.push_back(scp_command.c_str()); // Dummy string for file @@ -845,9 +849,9 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( argv[1] = lfname.c_str(); std::string rfname = url + "/" + remoteprefix + *file; argv[2] = rfname.c_str(); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0] - << "\" \"" << argv[1] << "\" \"" - << argv[2] << "\"" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" + << argv[2] << "\"" << std::endl, this->Quiet); *this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" << argv[2] << "\"" << std::endl; @@ -858,8 +862,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( while(cmsysProcess_WaitForData(cp, &data, &length, 0)) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - cmCTestLogWrite(data, length)); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLogWrite(data, length), this->Quiet); } cmsysProcess_WaitForExit(cp, 0); @@ -871,8 +875,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( retVal = cmsysProcess_GetExitValue(cp); if ( retVal != 0 ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: " - << retVal << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "\tSCP returned: " << retVal << std::endl, this->Quiet); *this->LogFile << "\tSCP returned: " << retVal << std::endl; problems ++; } @@ -927,6 +931,7 @@ bool cmCTestSubmitHandler::SubmitUsingCP( << "\tdestination: " << destination << std::endl); return 0; } + cmCTest::SetOfStrings::const_iterator file; bool problems = false; for ( file = files.begin(); file != files.end(); ++file ) @@ -936,9 +941,9 @@ bool cmCTestSubmitHandler::SubmitUsingCP( lfname += "/" + *file; std::string rfname = destination + "/" + remoteprefix + *file; cmSystemTools::CopyFileAlways(lfname, rfname); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " << lfname << " to " - << rfname << std::endl); + << rfname << std::endl, this->Quiet); } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; cmSystemTools::Touch(tagDoneFile, true); @@ -971,8 +976,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix, xmlrpc_env_init(&env); /* Call the famous server at UserLand. */ - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " - << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " + << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl, + this->Quiet); cmCTest::SetOfStrings::const_iterator file; for ( file = files.begin(); file != files.end(); ++file ) { @@ -983,8 +989,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix, { local_file = localprefix + "/" + *file; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submit file: " - << local_file.c_str() << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submit file: " + << local_file.c_str() << std::endl, this->Quiet); struct stat st; if ( ::stat(local_file.c_str(), &st) ) { @@ -1068,12 +1074,14 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), + this->Quiet); if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", + this->Quiet); } url += "@"; } @@ -1147,8 +1155,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << "datafilesmd5[0]=" << md5sum << "&" << "type=" << curl.Escape(typeString); std::string fields = str.str(); - cmCTestLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:" - << url << "\nfile: " << file << "\n"); + cmCTestOptionalLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:" + << url << "\nfile: " << file << "\n", this->Quiet); std::string response; if(!curl.HttpRequest(url, fields, response)) { @@ -1156,8 +1164,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, "Error in HttpRequest\n" << response); return -1; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Request upload response: [" << response << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Request upload response: [" << response << "]\n", this->Quiet); Json::Value json; Json::Reader reader; if(!reader.parse(response, json)) @@ -1179,9 +1187,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, int datares = json["datafilesmd5"][0].asInt(); if(datares == 1) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "File already exists on CDash, skip upload " - << file << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "File already exists on CDash, skip upload " << file << "\n", + this->Quiet); return 0; } } @@ -1213,8 +1221,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << reader.getFormattedErrorMessages() << "\n"); return -1; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Upload file response: [" << response << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Upload file response: [" << response << "]\n", this->Quiet ); return 0; } @@ -1311,13 +1319,13 @@ int cmCTestSubmitHandler::ProcessHandler() if (!this->HTTPProxy.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " - << this->HTTPProxy << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " + << this->HTTPProxy << std::endl, this->Quiet); } if (!this->FTPProxy.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " - << this->FTPProxy << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " + << this->FTPProxy << std::endl, this->Quiet); } cmGeneratedFileStream ofs; this->StartLogFile("Submit", ofs); @@ -1349,16 +1357,16 @@ int cmCTestSubmitHandler::ProcessHandler() = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); std::string::size_type glen = gpath.size() + 1; gpath = gpath + "/CoverageLog*"; - cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Globbing for: " << gpath + << std::endl, this->Quiet); if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) { size_t cc; for ( cc = 0; cc < gfiles.size(); cc ++ ) { gfiles[cc] = gfiles[cc].substr(glen); - cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] + << std::endl, this->Quiet); this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str()); } } @@ -1398,14 +1406,14 @@ int cmCTestSubmitHandler::ProcessHandler() cnt ++; } } - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files (using " << this->CTest->GetCTestConfiguration("DropMethod") << ")" - << std::endl); + << std::endl, this->Quiet); const char* specificTrack = this->CTest->GetSpecificTrack(); if ( specificTrack ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Send to track: " - << specificTrack << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Send to track: " + << specificTrack << std::endl, this->Quiet); } this->SetLogFile(&ofs); @@ -1414,9 +1422,9 @@ int cmCTestSubmitHandler::ProcessHandler() if ( dropMethod == "" || dropMethod == "ftp" ) { ofs << "Using drop method: FTP" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using FTP submit method" - << std::endl - << " Drop site: ftp://"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using FTP submit method" << std::endl << " Drop site: ftp://", + this->Quiet); std::string url = "ftp://"; url += cmCTest::MakeURLSafe( this->CTest->GetCTestConfiguration("DropSiteUser")) + ":" + @@ -1427,18 +1435,20 @@ int cmCTestSubmitHandler::ProcessHandler() this->CTest->GetCTestConfiguration("DropLocation")); if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration( - "DropSiteUser").c_str()); + "DropSiteUser").c_str(), this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", + this->Quiet); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, "@"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "@", this->Quiet); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSite") - << this->CTest->GetCTestConfiguration("DropLocation") << std::endl); + << this->CTest->GetCTestConfiguration("DropLocation") << std::endl, + this->Quiet); if ( !this->SubmitUsingFTP(buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(), files, prefix, url) ) @@ -1451,11 +1461,12 @@ int cmCTestSubmitHandler::ProcessHandler() } if(!this->CDash) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP trigger method" << std::endl << " Trigger site: " << this->CTest->GetCTestConfiguration("TriggerSite") - << std::endl); + << std::endl, this->Quiet); if ( !this-> TriggerUsingHTTP(files, prefix, this->CTest->GetCTestConfiguration("TriggerSite"))) @@ -1465,8 +1476,8 @@ int cmCTestSubmitHandler::ProcessHandler() ofs << " Problems when triggering via HTTP" << std::endl; return -1; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submission successful" << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; } @@ -1476,27 +1487,30 @@ int cmCTestSubmitHandler::ProcessHandler() std::string url = dropMethod; url += "://"; ofs << "Using drop method: " << dropMethod << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method" - << std::endl - << " Drop site:" << url); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP submit method" << std::endl << " Drop site:" << url, + this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), + this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", + this->Quiet); } url += "@"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "@"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "@", this->Quiet); } url += this->CTest->GetCTestConfiguration("DropSite") + this->CTest->GetCTestConfiguration("DropLocation"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSite") - << this->CTest->GetCTestConfiguration("DropLocation") << std::endl); + << this->CTest->GetCTestConfiguration("DropLocation") << std::endl, + this->Quiet); if ( !this->SubmitUsingHTTP(buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(), files, prefix, url) ) { @@ -1507,11 +1521,10 @@ int cmCTestSubmitHandler::ProcessHandler() } if(!this->CDash) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" - << std::endl - << " Trigger site: " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP trigger method" << std::endl << " Trigger site: " << this->CTest->GetCTestConfiguration("TriggerSite") - << std::endl); + << std::endl, this->Quiet); if ( !this-> TriggerUsingHTTP(files, prefix, this->CTest->GetCTestConfiguration("TriggerSite"))) @@ -1530,8 +1543,10 @@ int cmCTestSubmitHandler::ProcessHandler() } else { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << - (this->HasWarnings ? ", with warnings." : "") << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submission successful" << + (this->HasWarnings ? ", with warnings." : "") << std::endl, + this->Quiet); ofs << " Submission successful" << (this->HasWarnings ? ", with warnings." : "") << std::endl; } @@ -1542,8 +1557,8 @@ int cmCTestSubmitHandler::ProcessHandler() { #if defined(CTEST_USE_XMLRPC) ofs << "Using drop method: XML-RPC" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using XML-RPC submit method" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using XML-RPC submit method" << std::endl, this->Quiet); std::string url = this->CTest->GetCTestConfiguration("DropSite"); prefix = this->CTest->GetCTestConfiguration("DropLocation"); if ( !this->SubmitUsingXMLRPC(buildDirectory + "/Testing/" + @@ -1554,8 +1569,8 @@ int cmCTestSubmitHandler::ProcessHandler() ofs << " Problems when submitting via XML-RPC" << std::endl; return -1; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" + << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; #else @@ -1593,8 +1608,8 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } cmSystemTools::ChangeDirectory(oldWorkingDirectory); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" + << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; } @@ -1609,8 +1624,8 @@ int cmCTestSubmitHandler::ProcessHandler() std::string oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(buildDirectory); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " - << buildDirectory << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Change directory: " << buildDirectory << std::endl, this->Quiet); if ( !this->SubmitUsingCP( "Testing/"+this->CTest->GetCurrentTag(), @@ -1626,8 +1641,8 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } cmSystemTools::ChangeDirectory(oldWorkingDirectory); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" + << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; } diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-result.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-result.txt new file mode 100644 index 000000000..b57e2deb7 --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt new file mode 100644 index 000000000..ec0a8693f --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt @@ -0,0 +1,4 @@ + *Error when uploading file: .*/Configure.xml + *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) + *Problems when submitting via HTTP + *Error in read script: .*/Tests/RunCMake/ctest_submit/CDashSubmitQuiet/test.cmake diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stdout.txt new file mode 100644 index 000000000..cd42c9a6d --- /dev/null +++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stdout.txt @@ -0,0 +1,3 @@ +Configure project + Each . represents 1024 bytes of output + . Size of output: 0K$ diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake index c004e97bb..a81bc96a0 100644 --- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake @@ -24,6 +24,7 @@ run_ctest_submit(CDashUploadFILES CDASH_UPLOAD bad-upload FILES) run_ctest_submit(CDashUploadRETRY_COUNT CDASH_UPLOAD bad-upload RETRY_COUNT) run_ctest_submit(CDashUploadRETRY_DELAY CDASH_UPLOAD bad-upload RETRY_DELAY) run_ctest_submit(CDashUploadNone CDASH_UPLOAD) +run_ctest_submit(CDashSubmitQuiet QUIET) function(run_ctest_CDashUploadFTP) set(CASE_DROP_METHOD ftp) From e2b9e7f7bc1b4e3a36e8b19fc9925b358b5c99e0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Feb 2015 09:16:41 -0500 Subject: [PATCH 0196/1029] Tests: Drop unnecessary stderr matching from RunCMake.ctest_memcheck The Dummy*-stderr.txt files were needed only to match platform-specific memcheck tooling output and verify that stderr is otherwise empty. Now that the RunCMake infrastructure knows how to strip such lines before matching, we can simply drop these files and use the default empty string match. --- Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt | 3 --- Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt | 3 --- .../ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt | 3 --- Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt | 3 --- .../RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt | 3 --- 5 files changed, 15 deletions(-) delete mode 100644 Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt delete mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt delete mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt delete mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt delete mode 100644 Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt deleted file mode 100644 index 14bc228bd..000000000 --- a/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -^((^| -)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ -]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt deleted file mode 100644 index 14bc228bd..000000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -^((^| -)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ -]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt deleted file mode 100644 index 14bc228bd..000000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -^((^| -)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ -]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt deleted file mode 100644 index 14bc228bd..000000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -^((^| -)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ -]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt deleted file mode 100644 index 14bc228bd..000000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -^((^| -)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ -]*)*$ From 19d1a5599a08f2e8d74c4483cb9ee6d34e38ecba Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 09:58:25 -0500 Subject: [PATCH 0197/1029] ctest_start: Add QUIET option This suppresses all non-error messages that would have otherwise been printed by this function. --- Help/command/ctest_start.rst | 5 +- Source/CTest/cmCTestStartCommand.cxx | 23 ++++-- Source/CTest/cmCTestStartCommand.h | 10 +++ Source/cmCTest.cxx | 76 ++++++++++--------- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/ctest_start/CMakeLists.txt.in | 4 + .../RunCMake/ctest_start/CTestConfig.cmake.in | 1 + Tests/RunCMake/ctest_start/RunCMakeTest.cmake | 10 +++ .../ctest_start/StartQuiet-stdout.txt | 1 + Tests/RunCMake/ctest_start/test.cmake.in | 13 ++++ 10 files changed, 102 insertions(+), 42 deletions(-) create mode 100644 Tests/RunCMake/ctest_start/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_start/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_start/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_start/StartQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/test.cmake.in diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst index d7472dbc7..b5c7b34a5 100644 --- a/Help/command/ctest_start.rst +++ b/Help/command/ctest_start.rst @@ -5,7 +5,7 @@ Starts the testing for a given model :: - ctest_start(Model [TRACK ] [APPEND] [source [binary]]) + ctest_start(Model [TRACK ] [APPEND] [source [binary]] [QUIET]) Starts the testing for a given model. The command should be called after the binary directory is initialized. If the 'source' and @@ -14,7 +14,8 @@ after the binary directory is initialized. If the 'source' and If the track is specified, the submissions will go to the specified track. If APPEND is used, the existing TAG is used rather than creating a new one based -on the current time stamp. +on the current time stamp. If QUIET is used, CTest will suppress any +non-error messages that it otherwise would have printed to the console. If the :variable:`CTEST_CHECKOUT_COMMAND` variable (or the :variable:`CTEST_CVS_CHECKOUT` variable) diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 8ea6cef24..e19e4f41e 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -20,6 +20,7 @@ cmCTestStartCommand::cmCTestStartCommand() { this->CreateNewTag = true; + this->Quiet = false; } bool cmCTestStartCommand @@ -57,6 +58,14 @@ bool cmCTestStartCommand this->CreateNewTag = false; } } + if (cnt < args.size()) + { + if (args[cnt] == "QUIET") + { + cnt ++; + this->Quiet = true; + } + } if ( cnt < args.size() ) { @@ -95,18 +104,20 @@ bool cmCTestStartCommand std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir); std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir); - this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str()); - this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str()); + this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str(), + this->Quiet); + this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str(), + this->Quiet); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel << std::endl << " Source directory: " << src_dir << std::endl - << " Build directory: " << bld_dir << std::endl); + << " Build directory: " << bld_dir << std::endl, this->Quiet); const char* track = this->CTest->GetSpecificTrack(); if ( track ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Track: " << track << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Track: " << track << std::endl, this->Quiet); } // Log startup actions. diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 3b8843f35..eed196288 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -34,6 +34,7 @@ public: ni->CTest = this->CTest; ni->CTestScriptHandler = this->CTestScriptHandler; ni->CreateNewTag = this->CreateNewTag; + ni->Quiet = this->Quiet; return ni; } @@ -52,6 +53,14 @@ public: return this->CreateNewTag; } + /** + * Should this invocation of ctest_start output non-error messages? + */ + bool ShouldBeQuiet() + { + return this->Quiet; + } + /** * The name of the command as specified in CMakeList.txt. */ @@ -62,6 +71,7 @@ public: private: bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir); bool CreateNewTag; + bool Quiet; }; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 997580287..d7fe22d89 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -463,7 +463,13 @@ cmCTest::Part cmCTest::GetPartFromName(const char* name) //---------------------------------------------------------------------- int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) { - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + bool quiet = false; + if (command && command->ShouldBeQuiet()) + { + quiet = true; + } + + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet); if(!this->InteractiveDebugMode) { this->BlockTestErrorDiagnostics(); @@ -478,24 +484,23 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) this->UpdateCTestConfiguration(); - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet); if ( this->ProduceXML ) { - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); - cmCTestLog(this, OUTPUT, - " Site: " << this->GetCTestConfiguration("Site") << std::endl - << " Build name: " - << cmCTest::SafeBuildIdField( - this->GetCTestConfiguration("BuildName")) - << std::endl); - cmCTestLog(this, DEBUG, "Produce XML is on" << std::endl); + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet); + cmCTestOptionalLog(this, OUTPUT, + " Site: " << this->GetCTestConfiguration("Site") << std::endl << + " Build name: " << cmCTest::SafeBuildIdField( + this->GetCTestConfiguration("BuildName")) << std::endl, quiet); + cmCTestOptionalLog(this, DEBUG, "Produce XML is on" << std::endl, quiet); if ( this->TestModel == cmCTest::NIGHTLY && this->GetCTestConfiguration("NightlyStartTime").empty() ) { - cmCTestLog(this, WARNING, - "WARNING: No nightly start time found please set in" - " CTestConfig.cmake or DartConfig.cmake" << std::endl); - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + cmCTestOptionalLog(this, WARNING, + "WARNING: No nightly start time found please set in CTestConfig.cmake" + " or DartConfig.cmake" << std::endl, quiet); + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, + quiet); return 0; } } @@ -507,8 +512,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { - cmCTestLog(this, DEBUG, "Cannot find custom configuration file tree" - << std::endl); + cmCTestOptionalLog(this, DEBUG, + "Cannot find custom configuration file tree" << std::endl, quiet); return 0; } @@ -583,9 +588,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } if (tag.empty() || (0 != command) || this->Parts[PartStart]) { - cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString() - << std::endl); - cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl); + cmCTestOptionalLog(this, DEBUG, "TestModel: " << + this->GetTestModelString() << std::endl, quiet); + cmCTestOptionalLog(this, DEBUG, "TestModel: " << + this->TestModel << std::endl, quiet); if ( this->TestModel == cmCTest::NIGHTLY ) { lctime = this->GetNightlyTime( @@ -609,8 +615,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) ofs.close(); if ( 0 == command ) { - cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - " - << this->GetTestModelString() << std::endl); + cmCTestOptionalLog(this, OUTPUT, "Create new tag: " << tag << " - " + << this->GetTestModelString() << std::endl, quiet); } } } @@ -630,8 +636,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) return 0; } - cmCTestLog(this, OUTPUT, " Use existing tag: " << tag << " - " - << this->GetTestModelString() << std::endl); + cmCTestOptionalLog(this, OUTPUT, " Use existing tag: " << tag << " - " + << this->GetTestModelString() << std::endl, quiet); } this->CurrentTag = tag; @@ -675,8 +681,8 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) if ( !fname.empty() ) { - cmCTestLog(this, OUTPUT, " Reading ctest configuration file: " - << fname << std::endl); + cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: " + << fname << std::endl, command->ShouldBeQuiet()); bool readit = mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str() ); if(!readit) @@ -689,19 +695,20 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) } else { - cmCTestLog(this, WARNING, + cmCTestOptionalLog(this, WARNING, "Cannot locate CTest configuration: in BuildDirectory: " - << bld_dir_fname << std::endl); - cmCTestLog(this, WARNING, + << bld_dir_fname << std::endl, command->ShouldBeQuiet()); + cmCTestOptionalLog(this, WARNING, "Cannot locate CTest configuration: in SourceDirectory: " - << src_dir_fname << std::endl); + << src_dir_fname << std::endl, command->ShouldBeQuiet()); } this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime", - "CTEST_NIGHTLY_START_TIME"); - this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE"); + "CTEST_NIGHTLY_START_TIME", command->ShouldBeQuiet()); + this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE", + command->ShouldBeQuiet()); this->SetCTestConfigurationFromCMakeVariable(mf, "BuildName", - "CTEST_BUILD_NAME"); + "CTEST_BUILD_NAME", command->ShouldBeQuiet()); const char* dartVersion = mf->GetDefinition("CTEST_DART_SERVER_VERSION"); if ( dartVersion ) { @@ -720,8 +727,9 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { return false; } - cmCTestLog(this, OUTPUT, " Use " << this->GetTestModelString() - << " tag: " << this->GetCurrentTag() << std::endl); + cmCTestOptionalLog(this, OUTPUT, " Use " << this->GetTestModelString() + << " tag: " << this->GetCurrentTag() << std::endl, + command->ShouldBeQuiet()); return true; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 59c6918e5..a9b8bf351 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -129,6 +129,7 @@ add_RunCMake_test(build_command) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) +add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) add_RunCMake_test(file) add_RunCMake_test(find_library) diff --git a/Tests/RunCMake/ctest_start/CMakeLists.txt.in b/Tests/RunCMake/ctest_start/CMakeLists.txt.in new file mode 100644 index 000000000..913239c29 --- /dev/null +++ b/Tests/RunCMake/ctest_start/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestStart@CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_start/CTestConfig.cmake.in b/Tests/RunCMake/ctest_start/CTestConfig.cmake.in new file mode 100644 index 000000000..e75d14fc2 --- /dev/null +++ b/Tests/RunCMake/ctest_start/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestStart@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake new file mode 100644 index 000000000..f765a0f5f --- /dev/null +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCTest) + +set(CASE_CTEST_START_ARGS "") + +function(run_ctest_start CASE_NAME) + set(CASE_CTEST_START_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_start(StartQuiet Experimental QUIET) diff --git a/Tests/RunCMake/ctest_start/StartQuiet-stdout.txt b/Tests/RunCMake/ctest_start/StartQuiet-stdout.txt new file mode 100644 index 000000000..10f32932e --- /dev/null +++ b/Tests/RunCMake/ctest_start/StartQuiet-stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in new file mode 100644 index 000000000..21e3fad2d --- /dev/null +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +set(ctest_start_args "@CASE_CTEST_START_ARGS@") +ctest_start(${ctest_start_args}) From 645ad117e1c8b3b99fda128daad708a87c0a3f2e Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 11:45:46 -0500 Subject: [PATCH 0198/1029] ctest_update: Add QUIET option --- Help/command/ctest_update.rst | 7 ++++- Source/CTest/cmCTestUpdateCommand.cxx | 44 ++++++++++++++------------- Source/CTest/cmCTestUpdateHandler.cxx | 39 +++++++++++++----------- Tests/CTestUpdateCommon.cmake | 6 ++++ Tests/CTestUpdateGIT.cmake.in | 33 ++++++++++++++++++++ 5 files changed, 89 insertions(+), 40 deletions(-) diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst index d34e192af..01e357bb4 100644 --- a/Help/command/ctest_update.rst +++ b/Help/command/ctest_update.rst @@ -5,9 +5,14 @@ Update the work tree from version control. :: - ctest_update([SOURCE source] [RETURN_VALUE res]) + ctest_update([SOURCE source] [RETURN_VALUE res] [QUIET]) Updates the given source directory and stores results in Update.xml. If no SOURCE is given, the CTEST_SOURCE_DIRECTORY variable is used. The RETURN_VALUE option specifies a variable in which to store the result, which is the number of files updated or -1 on error. + +If QUIET is specified then CTest will suppress most non-error +messages that it would have otherwise printed to the console. +CTest will still report the new revision of the repository +and any conflicting files that were found. diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index f87466d9c..dfda9f1e9 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -20,55 +20,56 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() { this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Values[ct_SOURCE]).c_str()); + this->Values[ct_SOURCE]).c_str(), this->Quiet); } else { this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str()); + this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str(), + this->Quiet); } std::string source_dir = this->CTest->GetCTestConfiguration("SourceDirectory"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "UpdateCommand", "CTEST_UPDATE_COMMAND"); + "UpdateCommand", "CTEST_UPDATE_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "UpdateOptions", "CTEST_UPDATE_OPTIONS"); + "UpdateOptions", "CTEST_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CVSCommand", "CTEST_CVS_COMMAND"); + "CVSCommand", "CTEST_CVS_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS"); + "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "SVNCommand", "CTEST_SVN_COMMAND"); + "SVNCommand", "CTEST_SVN_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS"); + "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "SVNOptions", "CTEST_SVN_OPTIONS"); + "SVNOptions", "CTEST_SVN_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "BZRCommand", "CTEST_BZR_COMMAND"); + "BZRCommand", "CTEST_BZR_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS"); + "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "GITCommand", "CTEST_GIT_COMMAND"); + "GITCommand", "CTEST_GIT_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS"); + "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM"); + "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY"); + "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "HGCommand", "CTEST_HG_COMMAND"); + "HGCommand", "CTEST_HG_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS"); + "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4Command", "CTEST_P4_COMMAND"); + "P4Command", "CTEST_P4_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS"); + "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4Client", "CTEST_P4_CLIENT"); + "P4Client", "CTEST_P4_CLIENT", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4Options", "CTEST_P4_OPTIONS"); + "P4Options", "CTEST_P4_OPTIONS", this->Quiet); cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("update"); @@ -84,6 +85,7 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() return 0; } handler->SetOption("SourceDirectory", source_dir.c_str()); + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 4c37c8bec..b18786a32 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -122,11 +122,13 @@ void cmCTestUpdateHandler::Initialize() //---------------------------------------------------------------------- int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) { - cmCTestLog(this->CTest, DEBUG, "Determine update type from command: " << cmd - << " and type: " << type << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Determine update type from command: " << cmd << " and type: " << type << + std::endl, this->Quiet); if ( type && *type ) { - cmCTestLog(this->CTest, DEBUG, "Type specified: " << type << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Type specified: " << type << + std::endl, this->Quiet); std::string stype = cmSystemTools::LowerCase(type); if ( stype.find("cvs") != std::string::npos ) { @@ -155,8 +157,8 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) } else { - cmCTestLog(this->CTest, DEBUG, "Type not specified, check command: " - << cmd << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Type not specified, check command: " << cmd << std::endl, this->Quiet); std::string stype = cmSystemTools::LowerCase(cmd); if ( stype.find("cvs") != std::string::npos ) { @@ -211,18 +213,19 @@ int cmCTestUpdateHandler::ProcessHandler() this->StartLogFile("Update", ofs); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Updating the repository: " - << sourceDirectory << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Updating the repository: " << sourceDirectory << std::endl, + this->Quiet); if(!this->SelectVCS()) { return -1; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use " << cmCTestUpdateHandlerUpdateToString(this->UpdateType) << " repository type" - << std::endl;); + << std::endl;, this->Quiet); // Create an object to interact with the VCS tool. cmsys::auto_ptr vc; @@ -283,23 +286,23 @@ int cmCTestUpdateHandler::ProcessHandler() int numUpdated = vc->GetPathCount(cmCTestVC::PathUpdated); if(numUpdated) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Found " << numUpdated << " updated files\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Found " << numUpdated << " updated files\n", this->Quiet); } if(int numModified = vc->GetPathCount(cmCTestVC::PathModified)) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Found " << numModified << " locally modified files\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Found " << numModified << " locally modified files\n", this->Quiet); localModifications += numModified; } if(int numConflicting = vc->GetPathCount(cmCTestVC::PathConflicting)) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Found " << numConflicting << " conflicting files\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Found " << numConflicting << " conflicting files\n", this->Quiet); localModifications += numConflicting; } - cmCTestLog(this->CTest, DEBUG, "End" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet); std::string end_time = this->CTest->CurrentTime(); os << "\t" << end_time << "\n" << "\t" << static_cast(cmSystemTools::GetTime()) @@ -331,8 +334,8 @@ int cmCTestUpdateHandler::ProcessHandler() int cmCTestUpdateHandler::DetectVCS(const char* dir) { std::string sourceDirectory = dir; - cmCTestLog(this->CTest, DEBUG, "Check directory: " - << sourceDirectory << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Check directory: " + << sourceDirectory << std::endl, this->Quiet); sourceDirectory += "/.svn"; if ( cmSystemTools::FileExists(sourceDirectory.c_str()) ) { diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 97153f0f9..77b33989a 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -13,6 +13,9 @@ function(run_child) message(FATAL_ERROR "Child failed (${FAILED}), output is\n ${OUTPUT}\n" "Command = [${ARGN}]\n") endif() + + # Pass output back up to the parent scope for possible further inspection. + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- @@ -269,6 +272,9 @@ function(run_dashboard_script bin_dir) Updated{subdir/bar.txt} ) endif() + + # Pass console output up to the parent, in case they'd like to inspect it. + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 41b732b75..5987a3005 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -334,3 +334,36 @@ set(CTEST_UPDATE_VERSION_ONLY TRUE) # Run the dashboard script with CTest. set(NO_UPDATE 1) run_dashboard_script(dash-binary-no-update) + +rewind_source(dash-source) + +#----------------------------------------------------------------------------- +# Test ctest_update(QUIET) +set(NO_UPDATE 0) +message("Running CTest Dashboard Script (update quietly)...") + +create_dashboard_script(dash-binary-quiet + "# git command configuration +set(CTEST_GIT_COMMAND \"${GIT}\") +set(CTEST_GIT_UPDATE_OPTIONS) +set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) +") + +# We need to modify the created dashboard script to include our "QUIET" +# option. +set(filename "${TOP}/dash-binary-quiet.cmake") +file(READ "${filename}" contents) +string(REPLACE + [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})]=] + [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} QUIET)]=] + contents + "${contents}") +file(WRITE "${filename}" "${contents}") + +# Run the dashboard script with CTest. +run_dashboard_script(dash-binary-quiet) + +# Make sure the output seems quiet. +if("${OUTPUT}" MATCHES "Updating the repository") + message(FATAL_ERROR "Found 'Updating the repository' in quiet output") +endif() From f999dc0bbf70dcf6167d77a1dedabefa12edaef2 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 12:38:52 -0500 Subject: [PATCH 0199/1029] ctest_configure: Add QUIET option --- Help/command/ctest_configure.rst | 6 +++++- Source/CTest/cmCTestConfigureCommand.cxx | 5 +++-- Source/CTest/cmCTestConfigureHandler.cxx | 13 +++++++------ Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/ctest_configure/CMakeLists.txt.in | 4 ++++ .../RunCMake/ctest_configure/CTestConfig.cmake.in | 1 + .../ctest_configure/ConfigureQuiet-stdout.txt | 9 +++++++++ Tests/RunCMake/ctest_configure/RunCMakeTest.cmake | 10 ++++++++++ Tests/RunCMake/ctest_configure/test.cmake.in | 14 ++++++++++++++ 9 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 Tests/RunCMake/ctest_configure/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_configure/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_configure/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_configure/test.cmake.in diff --git a/Help/command/ctest_configure.rst b/Help/command/ctest_configure.rst index 2c4e305ff..61d93209c 100644 --- a/Help/command/ctest_configure.rst +++ b/Help/command/ctest_configure.rst @@ -6,7 +6,7 @@ Configure the project build tree. :: ctest_configure([BUILD build_dir] [SOURCE source_dir] [APPEND] - [OPTIONS options] [RETURN_VALUE res]) + [OPTIONS options] [RETURN_VALUE res] [QUIET]) Configures the given build directory and stores results in Configure.xml. If no BUILD is given, the CTEST_BINARY_DIRECTORY @@ -19,3 +19,7 @@ build tool. The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. + +The QUIET option suppresses any CTest-specific non-error messages +that would have otherwise been printed to the console. Output from +the underlying configure command is not affected. diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 0f1326397..ba4dab235 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -45,7 +45,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() if ( ctestConfigureCommand && *ctestConfigureCommand ) { this->CTest->SetCTestConfiguration("ConfigureCommand", - ctestConfigureCommand); + ctestConfigureCommand, this->Quiet); } else { @@ -141,7 +141,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmakeConfigureCommand += "\""; this->CTest->SetCTestConfiguration("ConfigureCommand", - cmakeConfigureCommand.c_str()); + cmakeConfigureCommand.c_str(), this->Quiet); } else { @@ -160,5 +160,6 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() "internal CTest error. Cannot instantiate configure handler"); return 0; } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 506433fd8..3b444f21b 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -35,7 +35,8 @@ void cmCTestConfigureHandler::Initialize() //functions and commented... int cmCTestConfigureHandler::ProcessHandler() { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "Configure project" << std::endl, this->Quiet); std::string cCommand = this->CTest->GetCTestConfiguration("ConfigureCommand"); if (cCommand.empty()) @@ -75,8 +76,8 @@ int cmCTestConfigureHandler::ProcessHandler() cmGeneratedFileStream ofs; this->StartLogFile("Configure", ofs); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: " - << cCommand << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Configure with command: " << cCommand << std::endl, this->Quiet); res = this->CTest->RunMakeCommand(cCommand.c_str(), output, &retVal, buildDirectory.c_str(), 0, ofs); @@ -101,7 +102,7 @@ int cmCTestConfigureHandler::ProcessHandler() } os << "" << cCommand << "" << std::endl; - cmCTestLog(this->CTest, DEBUG, "End" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet); os << "" << cmXMLSafe(output) << "" << std::endl; std::string end_time = this->CTest->CurrentTime(); os << "\t" << retVal << "\n" @@ -119,8 +120,8 @@ int cmCTestConfigureHandler::ProcessHandler() } else { - cmCTestLog(this->CTest, DEBUG, "Configure with command: " << cCommand - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Configure with command: " << cCommand << std::endl, this->Quiet); } if (! res || retVal ) { diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a9b8bf351..d39dbcf35 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -129,6 +129,7 @@ add_RunCMake_test(build_command) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) +add_RunCMake_test(ctest_configure) add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) add_RunCMake_test(file) diff --git a/Tests/RunCMake/ctest_configure/CMakeLists.txt.in b/Tests/RunCMake/ctest_configure/CMakeLists.txt.in new file mode 100644 index 000000000..2fb21d45d --- /dev/null +++ b/Tests/RunCMake/ctest_configure/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestConfigure@CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_configure/CTestConfig.cmake.in b/Tests/RunCMake/ctest_configure/CTestConfig.cmake.in new file mode 100644 index 000000000..7e30ab933 --- /dev/null +++ b/Tests/RunCMake/ctest_configure/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestConfigure@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt b/Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt new file mode 100644 index 000000000..015644d81 --- /dev/null +++ b/Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt @@ -0,0 +1,9 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_configure/ConfigureQuiet + Build directory: .*/Tests/RunCMake/ctest_configure/ConfigureQuiet-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_configure/ConfigureQuiet/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use Experimental tag: [0-9-]+ + Each . represents 1024 bytes of output + . Size of output: 0K diff --git a/Tests/RunCMake/ctest_configure/RunCMakeTest.cmake b/Tests/RunCMake/ctest_configure/RunCMakeTest.cmake new file mode 100644 index 000000000..fc1b02cf0 --- /dev/null +++ b/Tests/RunCMake/ctest_configure/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCTest) + +set(CASE_CTEST_CONFIGURE_ARGS "") + +function(run_ctest_configure CASE_NAME) + set(CASE_CTEST_CONFIGURE_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_configure(ConfigureQuiet QUIET) diff --git a/Tests/RunCMake/ctest_configure/test.cmake.in b/Tests/RunCMake/ctest_configure/test.cmake.in new file mode 100644 index 000000000..72d199acb --- /dev/null +++ b/Tests/RunCMake/ctest_configure/test.cmake.in @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +set(ctest_configure_args "@CASE_CTEST_CONFIGURE_ARGS@") +ctest_start(Experimental) +ctest_configure(${ctest_configure_args}) From 49ba4545c272f5bb00828dfe35e5a63749b4aa43 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 13:41:40 -0500 Subject: [PATCH 0200/1029] ctest_build: Add QUIET option --- Help/command/ctest_build.rst | 5 ++ Source/CTest/cmCTestBuildCommand.cxx | 15 ++-- Source/CTest/cmCTestBuildHandler.cxx | 76 ++++++++++--------- Tests/RunCMake/CMakeLists.txt | 1 + .../ctest_build/BuildQuiet-stdout.txt | 12 +++ Tests/RunCMake/ctest_build/CMakeLists.txt.in | 4 + .../RunCMake/ctest_build/CTestConfig.cmake.in | 1 + Tests/RunCMake/ctest_build/RunCMakeTest.cmake | 10 +++ Tests/RunCMake/ctest_build/test.cmake.in | 15 ++++ 9 files changed, 99 insertions(+), 40 deletions(-) create mode 100644 Tests/RunCMake/ctest_build/BuildQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_build/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_build/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_build/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_build/test.cmake.in diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 4a95cdde7..e7a54d128 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -23,6 +23,11 @@ The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. +The QUIET option suppresses any CTest-specific non-error output +that would have been printed to the console otherwise. The summary +of warnings / errors, as well as the output from the native build tool +is unaffected by this option. + If set, the contents of the variable CTEST_BUILD_FLAGS are passed as additional arguments to the underlying build command. This can e.g. be used to trigger a parallel build using the -j option of make. See diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index c4df74150..2b36b0ae5 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -58,7 +58,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); if ( ctestBuildCommand && *ctestBuildCommand ) { - this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand); + this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand, + this->Quiet); } else { @@ -141,10 +142,10 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", cmakeBuildConfiguration, cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "SetMakeCommand:" - << buildCommand << "\n"); - this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str()); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "SetMakeCommand:" << buildCommand << "\n", this->Quiet); + this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str(), + this->Quiet); } else { @@ -168,9 +169,11 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() if(const char* useLaunchers = this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) { - this->CTest->SetCTestConfiguration("UseLaunchers", useLaunchers); + this->CTest->SetCTestConfiguration("UseLaunchers", useLaunchers, + this->Quiet); } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index f941408c0..fe27e2b3c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -286,9 +286,9 @@ std::string cmCTestBuildHandler::GetMakeCommand() { std::string makeCommand = this->CTest->GetCTestConfiguration("MakeCommand"); - cmCTestLog(this->CTest, - HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << - "\n"); + cmCTestOptionalLog(this->CTest, + HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << "\n", + this->Quiet); std::string configType = this->CTest->GetConfigType(); if (configType == "") @@ -312,7 +312,8 @@ std::string cmCTestBuildHandler::GetMakeCommand() //functions and commented... int cmCTestBuildHandler::ProcessHandler() { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl, + this->Quiet); // do we have time for this if (this->CTest->GetRemainingTimeAllowed() < 120) @@ -401,12 +402,12 @@ int cmCTestBuildHandler::ProcessHandler() #define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \ regexes.clear(); \ - cmCTestLog(this->CTest, DEBUG, this << "Add " #regexes \ - << std::endl); \ + cmCTestOptionalLog(this->CTest, DEBUG, this << "Add " #regexes \ + << std::endl, this->Quiet); \ for ( it = strings.begin(); it != strings.end(); ++it ) \ { \ - cmCTestLog(this->CTest, DEBUG, "Add " #strings ": " \ - << *it << std::endl); \ + cmCTestOptionalLog(this->CTest, DEBUG, "Add " #strings ": " \ + << *it << std::endl, this->Quiet); \ regexes.push_back(it->c_str()); \ } cmCTestBuildHandlerPopulateRegexVector( @@ -472,8 +473,8 @@ int cmCTestBuildHandler::ProcessHandler() } else { - cmCTestLog(this->CTest, DEBUG, "Build with command: " << makeCommand - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Build with command: " << + makeCommand << std::endl, this->Quiet); } // Remember end build time and calculate elapsed time @@ -906,13 +907,16 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, } argv.push_back(0); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:", + this->Quiet); std::vector::iterator ait; for ( ait = argv.begin(); ait != argv.end() && *ait; ++ ait ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\""); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << + "\"", this->Quiet); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, + this->Quiet); // Optionally use make rule launchers to record errors and warnings. LaunchHelper launchHelper(this); @@ -932,12 +936,12 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, char* data; int length; - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Each symbol represents " << tick_len << " bytes of output." << std::endl << (this->UseCTestLaunch? "" : " '!' represents an error and '*' a warning.\n") - << " " << std::flush); + << " " << std::flush, this->Quiet); // Initialize building structures this->BuildProcessingQueue.clear(); @@ -980,8 +984,9 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue); this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingErrorQueue); - cmCTestLog(this->CTest, OUTPUT, " Size of output: " - << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl); + cmCTestOptionalLog(this->CTest, OUTPUT, " Size of output: " + << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl, + this->Quiet); // Properly handle output of the build command cmsysProcess_WaitForExit(cp, 0); @@ -992,8 +997,8 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, if (retVal) { *retVal = cmsysProcess_GetExitValue(cp); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Command exited with the value: " << *retVal << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Command exited with the value: " << *retVal << std::endl, this->Quiet); // if a non zero return value if (*retVal) { @@ -1017,13 +1022,14 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, if (retVal) { *retVal = cmsysProcess_GetExitException(cp); - cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal - << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "There was an exception: " << + *retVal << std::endl, this->Quiet); } } else if(result == cmsysProcess_State_Expired) { - cmCTestLog(this->CTest, WARNING, "There was a timeout" << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "There was a timeout" << + std::endl, this->Quiet); } else if(result == cmsysProcess_State_Error) { @@ -1185,13 +1191,14 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, while ( this->BuildOutputLogSize > (tick * tick_len) ) { tick ++; - cmCTestLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar, + this->Quiet); tickDisplayed = true; if ( tick % tick_line_len == 0 && tick > 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Size: " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Size: " << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl - << " "); + << " ", this->Quiet); } } if ( tickDisplayed ) @@ -1216,7 +1223,8 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) return b_REGULAR_LINE; } - cmCTestLog(this->CTest, DEBUG, "Line: [" << data << "]" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Line: [" << data << "]" << + std::endl, this->Quiet); std::vector::iterator it; @@ -1236,9 +1244,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { errorLine = 1; - cmCTestLog(this->CTest, DEBUG, " Error Line: " << data + cmCTestOptionalLog(this->CTest, DEBUG, " Error Line: " << data << " (matches: " << this->CustomErrorMatches[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; @@ -1252,9 +1260,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { errorLine = 0; - cmCTestLog(this->CTest, DEBUG, " Not an error Line: " << data + cmCTestOptionalLog(this->CTest, DEBUG, " Not an error Line: " << data << " (matches: " << this->CustomErrorExceptions[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; @@ -1271,10 +1279,10 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { warningLine = 1; - cmCTestLog(this->CTest, DEBUG, + cmCTestOptionalLog(this->CTest, DEBUG, " Warning Line: " << data << " (matches: " << this->CustomWarningMatches[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; @@ -1289,9 +1297,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { warningLine = 0; - cmCTestLog(this->CTest, DEBUG, " Not a warning Line: " << data + cmCTestOptionalLog(this->CTest, DEBUG, " Not a warning Line: " << data << " (matches: " << this->CustomWarningExceptions[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d39dbcf35..9bce7a3ed 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -129,6 +129,7 @@ add_RunCMake_test(build_command) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) +add_RunCMake_test(ctest_build) add_RunCMake_test(ctest_configure) add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) diff --git a/Tests/RunCMake/ctest_build/BuildQuiet-stdout.txt b/Tests/RunCMake/ctest_build/BuildQuiet-stdout.txt new file mode 100644 index 000000000..2e59d99ec --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildQuiet-stdout.txt @@ -0,0 +1,12 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_build/BuildQuiet + Build directory: .*/Tests/RunCMake/ctest_build/BuildQuiet-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_build/BuildQuiet/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use Experimental tag: [0-9-]+ +Configure project + Each . represents 1024 bytes of output + . Size of output: 0K + 0 Compiler errors + 0 Compiler warnings diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in new file mode 100644 index 000000000..9ba08e9f3 --- /dev/null +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestBuild@CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_build/CTestConfig.cmake.in b/Tests/RunCMake/ctest_build/CTestConfig.cmake.in new file mode 100644 index 000000000..097f82c17 --- /dev/null +++ b/Tests/RunCMake/ctest_build/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestBuild@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake new file mode 100644 index 000000000..5826fe45e --- /dev/null +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCTest) + +set(CASE_CTEST_BUILD_ARGS "") + +function(run_ctest_build CASE_NAME) + set(CASE_CTEST_BUILD_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_build(BuildQuiet QUIET) diff --git a/Tests/RunCMake/ctest_build/test.cmake.in b/Tests/RunCMake/ctest_build/test.cmake.in new file mode 100644 index 000000000..38c8ea18c --- /dev/null +++ b/Tests/RunCMake/ctest_build/test.cmake.in @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@") +ctest_start(Experimental) +ctest_configure() +ctest_build(${ctest_build_args}) From 876a680d4851a39e77b49daa3c670fe2e535c1e6 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 14:23:56 -0500 Subject: [PATCH 0201/1029] ctest_test: Add QUIET option --- Help/command/ctest_test.rst | 6 ++ Source/CTest/cmCTestMultiProcessHandler.cxx | 47 ++++++++------ Source/CTest/cmCTestMultiProcessHandler.h | 3 + Source/CTest/cmCTestTestCommand.cxx | 1 + Source/CTest/cmCTestTestHandler.cxx | 64 ++++++++++--------- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/ctest_test/CMakeLists.txt.in | 4 ++ .../RunCMake/ctest_test/CTestConfig.cmake.in | 1 + Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 10 +++ .../RunCMake/ctest_test/TestQuiet-stdout.txt | 2 + Tests/RunCMake/ctest_test/test.cmake.in | 16 +++++ 11 files changed, 105 insertions(+), 50 deletions(-) create mode 100644 Tests/RunCMake/ctest_test/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_test/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_test/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_test/TestQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_test/test.cmake.in diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 5f2808381..ee76e91f5 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -31,3 +31,9 @@ tests should all stop running. The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. + +The QUIET option suppresses any CTest-specific non-error messages +that would have otherwise been printed to the console. Output from +the underlying test command is not affected. Summary info detailing +the percentage of passing tests is also unaffected by the QUIET +option. diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index f22312754..eb33d8edb 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -113,7 +113,8 @@ void cmCTestMultiProcessHandler::RunTests() //--------------------------------------------------------- void cmCTestMultiProcessHandler::StartTestProcess(int test) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "test " << test << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "test " << test << "\n", this->Quiet); this->TestRunningMap[test] = true; // mark the test as running // now remove the test itself this->EraseTest(test); @@ -639,39 +640,44 @@ void cmCTestMultiProcessHandler::PrintTestList() if(!p.Labels.empty()) //print the labels { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:", + this->Quiet); } for(std::vector::iterator label = p.Labels.begin(); label != p.Labels.end(); ++label) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label, + this->Quiet); } if(!p.Labels.empty()) //print the labels { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, + this->Quiet); } if (this->TestHandler->MemCheck) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Memory Check", + this->Quiet); } else { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Test"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Test", this->Quiet); } std::ostringstream indexStr; indexStr << " #" << p.Index << ":"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) - << indexStr.str()); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); - cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); + << indexStr.str(), this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + p.Name.c_str() << std::endl, this->Quiet); //pop working dir cmSystemTools::ChangeDirectory(current_dir); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " - << this->Total << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " + << this->Total << std::endl, this->Quiet); } void cmCTestMultiProcessHandler::PrintLabels() @@ -686,16 +692,19 @@ void cmCTestMultiProcessHandler::PrintLabels() if(!allLabels.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "All Labels:" << std::endl, this->Quiet); } else { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "No Labels Exist" << std::endl, this->Quiet); } for(std::set::iterator label = allLabels.begin(); label != allLabels.end(); ++label) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " " << *label << std::endl, this->Quiet); } } @@ -758,8 +767,8 @@ int cmCTestMultiProcessHandler::FindMaxIndex() //Returns true if no cycles exist in the dependency graph bool cmCTestMultiProcessHandler::CheckCycles() { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Checking test dependency graph..." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph..." << std::endl, this->Quiet); for(TestMap::iterator it = this->Tests.begin(); it != this->Tests.end(); ++it) { @@ -794,7 +803,7 @@ bool cmCTestMultiProcessHandler::CheckCycles() } } } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Checking test dependency graph end" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl, this->Quiet); return true; } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 605de3134..6440fbc19 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -57,6 +57,8 @@ public: cmCTestTestHandler * GetTestHandler() { return this->TestHandler; } + + void SetQuiet(bool b) { this->Quiet = b; } protected: // Start the next test or tests as many as are allowed by // ParallelLevel @@ -118,6 +120,7 @@ protected: cmCTestTestHandler * TestHandler; cmCTest* CTest; bool HasCycles; + bool Quiet; }; #endif diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index d2090944d..8b357acd3 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -103,6 +103,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() { this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]); } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 925e3c9dd..0e84fbf8b 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -527,10 +527,10 @@ int cmCTestTestHandler::ProcessHandler() this->TestResults.clear(); - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, (this->MemCheck ? "Memory check" : "Test") << " project " << cmSystemTools::GetCurrentWorkingDirectory() - << std::endl); + << std::endl, this->Quiet); if ( ! this->PreProcessHandler() ) { return -1; @@ -567,13 +567,13 @@ int cmCTestTestHandler::ProcessHandler() if (this->HandlerVerbose && !passed.empty() && (this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag)) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl - << "The following tests passed:" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl + << "The following tests passed:" << std::endl, this->Quiet); for(std::vector::iterator j = passed.begin(); j != passed.end(); ++j) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j + << std::endl, this->Quiet); } } @@ -593,8 +593,8 @@ int cmCTestTestHandler::ProcessHandler() } char realBuf[1024]; sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start)); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " - << realBuf << "\n" ); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet ); if (!failed.empty()) { @@ -614,11 +614,11 @@ int cmCTestTestHandler::ProcessHandler() if ( ftit->Status != cmCTestTestHandler::COMPLETED ) { ofs << ftit->TestCount << ":" << ftit->Name << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->TestCount << " - " << ftit->Name << " (" << this->GetTestStatus(ftit->Status) << ")" - << std::endl); + << std::endl, this->Quiet); } } } @@ -700,7 +700,8 @@ void cmCTestTestHandler::PrintLabelSummary() // now print times if(!labels.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:", + this->Quiet); } for(std::set::const_iterator i = labels.begin(); i != labels.end(); ++i) @@ -709,8 +710,8 @@ void cmCTestTestHandler::PrintLabelSummary() label.resize(maxlen +3, ' '); char buf[1024]; sprintf(buf, "%6.2f sec", labelTimes[*i]); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n" - << label << " = " << buf ); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n" + << label << " = " << buf, this->Quiet ); if ( this->LogFile ) { *this->LogFile << "\n" << *i << " = " @@ -723,7 +724,7 @@ void cmCTestTestHandler::PrintLabelSummary() { *this->LogFile << "\n"; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n", this->Quiet); } } @@ -1063,6 +1064,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, parallel->SetCTest(this->CTest); parallel->SetParallelLevel(this->CTest->GetParallelLevel()); parallel->SetTestHandler(this); + parallel->SetQuiet(this->Quiet); *this->LogFile << "Start testing: " << this->CTest->CurrentTime() << std::endl @@ -1334,8 +1336,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector& vec) for ( it = vec.begin(); it != vec.end(); ++it ) { int retVal = 0; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << + *it << std::endl, this->Quiet); if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, cmSystemTools::OUTPUT_MERGE /*this->Verbose*/) || retVal != 0 ) @@ -1541,8 +1543,7 @@ std::string cmCTestTestHandler for(std::vector::iterator i = failed.begin(); i != failed.end(); ++i) { - cmCTestLog(ctest, HANDLER_OUTPUT, - i->c_str() << "\n"); + cmCTestLog(ctest, HANDLER_OUTPUT, i->c_str() << "\n"); } } @@ -1571,8 +1572,8 @@ void cmCTestTestHandler::GetListOfTests() { this->ExcludeTestsRegularExpression.compile(this->ExcludeRegExp.c_str()); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Constructing a list of tests" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Constructing a list of tests" << std::endl, this->Quiet); cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); @@ -1628,8 +1629,8 @@ void cmCTestTestHandler::GetListOfTests() { return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Done constructing a list of tests" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Done constructing a list of tests" << std::endl, this->Quiet); } //---------------------------------------------------------------------- @@ -2016,8 +2017,8 @@ std::string cmCTestTestHandler::GenerateRegressionImages( << ">File " << filename << " not found" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename - << "\" not found." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename + << "\" not found." << std::endl, this->Quiet); } cxml.erase(measurementfile.start(), measurementfile.end() - measurementfile.start()); @@ -2265,7 +2266,8 @@ bool cmCTestTestHandler::SetTestsProperties( bool cmCTestTestHandler::AddTest(const std::vector& args) { const std::string& testname = args[0]; - cmCTestLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl, + this->Quiet); if (this->UseExcludeRegExpFlag && this->UseExcludeRegExpFirst && @@ -2288,8 +2290,8 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } if ( found ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Ignore memcheck: " << *it << std::endl, this->Quiet); return true; } } @@ -2308,8 +2310,8 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } if ( found ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: " + << *it << std::endl, this->Quiet); return true; } } @@ -2318,8 +2320,8 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) test.Name = testname; test.Args = args; test.Directory = cmSystemTools::GetCurrentWorkingDirectory(); - cmCTestLog(this->CTest, DEBUG, "Set test directory: " - << test.Directory << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Set test directory: " + << test.Directory << std::endl, this->Quiet); test.IsInBasedOnREOptions = true; test.WillFail = false; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9bce7a3ed..486120239 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -133,6 +133,7 @@ add_RunCMake_test(ctest_build) add_RunCMake_test(ctest_configure) add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) +add_RunCMake_test(ctest_test) add_RunCMake_test(file) add_RunCMake_test(find_library) add_RunCMake_test(find_package) diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in new file mode 100644 index 000000000..cedf37987 --- /dev/null +++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestTest@CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_test/CTestConfig.cmake.in b/Tests/RunCMake/ctest_test/CTestConfig.cmake.in new file mode 100644 index 000000000..90044198e --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestTest@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake new file mode 100644 index 000000000..d906290e0 --- /dev/null +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCTest) + +set(CASE_CTEST_TEST_ARGS "") + +function(run_ctest_test CASE_NAME) + set(CASE_CTEST_TEST_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_test(TestQuiet QUIET) diff --git a/Tests/RunCMake/ctest_test/TestQuiet-stdout.txt b/Tests/RunCMake/ctest_test/TestQuiet-stdout.txt new file mode 100644 index 000000000..14613c565 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestQuiet-stdout.txt @@ -0,0 +1,2 @@ + 0 Compiler warnings + Start 1: RunCMakeVersion diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in new file mode 100644 index 000000000..1350abe00 --- /dev/null +++ b/Tests/RunCMake/ctest_test/test.cmake.in @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +set(ctest_test_args "@CASE_CTEST_TEST_ARGS@") +ctest_start(Experimental) +ctest_configure() +ctest_build() +ctest_test(${ctest_test_args}) From fc58bdb9ad90ddd41c5336bc1ab2e35fa0f74d41 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 15:57:26 -0500 Subject: [PATCH 0202/1029] ctest_coverage: Add QUIET option --- Help/command/ctest_coverage.rst | 5 + Modules/CTestCoverageCollectGCOV.cmake | 25 +- Source/CTest/cmCTestCoverageCommand.cxx | 5 +- Source/CTest/cmCTestCoverageHandler.cxx | 372 +++++++++--------- Source/CTest/cmCTestCoverageHandler.h | 3 +- Source/CTest/cmParseBlanketJSCoverage.cxx | 12 +- Source/CTest/cmParseCacheCoverage.cxx | 4 +- Source/CTest/cmParseCoberturaCoverage.cxx | 15 +- Source/CTest/cmParseDelphiCoverage.cxx | 19 +- Source/CTest/cmParseJacocoCoverage.cxx | 9 +- Tests/RunCMake/CMakeLists.txt | 3 + .../RunCMake/ctest_coverage/CMakeLists.txt.in | 4 + .../ctest_coverage/CTestConfig.cmake.in | 1 + .../ctest_coverage/CoverageQuiet-stdout.txt | 1 + .../ctest_coverage/RunCMakeTest.cmake | 10 + Tests/RunCMake/ctest_coverage/test.cmake.in | 18 + 16 files changed, 290 insertions(+), 216 deletions(-) create mode 100644 Tests/RunCMake/ctest_coverage/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_coverage/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_coverage/CoverageQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_coverage/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_coverage/test.cmake.in diff --git a/Help/command/ctest_coverage.rst b/Help/command/ctest_coverage.rst index 4c90f9c01..bac5c1c9a 100644 --- a/Help/command/ctest_coverage.rst +++ b/Help/command/ctest_coverage.rst @@ -18,3 +18,8 @@ files labeled with at least one of the labels specified. The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. + +The QUIET option suppresses any CTest-specific non-error output +that would have been printed to the console otherwise. The summary +indicating how many lines of code were covered is unaffected by this +option. diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index a607c529a..4519627e3 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -45,6 +45,10 @@ # Specify options to be passed to gcov. The ``gcov`` command # is run as ``gcov ... -o .gcda``. # If not specified, the default option is just ``-b``. +# +# ``QUIET`` +# Suppress non-error messages that otherwise would have been +# printed out by this function. #============================================================================= # Copyright 2014-2015 Kitware, Inc. @@ -60,7 +64,7 @@ # License text for the above reference.) include(CMakeParseArguments) function(ctest_coverage_collect_gcov) - set(options "") + set(options QUIET) set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND) set(multiValueArgs GCOV_OPTIONS) cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}" @@ -106,8 +110,10 @@ function(ctest_coverage_collect_gcov) # return early if no coverage files were found list(LENGTH gcda_files len) if(len EQUAL 0) - message("ctest_coverage_collect_gcov: No .gcda files found, " - "ignoring coverage request.") + if (NOT GCOV_QUIET) + message("ctest_coverage_collect_gcov: No .gcda files found, " + "ignoring coverage request.") + endif() return() endif() # setup the dir for the coverage files @@ -130,7 +136,9 @@ function(ctest_coverage_collect_gcov) WORKING_DIRECTORY ${coverage_dir}) endforeach() if(NOT "${res}" EQUAL 0) - message(STATUS "Error running gcov: ${res} ${out}") + if (NOT GCOV_QUIET) + message(STATUS "Error running gcov: ${res} ${out}") + endif() endif() # create json file with project information file(WRITE ${coverage_dir}/data.json @@ -151,8 +159,15 @@ function(ctest_coverage_collect_gcov) ${coverage_dir}/data.json ${label_files} ") + + if (GCOV_QUIET) + set(tar_opts "cfj") + else() + set(tar_opts "cvfj") + endif() + execute_process(COMMAND - ${CMAKE_COMMAND} -E tar cvfj ${GCOV_TARBALL} + ${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL} "--mtime=1970-01-01 0:0:0 UTC" --files-from=${coverage_dir}/coverage_file_list.txt WORKING_DIRECTORY ${binary_dir}) diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index 41f016bb9..f1f935bab 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -24,9 +24,9 @@ cmCTestCoverageCommand::cmCTestCoverageCommand() cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() { this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CoverageCommand", "CTEST_COVERAGE_COMMAND"); + "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS"); + "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS", this->Quiet); cmCTestCoverageHandler* handler = static_cast( this->CTest->GetInitializedHandler("coverage")); if ( !handler ) @@ -41,6 +41,7 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() handler->SetLabelFilter(this->Labels); } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 1226d2274..790e488bf 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -176,8 +176,8 @@ bool cmCTestCoverageHandler::StartCoverageLogFile( { char covLogFilename[1024]; sprintf(covLogFilename, "CoverageLog-%d", logFileCount); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " - << covLogFilename << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " + << covLogFilename << std::endl, this->Quiet); if(!this->StartResultingXML(cmCTest::PartCoverage, covLogFilename, covLogFile)) { @@ -209,8 +209,8 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, this->CTest->EndXML(ostr); char covLogFilename[1024]; sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: " - << covLogFilename << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: " + << covLogFilename << std::endl, this->Quiet); ostr.Close(); } @@ -230,8 +230,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, { if ( sit->find(file) ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file - << " is excluded in CTestCustom.ctest" << std::endl;); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file + << " is excluded in CTestCustom.ctest" << std::endl;, this->Quiet); return false; } } @@ -272,8 +272,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if (!ndc.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc - << " so skip coverage of " << file << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc + << " so skip coverage of " << file << std::endl, this->Quiet); return false; } @@ -311,8 +311,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if (!ndc.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc - << " so skip coverage of: " << file << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc + << " so skip coverage of: " << file << std::endl, this->Quiet); return false; } // Ok, nothing in source tree, nothing in binary tree @@ -356,13 +356,15 @@ int cmCTestCoverageHandler::ProcessHandler() cmSystemTools::ConvertToUnixSlashes(sourceDir); cmSystemTools::ConvertToUnixSlashes(binaryDir); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "Performing coverage" << std::endl, this->Quiet); cmCTestCoverageHandlerContainer cont; cont.Error = error; cont.SourceDir = sourceDir; cont.BinaryDir = binaryDir; cont.OFS = &ofs; + cont.Quiet = this->Quiet; // setup the regex exclude stuff this->CustomCoverageExcludeRegex.clear(); @@ -442,9 +444,9 @@ int cmCTestCoverageHandler::ProcessHandler() if ( file_count == 0 ) { - cmCTestLog(this->CTest, WARNING, + cmCTestOptionalLog(this->CTest, WARNING, " Cannot find any coverage files. Ignoring Coverage request." - << std::endl); + << std::endl, this->Quiet); return error; } cmGeneratedFileStream covSumFile; @@ -476,10 +478,11 @@ int cmCTestCoverageHandler::ProcessHandler() long total_untested = 0; //std::string fullSourceDir = sourceDir + "/"; //std::string fullBinaryDir = binaryDir + "/"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Accumulating results (each . represents one file):" << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Accumulating results (each . represents one file):" << std::endl, + this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); std::vector errorsWhileAccumulating; @@ -488,14 +491,16 @@ int cmCTestCoverageHandler::ProcessHandler() fileIterator != cont.TotalCoverage.end(); ++fileIterator ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, + this->Quiet); file_count ++; if ( file_count % 50 == 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " processed: " + << file_count << " out of " - << cont.TotalCoverage.size() << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + << cont.TotalCoverage.size() << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } const std::string fullFileName = fileIterator->first; @@ -504,15 +509,15 @@ int cmCTestCoverageHandler::ProcessHandler() sourceDir.c_str(), binaryDir.c_str()); if ( !shouldIDoCoverage ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: " << fullFileName - << std::endl); + << std::endl, this->Quiet); continue; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Process file: " << fullFileName << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Process file: " << fullFileName << std::endl, this->Quiet); if ( !cmSystemTools::FileExists(fullFileName.c_str()) ) { @@ -556,8 +561,9 @@ int cmCTestCoverageHandler::ProcessHandler() cmCTestCoverageHandlerContainer::SingleFileCoverageVector::size_type cc; std::string line; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << fullFileName << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Actually performing coverage for: " << fullFileName << std::endl, + this->Quiet); for ( cc= 0; cc < fcov.size(); cc ++ ) { if ( !cmSystemTools::GetLineFromStream(ifs, line) && @@ -641,8 +647,8 @@ int cmCTestCoverageHandler::ProcessHandler() } int untested = 0; std::string line; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << *i << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Actually performing coverage for: " << *i << std::endl, this->Quiet); while (cmSystemTools::GetLineFromStream(ifs, line)) { covLogFile << "\t\t" @@ -736,8 +742,8 @@ int cmCTestCoverageHandler::ProcessHandler() //---------------------------------------------------------------------- void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Add coverage exclude regular expressions." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Add coverage exclude regular expressions." << std::endl, this->Quiet); this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE", this->CustomCoverageExclude); this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB", @@ -747,14 +753,14 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) it != this->CustomCoverageExclude.end(); ++ it ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Add coverage exclude: " << *it << std::endl, this->Quiet); } for ( it = this->ExtraCoverageGlobs.begin(); it != this->ExtraCoverageGlobs.end(); ++it) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Add coverage glob: " << *it << std::endl, this->Quiet); } } @@ -812,16 +818,16 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( if(cmSystemTools::FileExists(coverageXMLFile.c_str())) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cobertura XML file: " << coverageXMLFile - << std::endl); + << std::endl, this->Quiet); cov.ReadCoverageXML(coverageXMLFile.c_str()); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Cannot find Cobertura XML file: " << coverageXMLFile - << std::endl); + << std::endl, this->Quiet); } return static_cast(cont->TotalCoverage.size()); } @@ -836,33 +842,33 @@ int cmCTestCoverageHandler::HandleMumpsCoverage( "/gtm_coverage.mcov"; if(cmSystemTools::FileExists(coverageFile.c_str())) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cache Coverage: " << coverageFile - << std::endl); + << std::endl, this->Quiet); cov.ReadCoverageFile(coverageFile.c_str()); return static_cast(cont->TotalCoverage.size()); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Cannot find foobar GTM coverage file: " << coverageFile - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find GTM coverage file: " << coverageFile + << std::endl, this->Quiet); } cmParseCacheCoverage ccov(*cont, this->CTest); coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov"; if(cmSystemTools::FileExists(coverageFile.c_str())) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cache Coverage: " << coverageFile - << std::endl); + << std::endl, this->Quiet); ccov.ReadCoverageFile(coverageFile.c_str()); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find Cache coverage file: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast(cont->TotalCoverage.size()); } @@ -912,15 +918,15 @@ int cmCTestCoverageHandler::HandleJacocoCoverage( files=g.GetFiles(); if (!files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found Jacoco Files, Performing Coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found Jacoco Files, Performing Coverage" << std::endl, this->Quiet); cov.LoadCoverageData(files); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find Jacoco coverage files: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast(cont->TotalCoverage.size()); } @@ -945,15 +951,16 @@ int cmCTestCoverageHandler::HandleDelphiCoverage( files=g.GetFiles(); if (!files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found Delphi HTML Files, Performing Coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found Delphi HTML Files, Performing Coverage" << std::endl, + this->Quiet); cov.LoadCoverageData(files); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find Delphi coverage files: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast(cont->TotalCoverage.size()); } @@ -975,15 +982,16 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage( files=g.GetFiles(); if (!files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found BlanketJS output JSON, Performing Coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found BlanketJS output JSON, Performing Coverage" << std::endl, + this->Quiet); cov.LoadCoverageData(files); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find BlanketJS coverage files: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast(cont->TotalCoverage.size()); } @@ -1039,9 +1047,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if (files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any GCov coverage files." - << std::endl); + << std::endl, this->Quiet); // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1057,9 +1065,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::set missingFiles; std::string actualSourceFile = ""; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Processing coverage (each . represents one file):" << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Processing coverage (each . represents one file):" << std::endl, + this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); int file_count = 0; // make sure output from gcov is in English! @@ -1072,7 +1081,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // for ( it = files.begin(); it != files.end(); ++ it ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, + this->Quiet); // Call gcov to get coverage data for this *.gcda file: // @@ -1082,8 +1092,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "-o \"" + fileDir + "\" " + "\"" + *it + "\""; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() + << std::endl, this->Quiet); std::string output = ""; std::string errors = ""; @@ -1111,12 +1121,12 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "--------------------------------------------------------------" << std::endl << output << std::endl << "--------------------------------------------------------------" - << std::endl); + << std::endl, this->Quiet); std::vector lines; std::vector::iterator line; @@ -1128,8 +1138,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string sourceFile; std::string gcovFile; - cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]" - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Line: [" << *line << "]" + << std::endl, this->Quiet); if (line->empty()) { @@ -1229,8 +1239,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( break; } - cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1) - << " had unexpected EOF" << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "Warning: " << st2re4.match(1) + << " had unexpected EOF" << std::endl, this->Quiet); } else if ( st2re5.find(line->c_str() ) ) { @@ -1246,8 +1256,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( break; } - cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: " - << st2re5.match(1) << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "Warning: Cannot open file: " + << st2re5.match(1) << std::endl, this->Quiet); } else if ( st2re6.find(line->c_str() ) ) { @@ -1263,8 +1273,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage( break; } - cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1) - << " is newer than " << st2re6.match(2) << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "Warning: File: " + << st2re6.match(1) + << " is newer than " << st2re6.match(2) << std::endl, this->Quiet); } else { @@ -1291,8 +1302,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec = cont->TotalCoverage[actualSourceFile]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: " - << gcovFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " in gcovFile: " << gcovFile << std::endl, this->Quiet); cmsys::ifstream ifile(gcovFile.c_str()); if ( ! ifile ) @@ -1366,8 +1377,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // if ( IsFileInDir(sourceFile, cont->SourceDir) ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " - << sourceFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " produced s: " << sourceFile << std::endl, this->Quiet); *cont->OFS << " produced in source dir: " << sourceFile << std::endl; actualSourceFile @@ -1375,8 +1386,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } else if ( IsFileInDir(sourceFile, cont->BinaryDir) ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: " - << sourceFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " produced b: " << sourceFile << std::endl, this->Quiet); *cont->OFS << " produced in binary dir: " << sourceFile << std::endl; actualSourceFile @@ -1387,19 +1398,19 @@ int cmCTestCoverageHandler::HandleGCovCoverage( { if ( missingFiles.find(sourceFile) == missingFiles.end() ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Something went wrong" << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Something went wrong" << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Cannot find file: [" - << sourceFile << "]" << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + << sourceFile << "]" << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in source dir: [" << cont->SourceDir << "]" - << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " or binary dir: [" << cont->BinaryDir.size() << "]" - << std::endl); + << std::endl, this->Quiet); *cont->OFS << " Something went wrong. Cannot find file: " << sourceFile << " in source dir: " << cont->SourceDir @@ -1415,9 +1426,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if ( file_count % 50 == 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count - << " out of " << files.size() << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " processed: " + << file_count + << " out of " << files.size() << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } } @@ -1435,22 +1447,22 @@ int cmCTestCoverageHandler::HandleLCovCoverage( = this->CTest->GetCTestConfiguration("CoverageExtraFlags"); if ( lcovCommand != "codecov" ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Not a valid Intel Coverage command." - << std::endl); + << std::endl, this->Quiet); return 0; } // There is only percentage completed output from LCOV std::string st2lcovOutputRex3 = "[0-9]+%"; cmsys::RegularExpression st2re3(st2lcovOutputRex3.c_str()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " This is coverage command: " << lcovCommand - << std::endl); + << std::endl, this->Quiet); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " These are coverage command flags: " << lcovExtraFlags - << std::endl); + << std::endl, this->Quiet); std::vector files; this->FindLCovFiles(files); @@ -1458,9 +1470,9 @@ int cmCTestCoverageHandler::HandleLCovCoverage( if (files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any LCov coverage files." - << std::endl); + << std::endl, this->Quiet); // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1471,9 +1483,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage( std::set missingFiles; std::string actualSourceFile = ""; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Processing coverage (each . represents one file):" << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Processing coverage (each . represents one file):" << std::endl, + this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); int file_count = 0; // make sure output from lcov is in English! @@ -1484,16 +1497,17 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // directory. It collects all *.dyn files to generate .dpi file. for ( it = files.begin(); it != files.end(); ++ it ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, + this->Quiet); std::string fileDir = cmSystemTools::GetFilenamePath(*it); cmSystemTools::ChangeDirectory(fileDir); std::string command = "\"" + lcovCommand + "\" " + lcovExtraFlags + " "; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: " - << fileDir << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Current coverage dir: " << fileDir << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() + << std::endl, this->Quiet); std::string output = ""; std::string errors = ""; @@ -1521,12 +1535,12 @@ int cmCTestCoverageHandler::HandleLCovCoverage( cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "--------------------------------------------------------------" << std::endl << output << std::endl << "--------------------------------------------------------------" - << std::endl); + << std::endl, this->Quiet); std::vector lines; std::vector::iterator line; @@ -1554,8 +1568,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( std::string daGlob; daGlob = dir; daGlob += "/*.LCOV"; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " looking for LCOV files in: " << daGlob << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " looking for LCOV files in: " << daGlob << std::endl, this->Quiet); gl.FindFiles(daGlob); // Keep a list of all LCOV files lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(), @@ -1590,13 +1604,13 @@ int cmCTestCoverageHandler::HandleLCovCoverage( for(std::vector::iterator t = lcovFiles.begin(); t != lcovFiles.end(); ++t) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found LCOV File: " - << *t << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found LCOV File: " << *t << std::endl, this->Quiet); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: " - << sourceFile << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: " - << lcovFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: " + << sourceFile << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: " + << lcovFile << std::endl, this->Quiet); // If we have some LCOV files to process if ( !lcovFile.empty() && !actualSourceFile.empty() ) @@ -1604,8 +1618,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec = cont->TotalCoverage[actualSourceFile]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in lcovFile: " - << lcovFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " in lcovFile: " << lcovFile << std::endl, this->Quiet); cmsys::ifstream ifile(lcovFile.c_str()); if ( ! ifile ) @@ -1620,8 +1634,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // Skip the first line cmSystemTools::GetLineFromStream(ifile, nl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "File is ready, start reading." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "File is ready, start reading." << std::endl, this->Quiet); while ( cmSystemTools::GetLineFromStream(ifile, nl) ) { cnt ++; @@ -1679,9 +1693,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage( if ( file_count % 50 == 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count - << " out of " << files.size() << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " processed: " << file_count << " out of " << files.size() + << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } } @@ -1707,8 +1722,8 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector& files) // Coverage files appear next to their object files in the target // support directory. - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " globbing for coverage in: " << lmi->first << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " globbing for coverage in: " << lmi->first << std::endl, this->Quiet); std::string daGlob = lmi->first; daGlob += "/*.da"; gl.FindFiles(daGlob); @@ -1740,12 +1755,12 @@ void cmCTestCoverageHandler::FindLCovFiles(std::vector& files) std::string daGlob; daGlob = prevBinaryDir; daGlob += "/*.dpi"; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " looking for dpi files in: " << daGlob << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " looking for dpi files in: " << daGlob << std::endl, this->Quiet); gl.FindFiles(daGlob); files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Now searching in: " << daGlob << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Now searching in: " << daGlob << std::endl, this->Quiet); } //---------------------------------------------------------------------- @@ -1761,9 +1776,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( if (files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any Python Trace.py coverage files." - << std::endl); + << std::endl, this->Quiet); // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1791,13 +1806,13 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( std::string actualSourceFile = cmSystemTools::CollapseFullPath(fileName); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Check coverage for file: " << actualSourceFile - << std::endl); + << std::endl, this->Quiet); cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec = &cont->TotalCoverage[actualSourceFile]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " in file: " << *fileIt << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " in file: " << *fileIt << std::endl, this->Quiet); cmsys::ifstream ifile(fileIt->c_str()); if ( ! ifile ) { @@ -1850,9 +1865,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( // So, this will be set to 0. cov = 0; } - cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix + cmCTestOptionalLog(this->CTest, DEBUG, "Prefix: " << prefix << " cov: " << cov - << std::endl); + << std::endl, this->Quiet); // Read the line number starting at the 10th character of the gcov // output line long lineIdx = cnt; @@ -1945,18 +1960,16 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( // for each file run covbr on that file to get the coverage // information for that file std::string outputFile; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "run covbr: " - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "run covbr: " << std::endl, this->Quiet); if(!this->RunBullseyeCommand(cont, "covbr", 0, outputFile)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n"); return -1; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "covbr output in " << outputFile - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "covbr output in " << outputFile << std::endl, this->Quiet); // open the output file cmsys::ifstream fin(outputFile.c_str()); if(!fin) @@ -2002,10 +2015,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( // only allow 100 files in each log file if ( count != 0 && count % 100 == 0 ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "start a new log file: " - << count - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "start a new log file: " << count << std::endl, this->Quiet); this->EndCoverageLogFile(covLogFile, logFileCount); logFileCount ++; if ( !this->StartCoverageLogFile(covLogFile, logFileCount) ) @@ -2021,10 +2032,9 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( { // we have a new file so count it in the output count++; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Produce coverage for file: " - << file << " " << count - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Produce coverage for file: " << file << " " << count + << std::endl, this->Quiet); // start the file output covLogFile << "\tfirst) @@ -2083,13 +2093,13 @@ int cmCTestCoverageHandler::RunBullseyeCommand( } if(arg) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program << " " << arg << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Run : " << program << " " << arg << "\n", this->Quiet); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Run : " << program << "\n", this->Quiet); } // create a process object and start it cmCTestRunProcess runCoverageSrc; @@ -2215,17 +2225,17 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( cont->BinaryDir.c_str()); if ( !shouldIDoCoverage ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - ".NoDartCoverage found, so skip coverage check for: " - << file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + ".NoDartCoverage found, so skip coverage check for: " + << file + << std::endl, this->Quiet); continue; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Doing coverage for: " - << file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Doing coverage for: " + << file + << std::endl, this->Quiet); coveredFiles.push_back(sourceFile); coveredFilesFullPath.push_back(file); @@ -2328,23 +2338,23 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage( const char* covfile = cmSystemTools::GetEnv("COVFILE"); if(!covfile || strlen(covfile) == 0) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " COVFILE environment variable not found, not running " - " bullseye\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " COVFILE environment variable not found, not running " + " bullseye\n", this->Quiet); return 0; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " run covsrc with COVFILE=[" - << covfile - << "]" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " run covsrc with COVFILE=[" + << covfile + << "]" << std::endl, this->Quiet); if(!this->RunBullseyeSourceSummary(cont)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error running bullseye summary.\n"); return 0; } - cmCTestLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 " - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 " + << std::endl, this->Quiet); return 1; } @@ -2438,8 +2448,8 @@ void cmCTestCoverageHandler::LoadLabels() std::string fileList = this->CTest->GetBinaryDir(); fileList += cmake::GetCMakeFilesDirectory(); fileList += "/TargetDirectories.txt"; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " target directory list [" << fileList << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " target directory list [" << fileList << "]\n", this->Quiet); cmsys::ifstream finList(fileList.c_str()); std::string line; while(cmSystemTools::GetLineFromStream(finList, line)) @@ -2460,8 +2470,8 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir) return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " loading labels from [" << fname << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " loading labels from [" << fname << "]\n", this->Quiet); bool inTarget = true; std::string source; std::string line; diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 4aec79557..3258ddbe6 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -30,9 +30,10 @@ public: typedef std::map TotalCoverageMap; TotalCoverageMap TotalCoverage; std::ostream* OFS; + bool Quiet; }; /** \class cmCTestCoverageHandler - * \brief A class that handles coverage computaiton for ctest + * \brief A class that handles coverage computation for ctest * */ class cmCTestCoverageHandler : public cmCTestGenericHandler diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index 85d066b79..1edd01f48 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -138,12 +138,12 @@ bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector files) { size_t i=0; std::string path; - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Found " << files.size() <<" Files" << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Found " << files.size() <<" Files" << std::endl, this->Coverage.Quiet); for(i=0;iCTest,HANDLER_VERBOSE_OUTPUT, - "Reading JSON File " << files[i] << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading JSON File " << files[i] << std::endl, this->Coverage.Quiet); if(!this->ReadJSONFile(files[i])) { @@ -157,8 +157,8 @@ bool cmParseBlanketJSCoverage::ReadJSONFile(std::string file) { cmParseBlanketJSCoverage::JSONParser parser (this->Coverage); - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Parsing " << file << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Parsing " << file << std::endl, this->Coverage.Quiet); parser.ParseFile(file); return true; } diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index 3642308c9..92bf88eaf 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -71,9 +71,9 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles() } if(nothing) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "No coverage found in: " << ci->first - << std::endl); + << std::endl, this->Coverage.Quiet); this->Coverage.TotalCoverage.erase(ci++); } else diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index e19b1993d..3ed5cb0f9 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -50,8 +50,8 @@ protected: if (this->InSources && this->InSource) { this->FilePaths.push_back(tmp); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Adding Source: " - << tmp << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Adding Source: " << tmp << std::endl, this->Coverage.Quiet); } } @@ -74,8 +74,9 @@ protected: { if(strcmp(atts[tagCount], "filename") == 0) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: " - << atts[tagCount+1]<< std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Reading file: " << atts[tagCount+1]<< std::endl, + this->Coverage.Quiet); std::string filename = atts[tagCount+1]; this->CurFileName = ""; @@ -113,9 +114,9 @@ protected: fin.open(this->CurFileName.c_str()); if (!fin) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Skipping system file " << filename << - std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Skipping system file " << filename << std::endl, + this->Coverage.Quiet); this->SkipThisClass = true; break; diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 4dfdfac0a..e453fe167 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -122,8 +122,9 @@ public: lastoffset = line.find('(',pos); if(lastoffset==line.npos) { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - endnamepos << "File not found " << lastoffset << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + endnamepos << "File not found " << lastoffset << std::endl, + this->Coverage.Quiet); return false; } endnamepos = line.find(')',lastoffset); @@ -131,8 +132,9 @@ public: (endnamepos-1)-lastoffset); if(filename.find(".pas") != filename.npos) { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Coverage found for file: " << filename << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Coverage found for file: " << filename << std::endl, + this->Coverage.Quiet); break; } pos = lastoffset+1; @@ -153,8 +155,9 @@ public: * If that doesn't find any matching files * return a failure. */ - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Unable to find file matching" << glob << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Unable to find file matching" << glob << std::endl, + this->Coverage.Quiet); return false; } FileLinesType& coverageVector = @@ -229,8 +232,8 @@ bool cmParseDelphiCoverage::LoadCoverageData( { path = files[i]; - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Reading HTML File " << path << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading HTML File " << path << std::endl, this->Coverage.Quiet); if(cmSystemTools::GetFilenameLastExtension(path) == ".html") { if(!this->ReadDelphiHTML(path.c_str())) diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 780debc1e..ec4cfadd6 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -49,8 +49,9 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser else if(name == "sourcefile") { this->FileName = atts[1]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: " - << this->FileName << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Reading file: " << this->FileName << std::endl, + this->Coverage.Quiet); for(size_t i=0;i < FilePaths.size();i++) { std::string finalpath = FilePaths[i] + "/" + this->FileName; @@ -148,8 +149,8 @@ bool cmParseJacocoCoverage::LoadCoverageData( { path = files[i]; - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Reading XML File " << path << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading XML File " << path << std::endl, this->Coverage.Quiet); if(cmSystemTools::GetFilenameLastExtension(path) == ".xml") { if(!this->ReadJacocoXML(path.c_str())) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 486120239..83a88ad62 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -131,6 +131,9 @@ add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(continue) add_RunCMake_test(ctest_build) add_RunCMake_test(ctest_configure) +if(COVERAGE_COMMAND) + add_RunCMake_test(ctest_coverage -DCOVERAGE_COMMAND=${COVERAGE_COMMAND}) +endif() add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) add_RunCMake_test(ctest_test) diff --git a/Tests/RunCMake/ctest_coverage/CMakeLists.txt.in b/Tests/RunCMake/ctest_coverage/CMakeLists.txt.in new file mode 100644 index 000000000..1babd72d9 --- /dev/null +++ b/Tests/RunCMake/ctest_coverage/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestCoverage@CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_coverage/CTestConfig.cmake.in b/Tests/RunCMake/ctest_coverage/CTestConfig.cmake.in new file mode 100644 index 000000000..1f679d5d0 --- /dev/null +++ b/Tests/RunCMake/ctest_coverage/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestCoverage@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_coverage/CoverageQuiet-stdout.txt b/Tests/RunCMake/ctest_coverage/CoverageQuiet-stdout.txt new file mode 100644 index 000000000..3b09eac96 --- /dev/null +++ b/Tests/RunCMake/ctest_coverage/CoverageQuiet-stdout.txt @@ -0,0 +1 @@ +sec$ diff --git a/Tests/RunCMake/ctest_coverage/RunCMakeTest.cmake b/Tests/RunCMake/ctest_coverage/RunCMakeTest.cmake new file mode 100644 index 000000000..dd443fc49 --- /dev/null +++ b/Tests/RunCMake/ctest_coverage/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCTest) + +set(CASE_CTEST_COVERAGE_ARGS "") + +function(run_ctest_coverage CASE_NAME) + set(CASE_CTEST_COVERAGE_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_coverage(CoverageQuiet QUIET) diff --git a/Tests/RunCMake/ctest_coverage/test.cmake.in b/Tests/RunCMake/ctest_coverage/test.cmake.in new file mode 100644 index 000000000..1788e6647 --- /dev/null +++ b/Tests/RunCMake/ctest_coverage/test.cmake.in @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.1) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") + +set(ctest_coverage_args "@CASE_CTEST_COVERAGE_ARGS@") +ctest_start(Experimental) +ctest_configure() +ctest_build() +ctest_test() +ctest_coverage(${ctest_coverage_args}) From 0b87b2a33902ac000a0073a1def887599c69809d Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 17:15:00 -0500 Subject: [PATCH 0203/1029] ctest_memcheck: Add QUIET option --- Help/command/ctest_memcheck.rst | 4 + Source/CTest/cmCTestMemCheckCommand.cxx | 14 ++-- Source/CTest/cmCTestMemCheckHandler.cxx | 77 ++++++++++--------- Source/CTest/cmCTestRunTest.cxx | 14 ++-- .../ctest_memcheck/DummyQuiet-stdout.txt | 1 + .../ctest_memcheck/RunCMakeTest.cmake | 1 + Tests/RunCMake/ctest_memcheck/test.cmake.in | 2 +- 7 files changed, 65 insertions(+), 48 deletions(-) create mode 100644 Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst index ca47ed047..56a249008 100644 --- a/Help/command/ctest_memcheck.rst +++ b/Help/command/ctest_memcheck.rst @@ -26,3 +26,7 @@ the number of tests to be run in parallel. The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. + +The QUIET option suppresses any CTest-specific non-error messages +that would have otherwise been printed to the console. Output from +the underlying tests are not affected. diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index f1440668b..b379d32af 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -21,16 +21,20 @@ cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() = this->CTest->GetInitializedHandler("memcheck"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE"); + "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS"); + "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS", + this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND"); + "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS"); + "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS", + this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE"); + "MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", + this->Quiet); + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index d4ff24fba..061f3fd6b 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -251,8 +251,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand( memcheckcommand += " " + memTesterEnvironmentVariable; args.push_back(memTesterEnvironmentVariable); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " - << memcheckcommand << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Memory check command: " << memcheckcommand << std::endl, this->Quiet); } //---------------------------------------------------------------------- @@ -347,7 +347,8 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); std::string cmake = cmSystemTools::GetCMakeCommand(); - this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str()); + this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str(), + this->Quiet); } //---------------------------------------------------------------------- @@ -400,8 +401,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) << "" << std::endl; } os << "\t\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - "-- Processing memory checking output: "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "-- Processing memory checking output: ", this->Quiet); size_t total = this->TestResults.size(); size_t step = total / 10; size_t current = 0; @@ -451,13 +452,14 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) this->WriteTestResultFooter(os, result); if ( current < cc ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush, + this->Quiet); current += step; } } - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" + << std::endl, this->Quiet); os << "\t" << std::endl; for ( cc = 0; cc < this->GlobalResults.size(); cc ++ ) { @@ -468,9 +470,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) #endif std::cerr.width(35); #define cerr no_cerr - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->ResultStringsLong[cc] << " - " - << this->GlobalResults[cc] << std::endl); + << this->GlobalResults[cc] << std::endl, this->Quiet); os << "\t\tResultStringsLong[cc] << "\"/>" << std::endl; } @@ -594,10 +596,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } if(this->MemoryTester.empty()) { - cmCTestLog(this->CTest, WARNING, + cmCTestOptionalLog(this->CTest, WARNING, "Memory checker (MemoryCheckCommand) " "not set, or cannot find the specified program." - << std::endl); + << std::endl, this->Quiet); return false; } @@ -981,17 +983,18 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( "locked by a different thread"); std::vector nonValGrindOutput; double sttime = cmSystemTools::GetTime(); - cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Start test: " << lines.size() << std::endl, this->Quiet); std::string::size_type totalOutputSize = 0; for ( cc = 0; cc < lines.size(); cc ++ ) { - cmCTestLog(this->CTest, DEBUG, "test line " - << lines[cc] << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "test line " + << lines[cc] << std::endl, this->Quiet); if ( valgrindLine.find(lines[cc]) ) { - cmCTestLog(this->CTest, DEBUG, "valgrind line " - << lines[cc] << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "valgrind line " + << lines[cc] << std::endl, this->Quiet); int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; if ( vgFIM.find(lines[cc]) ) { @@ -1075,10 +1078,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i) { totalOutputSize += lines[*i].size(); - cmCTestLog(this->CTest, DEBUG, "before xml safe " - << lines[*i] << std::endl); - cmCTestLog(this->CTest, DEBUG, "after xml safe " - << cmXMLSafe(lines[*i]) << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "before xml safe " + << lines[*i] << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, DEBUG, "after xml safe " + << cmXMLSafe(lines[*i]) << std::endl, this->Quiet); ostr << cmXMLSafe(lines[*i]) << std::endl; if(!unlimitedOutput && totalOutputSize > static_cast(this->CustomMaximumFailedTestOutputSize)) @@ -1091,8 +1094,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( break; // stop the copy of output if we are full } } - cmCTestLog(this->CTest, DEBUG, "End test (elapsed: " - << (cmSystemTools::GetTime() - sttime) << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: " + << (cmSystemTools::GetTime() - sttime) << std::endl, this->Quiet); log = ostr.str(); if ( defects ) { @@ -1112,7 +1115,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( double sttime = cmSystemTools::GetTime(); std::vector lines; cmSystemTools::Split(str.c_str(), lines); - cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Start test: " << lines.size() << std::endl, this->Quiet); std::vector::size_type cc; for ( cc = 0; cc < lines.size(); cc ++ ) { @@ -1148,8 +1152,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( results[parser.Errors[cc]]++; defects++; } - cmCTestLog(this->CTest, DEBUG, "End test (elapsed: " - << (cmSystemTools::GetTime() - sttime) << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: " + << (cmSystemTools::GetTime() - sttime) << std::endl, this->Quiet); if(defects) { // only put the output of Bounds Checker if there were @@ -1165,9 +1169,9 @@ void cmCTestMemCheckHandler::PostProcessTest(cmCTestTestResult& res, int test) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessTest memcheck results for : " - << res.Name << std::endl); + << res.Name << std::endl, this->Quiet); if(this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER) { @@ -1192,9 +1196,9 @@ void cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, int test) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " - << res.Name << std::endl); + << res.Name << std::endl, this->Quiet); std::vector files; this->TestOutputFileNames(test, files); if (files.empty()) @@ -1226,11 +1230,11 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, } cmSystemTools::Delay(1000); cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerDPBDFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " + << this->BoundsCheckerDPBDFile << std::endl, this->Quiet); cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerXMLFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " + << this->BoundsCheckerXMLFile << std::endl, this->Quiet); } void @@ -1260,7 +1264,8 @@ cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, if(this->LogWithPID) { cmSystemTools::RemoveFile(ofile); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: "<< ofile <<"\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Remove: "<< ofile <<"\n", this->Quiet); } } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 314c8ad61..03131fd74 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -386,10 +386,11 @@ void cmCTestRunTest::MemCheckPostProcess() { return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index - << ": process test output now: " - << this->TestProperties->Name << " " - << this->TestResult.Name << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index + << ": process test output now: " + << this->TestProperties->Name << " " + << this->TestResult.Name << std::endl, + this->TestHandler->GetQuiet()); cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); handler->PostProcessTest(this->TestResult, this->Index); @@ -661,8 +662,9 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, { timeout = 0; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " - << "Test timeout computed to be: " << timeout << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " + << "Test timeout computed to be: " << timeout << "\n", + this->TestHandler->GetQuiet()); this->TestProcess->SetTimeout(timeout); diff --git a/Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt new file mode 100644 index 000000000..58f55a5a7 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt @@ -0,0 +1 @@ +0 tests failed out of 1$ diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index b1793fa44..6c96a265b 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -130,3 +130,4 @@ run_mc_test(DummyValgrindNoLogFile "${PSEUDO_VALGRIND_NOLOG}") run_mc_test(DummyBCNoLogFile "${PSEUDO_BC_NOLOG}") run_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") run_mc_test(Unknown "\${CMAKE_COMMAND}") +run_mc_test(DummyQuiet "${PSEUDO_VALGRIND}" -DMEMCHECK_ARGS=QUIET) diff --git a/Tests/RunCMake/ctest_memcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in index f9c1ba99d..8431fa693 100644 --- a/Tests/RunCMake/ctest_memcheck/test.cmake.in +++ b/Tests/RunCMake/ctest_memcheck/test.cmake.in @@ -21,4 +21,4 @@ set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res ${MEMCHECK_ARGS}) From ff1ddd2a73dd04e3015c2bc4ffe345f8c6ca02ee Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Wed, 18 Feb 2015 09:15:29 -0500 Subject: [PATCH 0204/1029] ctest_upload: Add QUIET option --- Help/command/ctest_upload.rst | 5 ++++- Source/CTest/cmCTestUploadCommand.cxx | 7 +++++++ Source/CTest/cmCTestUploadHandler.cxx | 4 ++-- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/ctest_upload/CMakeLists.txt.in | 4 ++++ Tests/RunCMake/ctest_upload/CTestConfig.cmake.in | 1 + Tests/RunCMake/ctest_upload/RunCMakeTest.cmake | 10 ++++++++++ Tests/RunCMake/ctest_upload/UploadQuiet-stdout.txt | 1 + Tests/RunCMake/ctest_upload/test.cmake.in | 14 ++++++++++++++ 9 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/ctest_upload/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_upload/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_upload/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_upload/UploadQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_upload/test.cmake.in diff --git a/Help/command/ctest_upload.rst b/Help/command/ctest_upload.rst index 9156af56b..fcd9fe4e0 100644 --- a/Help/command/ctest_upload.rst +++ b/Help/command/ctest_upload.rst @@ -5,7 +5,10 @@ Upload files to a dashboard server. :: - ctest_upload(FILES ...) + ctest_upload(FILES ... [QUIET]) Pass a list of files to be sent along with the build results to the dashboard server. + +The QUIET option suppresses any CTest-specific non-error output +that would have been printed to the console otherwise. diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 5613751f4..f5000dd4c 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -26,6 +26,7 @@ cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() } static_cast(handler)->SetFiles(this->Files); + handler->SetQuiet(this->Quiet); return handler; } @@ -38,6 +39,12 @@ bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg) this->ArgumentDoing = ArgumentDoingFiles; return true; } + if(arg == "QUIET") + { + this->ArgumentDoing = ArgumentDoingNone; + this->Quiet = true; + return true; + } return false; } diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index e33c3871a..579190a2a 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -64,8 +64,8 @@ int cmCTestUploadHandler::ProcessHandler() for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) { - cmCTestLog(this->CTest, OUTPUT, - "\tUpload file: " << *it << std::endl); + cmCTestOptionalLog(this->CTest, OUTPUT, + "\tUpload file: " << *it << std::endl, this->Quiet); ofs << "\n" << "\n"; ofs << this->CTest->Base64EncodeFile(*it); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 83a88ad62..f654dbc25 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -137,6 +137,7 @@ endif() add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) add_RunCMake_test(ctest_test) +add_RunCMake_test(ctest_upload) add_RunCMake_test(file) add_RunCMake_test(find_library) add_RunCMake_test(find_package) diff --git a/Tests/RunCMake/ctest_upload/CMakeLists.txt.in b/Tests/RunCMake/ctest_upload/CMakeLists.txt.in new file mode 100644 index 000000000..1fab71be5 --- /dev/null +++ b/Tests/RunCMake/ctest_upload/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestUpload@CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_upload/CTestConfig.cmake.in b/Tests/RunCMake/ctest_upload/CTestConfig.cmake.in new file mode 100644 index 000000000..52665a8b8 --- /dev/null +++ b/Tests/RunCMake/ctest_upload/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestUpload@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_upload/RunCMakeTest.cmake b/Tests/RunCMake/ctest_upload/RunCMakeTest.cmake new file mode 100644 index 000000000..b33d2781e --- /dev/null +++ b/Tests/RunCMake/ctest_upload/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCTest) + +set(CASE_CTEST_UPLOAD_ARGS "") + +function(run_ctest_upload CASE_NAME) + set(CASE_CTEST_UPLOAD_ARGS "${ARGN}") + run_ctest(${CASE_NAME}) +endfunction() + +run_ctest_upload(UploadQuiet QUIET) diff --git a/Tests/RunCMake/ctest_upload/UploadQuiet-stdout.txt b/Tests/RunCMake/ctest_upload/UploadQuiet-stdout.txt new file mode 100644 index 000000000..20e13b820 --- /dev/null +++ b/Tests/RunCMake/ctest_upload/UploadQuiet-stdout.txt @@ -0,0 +1 @@ +Use Experimental tag: [0-9-]+$ diff --git a/Tests/RunCMake/ctest_upload/test.cmake.in b/Tests/RunCMake/ctest_upload/test.cmake.in new file mode 100644 index 000000000..f13bdd11d --- /dev/null +++ b/Tests/RunCMake/ctest_upload/test.cmake.in @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +set(ctest_upload_args "@CASE_CTEST_UPLOAD_ARGS@") +ctest_start(Experimental) +ctest_upload(FILES "${CTEST_SOURCE_DIRECTORY}/CMakeLists.txt" ${ctest_upload_args}) From 8c0474cd2c0b3ad589950bc60d9af22f26111717 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 23 Feb 2015 00:43:09 +0100 Subject: [PATCH 0205/1029] CPackRPM: run tests on more platforms than just Linux Lift the restriction that limits use of CPackRPM tests to Linux OS only because RPM can also be used on e.g. AIX which is Unix OS. --- Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cb45e79d3..4d3aeafd2 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -104,7 +104,7 @@ if(BUILD_TESTING) # Look for rpmbuild to use for tests. # The tool does not work with spaces in the path. - if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") + if(NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild) else() set(RPMBUILD_EXECUTABLE "RPMBUILD_EXECUTABLE-NOTFOUND") From 761562fea6a987bb898f5a349993cf5765dedbea Mon Sep 17 00:00:00 2001 From: Joshua A Clayton Date: Thu, 19 Feb 2015 00:01:14 -0800 Subject: [PATCH 0206/1029] CPackRPM: Fix CPACK_RPM_PACKAGE_ARCHITECTURE BuildArch must only be added to a spec file for a "noarch" package or rpmbuild will fail. For all others, the --target argument sets the package architecture. In the process of Fixing rpm architecture, we make it mandatory, adding a default value of native architecture (the same as if no --target argument is present). Update the documentation at the top of the file to make it mandatory. --- Modules/CPackRPM.cmake | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 75163932f..932e17412 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -54,8 +54,8 @@ # # The RPM package architecture. # -# * Mandatory : NO -# * Default : - +# * Mandatory : YES +# * Default : Native architecture output by "uname -m" # # This may be set to "noarch" if you know you are building a noarch package. # @@ -619,12 +619,20 @@ endif() # RPM "Version" from RPM "Release" string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) -# CPACK_RPM_PACKAGE_ARCHITECTURE (optional) -if(CPACK_RPM_PACKAGE_ARCHITECTURE) - set(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}") +# CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory) +if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) + execute_process(COMMAND uname "-m" + OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE) +else() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") endif() +endif() + +set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) +if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") + set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") else() set(TMP_RPM_BUILDARCH "") endif() @@ -934,7 +942,7 @@ file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) -#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") +#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") # it seems rpmbuild can't handle spaces in the path # neither escaping (as below) nor putting quotes around the path seem to help @@ -1282,6 +1290,7 @@ if(RPMBUILD_EXECUTABLE) COMMAND "${RPMBUILD_EXECUTABLE}" -bb --define "_topdir ${CPACK_RPM_DIRECTORY}" --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}" "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT From 3aa9f89dbb88d957a662effdbc284c95aef1a8a9 Mon Sep 17 00:00:00 2001 From: Joshua A Clayton Date: Thu, 19 Feb 2015 00:01:15 -0800 Subject: [PATCH 0207/1029] CPackRPM: Support rpm architecture in components CPACK_RPM__PACKAGE_ARCHITECTURE variable allows the same project to support packages of different architectures including noarch, native and foreign architectures. --- Modules/CPackRPM.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 932e17412..6ce18bfc2 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -51,6 +51,7 @@ # * Default : CPACK_PACKAGE_VERSION # # .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE +# CPACK_RPM__PACKAGE_ARCHITECTURE # # The RPM package architecture. # @@ -631,6 +632,16 @@ else() endif() set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) + +#prefer component architecture +if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE) + set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + endif() + endif() +endif() if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") else() From f174b919d65d8aefbe8dec26e2b31c7525805f8d Mon Sep 17 00:00:00 2001 From: Joshua A Clayton Date: Thu, 19 Feb 2015 00:01:16 -0800 Subject: [PATCH 0208/1029] Tests: CpackRPM test component architecture Test creating rpms of type "noarch", native, and "armv7hf" --- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 6 ++++++ Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index de0ee4695..4119b8dd8 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -11,6 +11,12 @@ if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + # test a "noarch" rpm + set(CPACK_RPM_headers_PACKAGE_ARCHITECTURE "noarch") + + # test cross-built rpm + set(CPACK_RPM_applications_PACKAGE_ARCHITECTURE "armv7hf") + # test package summary override set(CPACK_RPM_PACKAGE_SUMMARY "default summary") set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 68d846f43..5be9d17dc 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -161,21 +161,25 @@ if(CPackGen MATCHES "RPM") set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_applications_PACKAGE_ARCHITECTURE}") set(spec_regex "*libraries*") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") + set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_libraries_PACKAGE_ARCHITECTURE}") set(spec_regex "*headers*") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_headers_PACKAGE_ARCHITECTURE}") set(spec_regex "*applications*") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_Unspecified_PACKAGE_ARCHITECTURE}") set(spec_regex "*Unspecified*") else() message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") @@ -204,6 +208,10 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") endif() + string(REGEX MATCH ${check_file_match_expected_architecture} check_file_match_architecture ${check_file_content}) + if (NOT check_file_match_architecture) + message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") + endif() endforeach() elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") endif() From 6cc01c140245749bb6a6d5096b4a38f3f16fb776 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Mon, 23 Feb 2015 16:49:42 +0100 Subject: [PATCH 0209/1029] CPackWIX: Add release notes for the wix-shortcut-properties topic. --- Help/release/dev/wix-shortcut-properties.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Help/release/dev/wix-shortcut-properties.rst diff --git a/Help/release/dev/wix-shortcut-properties.rst b/Help/release/dev/wix-shortcut-properties.rst new file mode 100644 index 000000000..bdd648565 --- /dev/null +++ b/Help/release/dev/wix-shortcut-properties.rst @@ -0,0 +1,9 @@ +wix-shortcut-properties +----------------------- + +* The CPack WIX generator learned the new + :prop_inst:`CPACK_START_MENU_SHORTCUTS`, + :prop_inst:`CPACK_DESKTOP_SHORTCUTS` and + :prop_inst:`CPACK_STARTUP_SHORTCUTS` installed file properties which can + be used to install shorcuts in the Start Menu, on the Desktop and + in the Startup Folder respectively. From b6f94e6b14ea1e32014296d3c766500852f74df2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 23 Feb 2015 11:02:22 -0500 Subject: [PATCH 0210/1029] Help: Add notes for topic 'rpm_package_architecture' --- Help/release/dev/rpm_package_architecture.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/rpm_package_architecture.rst diff --git a/Help/release/dev/rpm_package_architecture.rst b/Help/release/dev/rpm_package_architecture.rst new file mode 100644 index 000000000..5bec51dd6 --- /dev/null +++ b/Help/release/dev/rpm_package_architecture.rst @@ -0,0 +1,6 @@ +rpm_package_architecture +------------------------ + +* The :module:`CPackRPM` module learned a new + :variable:`CPACK_RPM__PACKAGE_ARCHITECTURE` variable + to specify a component-specific package architecture. From 38ef2b7363533746cfc14dbc55d696de3cc75386 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 22 Feb 2015 21:06:27 +0100 Subject: [PATCH 0211/1029] FeatureSummary: Print each feature info only once If a feature is added multiple times via ADD_FEATURE_INFO it should appear only once in FEATURE_SUMMARY. Signed-off-by: Gregor Jasny --- Modules/FeatureSummary.cmake | 3 +++ .../FeatureSummary/FeatureSummaryWhatOnce-stdout.txt | 4 ++++ .../RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake | 8 ++++++++ Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake | 1 + 4 files changed, 16 insertions(+) create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 3eea9dba6..ce5a4ed60 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -379,6 +379,9 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) set(_currentFeatureText "") get_property(_EnabledFeatures GLOBAL PROPERTY ${_property}) + if(_EnabledFeatures) + list(REMOVE_DUPLICATES _EnabledFeatures) + endif(_EnabledFeatures) foreach(_currentFeature ${_EnabledFeatures}) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt new file mode 100644 index 000000000..39be105e6 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt @@ -0,0 +1,4 @@ +--( ) + \* Foo , Foo decscription\. ++ +-- diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake new file mode 100644 index 000000000..545fb927d --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake @@ -0,0 +1,8 @@ +include(FeatureSummary) + +set(WITH_FOO 1) + +add_feature_info(Foo WITH_FOO "Foo decscription.") +add_feature_info(Foo WITH_FOO "Foo decscription.") + +feature_summary(WHAT ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake index 1417338ed..6a5fc2882 100644 --- a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake +++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(FeatureSummaryWhatSingleUnknown) run_cmake(FeatureSummaryWhatList) run_cmake(FeatureSummaryWhatListUnknown) run_cmake(FeatureSummaryWhatListAll) +run_cmake(FeatureSummaryWhatOnce) From fe558718b30da989db8b880374012a0e580574e6 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 23 Feb 2015 10:51:42 +0100 Subject: [PATCH 0212/1029] GetPrerequisites: Update output matching for newer 'file' versions Detect PIE binaries with newer 'file' (5.22). It no longer prints "(uses shared libraries)" but does print "interpreter": # file 5.19 $ file /usr/bin/su /usr/bin/su: ... shared object, ..., dynamically linked (uses shared libs), ... # file 5.22 $ file /usr/bin/su /usr/bin/su: ... shared object, ..., dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, ... --- Modules/GetPrerequisites.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 712a41ce8..9fb85feb1 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -260,6 +260,13 @@ function(is_file_executable file result_var) return() endif() + # "file" version 5.22 does not print "(used shared libraries)" + # but uses "interpreter" + if("${file_ov}" MATCHES "shared object.*interpreter") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + else() message(STATUS "warning: No 'file' command, skipping execute_process...") endif() From 78ec4b16400111cab7cc0de3e7544b1b071b2abe Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 22 Feb 2015 19:00:10 +0100 Subject: [PATCH 0213/1029] OS X: Shorten CFBundleExecutable to file name only Shorten the CFBundleExecutable in the PList file of Bundles to the file name only as it is done for Frameworks, too. Signed-off-by: Gregor Jasny --- Source/cmOSXBundleGenerator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 55e20ab83..a8eef8244 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -181,8 +181,9 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, std::string plist = root + "/" + this->GT->Target->GetCFBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; + std::string name = cmSystemTools::GetFilenameName(targetName); this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, - targetName, + name, plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); } From 0ee2a004e70e2d49423f5b4b393896258e8ab688 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 22 Feb 2015 19:00:11 +0100 Subject: [PATCH 0214/1029] OS X: Add platform-specific Frameworks search path Otherwise find_library is unable to lookup the XCTest framework which is not located in the SDK serach path: In the 10.10 SDK the SDK frameworks are located here: $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks whereas the Platform SDKs are located here: $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/Library/Frameworks Signed-off-by: Gregor Jasny --- Modules/Platform/Darwin.cmake | 7 +++++++ Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 3 +++ Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index e5c5f36d2..b912d98d3 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -166,6 +166,13 @@ if(_CMAKE_OSX_SYSROOT_PATH) ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks ) + # add platform developer framework path if exists + get_filename_component(_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH + ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks ABSOLUTE) + if(IS_DIRECTORY ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH + ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) + endif() endif() list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fd01201a8..6663b8800 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -176,7 +176,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]") endif() if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) - add_RunCMake_test(XcodeProject) + add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) endif() add_RunCMake_test(File_Generate) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 792f40e70..03d3cd3a9 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -3,3 +3,6 @@ include(RunCMake) run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +if (NOT XCODE_VERSION VERSION_LESS 6) + run_cmake(XcodePlatformFrameworks) +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake b/Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake new file mode 100644 index 000000000..74dc9783e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +find_library(XCTEST_LIBRARY XCTest) +if(NOT XCTEST_LIBRARY) + message(FATAL_ERROR "XCTest Framework not found.") +endif() From 0b54e8366e686340102867035e3dfdedf6f783b9 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 19 Feb 2015 14:35:02 +0800 Subject: [PATCH 0215/1029] VS: Specify absolute output directory for the Midl tool Generate the OutputDirectory element value as an absolute path to the same location as the existing relative path. Somehow this addresses an occasional failure in a large/complex build, and should not hurt basic use cases. --- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a286049cb..ca8310c91 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2522,7 +2522,7 @@ WriteMidlOptions(std::string const& /*config*/, } this->WriteString("%(AdditionalIncludeDirectories)" "\n", 0); - this->WriteString("$(IntDir)\n", 3); + this->WriteString("$(ProjectDir)/$(IntDir)\n", 3); this->WriteString("%(Filename).h\n", 3); this->WriteString( "%(Filename).tlb\n", 3); From cb75eec0b45eda230996580043e00e38d35a1e5b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 21:52:09 +0100 Subject: [PATCH 0216/1029] cmAlgorithms: Add const to const objects. --- Source/cmAlgorithms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9bd67b57..56e7f1723 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -84,7 +84,7 @@ private: template FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) { - typename std::iterator_traits::difference_type dist = + const typename std::iterator_traits::difference_type dist = std::distance(middle, last); std::rotate(first, middle, last); std::advance(first, dist); @@ -204,7 +204,7 @@ std::string cmJoin(Range const& r, const char* delimiter) std::ostringstream os; typedef typename Range::value_type ValueType; typedef typename Range::const_iterator InputIt; - InputIt first = r.begin(); + const InputIt first = r.begin(); InputIt last = r.end(); --last; std::copy(first, last, @@ -260,7 +260,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) for(typename Range::const_iterator it = r.begin(); it != r.end(); ++it, ++count) { - typename Range::iterator low = + const typename Range::iterator low = std::lower_bound(unique.begin(), unique.end(), *it); if (low == unique.end() || *low != *it) { From 47a3e22ea5aee971df1e04a6447bb916af81aa2c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 21:52:36 +0100 Subject: [PATCH 0217/1029] cmAlgorithms: Rename template type in cmDeleteAll algorithm. It may be any range, not only a container. --- Source/cmAlgorithms.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 56e7f1723..4b0373625 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -105,19 +105,19 @@ struct cmIsPair > enum { value = true }; }; -template::value> +template::value> struct DefaultDeleter { - void operator()(typename Container::value_type value) const { + void operator()(typename Range::value_type value) const { delete value; } }; -template -struct DefaultDeleter +template +struct DefaultDeleter { - void operator()(typename Container::value_type value) const { + void operator()(typename Range::value_type value) const { delete value.second; } }; @@ -187,11 +187,11 @@ cmRange(Range const& range) range.begin(), range.end()); } -template -void cmDeleteAll(Container const& c) +template +void cmDeleteAll(Range const& r) { - std::for_each(c.begin(), c.end(), - ContainerAlgorithms::DefaultDeleter()); + std::for_each(r.begin(), r.end(), + ContainerAlgorithms::DefaultDeleter()); } template From d83b40c58dbd8a37147377e159f1c5ae8ca2f8c6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 24 Feb 2015 00:01:16 -0500 Subject: [PATCH 0218/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bee52913c..12242a345 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150223) +set(CMake_VERSION_PATCH 20150224) #set(CMake_VERSION_RC 1) From 5857ca5e0d6c6f04486153f69184ba5d76b13f0b Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Wed, 7 Jan 2015 20:33:27 +0100 Subject: [PATCH 0219/1029] CPackRPM: Drop explicit handling of '@' symbols that breaks them (#14782) The change in commit v2.8.12~218^2 (CPackRPM protect '@' character in filename processed in the spec file, 2013-07-05) was not necessary after commit v2.8.12~439^2 (Add support for componentized USER spec file, 2013-04-01). The latter replaced ${VAR} references in the spec file template string with \@VAR\@ references, thus protecting '@' symbols automatically. This caused CPackRPM to break paths with @ symbols. Revert the change to fix the behavior, and add a test case. --- Modules/CPackRPM.cmake | 10 ------- Tests/CPackComponentsForAll/CMakeLists.txt | 2 +- .../RunCPackVerifyResult.cmake | 26 ++++++++++++++++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 6ce18bfc2..cb987f8a4 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1175,13 +1175,6 @@ if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") endif() -# protect @ in pathname in order to avoid their -# interpretation during the configure_file step -set(CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES}") -set(PROTECTED_AT "@") -string(REPLACE "@" "\@PROTECTED_AT\@" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES_LIST}") -set(CPACK_RPM_INSTALL_FILES_LIST "") - # # USER generated/provided spec file handling. # @@ -1292,9 +1285,6 @@ else() configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) endif() -# remove AT protection -unset(PROTECTED_AT) - if(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE execute_process( diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index b55594e86..51af29769 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -43,7 +43,7 @@ install(TARGETS mylibapp # CPACK_MONOLITHIC_INSTALL=1 is set (at cmake time). install(TARGETS mylibapp2 RUNTIME - DESTINATION bin) + DESTINATION bin/@in@_@path@@with\\@and\\@/\@in_path\@) # test @ char in path install(FILES mylib.h DESTINATION include diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 5be9d17dc..f06605a7d 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -139,6 +139,7 @@ if(CPackGen MATCHES "RPM") set(CPACK_COMPONENT_HEADERS_DESCRIPTION "C/C\\+\\+ header files for use with MyLib") + # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") # set gnu install prefixes to what they are set during rpm creation # CMAKE_SIZEOF_VOID_P is not set here but lib is prefix of lib64 so @@ -213,6 +214,29 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() - elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") + + # test package content + foreach(check_file ${expected_file}) + string(REGEX MATCH ".*Unspecified.*" check_file_Unspecified_match ${check_file}) + + if(check_file_Unspecified_match) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file} + OUTPUT_VARIABLE check_file_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(REGEX MATCH ".*bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2$" check_at_in_path ${check_file_content}) + + if(NOT check_at_in_path) + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*Unspecified*.spec") + + if(spec_file) + file(READ ${spec_file} spec_file_content) + endif() + + message(FATAL_ERROR "error: '${check_file}' rpm package path with @ characters is missing or invalid. RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") + endif() + endif() + endforeach() endif() endif() From 08d1e65a9ab89c6d23f6ace8d652dee278710586 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 24 Feb 2015 09:06:39 -0500 Subject: [PATCH 0220/1029] FindMatlab: Remove trailing blank lines --- Modules/FindMatlab.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 474556e72..73b3a5b7f 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -125,4 +125,3 @@ mark_as_advanced( MATLAB_FOUND MATLAB_ROOT ) - From bbc1a9788d94ed9a6f710689611c63dcc52c8b09 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 21:53:19 +0100 Subject: [PATCH 0221/1029] cmAlgorithms: Add a size() to cmRange. size() is already used by cmRemoveDuplicates, which is designed to accept a cmRange. --- Source/cmAlgorithms.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 4b0373625..f90f105e8 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -127,11 +127,14 @@ struct Range { typedef const_iterator_ const_iterator; typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type + difference_type; Range(const_iterator begin_, const_iterator end_) : Begin(begin_), End(end_) {} const_iterator begin() const { return Begin; } const_iterator end() const { return End; } bool empty() const { return std::distance(Begin, End) == 0; } + difference_type size() const { return std::distance(Begin, End); } Range& advance(cmIML_INT_intptr_t amount) { std::advance(Begin, amount); From b917f4c003cb192f461345b66a9af1a3436b86b1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 21:55:19 +0100 Subject: [PATCH 0222/1029] cmAlgorithms: Relax cmRemoveN requirement to FwdIter. cmRotate already requires only FwdIter. --- Source/cmAlgorithms.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f90f105e8..87907322b 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -154,7 +154,9 @@ private: template Iter RemoveN(Iter i1, Iter i2, size_t n) { - return cmRotate(i1, i1 + n, i2); + Iter m = i1; + std::advance(m, n); + return cmRotate(i1, m, i2); } template From cae45df77235bf7314421f2520177f21179beb84 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 21:56:45 +0100 Subject: [PATCH 0223/1029] cmAlgorithms: Rename template argument to RemoveN. --- Source/cmAlgorithms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 87907322b..ca4c1fd3b 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -151,10 +151,10 @@ private: const_iterator End; }; -template -Iter RemoveN(Iter i1, Iter i2, size_t n) +template +FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n) { - Iter m = i1; + FwdIt m = i1; std::advance(m, n); return cmRotate(i1, m, i2); } From ba959934a6a832e7d0a9f4bfc433e09aad1476f3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 22:00:01 +0100 Subject: [PATCH 0224/1029] cmAlgorithms: Make cmRemoveDuplicates work with more containers. Remove the accidental requirement that the input range must be a std::vector. --- Source/cmAlgorithms.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index ca4c1fd3b..161a2cb6e 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -258,14 +258,15 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - std::vector unique; + typedef std::vector UniqueVector; + UniqueVector unique; unique.reserve(r.size()); std::vector indices; size_t count = 0; for(typename Range::const_iterator it = r.begin(); it != r.end(); ++it, ++count) { - const typename Range::iterator low = + const typename UniqueVector::iterator low = std::lower_bound(unique.begin(), unique.end(), *it); if (low == unique.end() || *low != *it) { From 1f7967913662429adcc509528086d6525acff317 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 22:07:28 +0100 Subject: [PATCH 0225/1029] cmAlgorithms: Relax iterator requirement for cmRemoveIndices. Require only forward iterators from the range. --- Source/cmAlgorithms.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 161a2cb6e..3dd5f9587 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -237,12 +237,15 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) { typename InputRange::const_iterator remIt = rem.begin(); - typename Range::iterator writer = r.begin() + *remIt; + typename Range::iterator writer = r.begin(); + std::advance(writer, *remIt); ++remIt; size_t count = 1; for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt) { - writer = ContainerAlgorithms::RemoveN(writer, r.begin() + *remIt, count); + typename Range::iterator pivot = r.begin(); + std::advance(pivot, *remIt); + writer = ContainerAlgorithms::RemoveN(writer, pivot, count); } writer = ContainerAlgorithms::RemoveN(writer, r.end(), count); return writer; From 7fd8557f4c3d761c8ec0e7c29c9fa74a3ff45295 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 22:10:41 +0100 Subject: [PATCH 0226/1029] cmAlgorithms: Maintain the pivot iterator in cmRemoveIndices. Avoid the algorithm of 'Schlemiel the painter' in the case of iterators which are not RandomAccess. --- Source/cmAlgorithms.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 3dd5f9587..f00e1c012 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -239,12 +239,14 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) typename Range::iterator writer = r.begin(); std::advance(writer, *remIt); + typename Range::iterator pivot = writer; + typename InputRange::value_type prevRem = *remIt; ++remIt; size_t count = 1; for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt) { - typename Range::iterator pivot = r.begin(); - std::advance(pivot, *remIt); + std::advance(pivot, *remIt - prevRem); + prevRem = *remIt; writer = ContainerAlgorithms::RemoveN(writer, pivot, count); } writer = ContainerAlgorithms::RemoveN(writer, r.end(), count); From a5b10ae68a4a84face73767f96189673015946be Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 22:15:47 +0100 Subject: [PATCH 0227/1029] cmAlgorithms: Remove needless assignment. --- Source/cmAlgorithms.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f00e1c012..43023dbf5 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -249,8 +249,7 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) prevRem = *remIt; writer = ContainerAlgorithms::RemoveN(writer, pivot, count); } - writer = ContainerAlgorithms::RemoveN(writer, r.end(), count); - return writer; + return ContainerAlgorithms::RemoveN(writer, r.end(), count); } template From 47c2da6aa8c8f77e8d01b68cd5de596da2b2c3d7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 20 Feb 2015 22:19:14 +0100 Subject: [PATCH 0228/1029] cmAlgorithms: Cache the end iterators in algorithms. --- Source/cmAlgorithms.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 43023dbf5..b9d7e7889 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -236,6 +236,7 @@ template typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) { typename InputRange::const_iterator remIt = rem.begin(); + typename InputRange::const_iterator remEnd = rem.end(); typename Range::iterator writer = r.begin(); std::advance(writer, *remIt); @@ -243,13 +244,14 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) typename InputRange::value_type prevRem = *remIt; ++remIt; size_t count = 1; - for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt) + const typename Range::iterator rangeEnd = r.end(); + for ( ; writer != rangeEnd && remIt != remEnd; ++count, ++remIt) { std::advance(pivot, *remIt - prevRem); prevRem = *remIt; writer = ContainerAlgorithms::RemoveN(writer, pivot, count); } - return ContainerAlgorithms::RemoveN(writer, r.end(), count); + return ContainerAlgorithms::RemoveN(writer, rangeEnd, count); } template @@ -267,8 +269,9 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) unique.reserve(r.size()); std::vector indices; size_t count = 0; + const typename Range::iterator end = r.end(); for(typename Range::const_iterator it = r.begin(); - it != r.end(); ++it, ++count) + it != end; ++it, ++count) { const typename UniqueVector::iterator low = std::lower_bound(unique.begin(), unique.end(), *it); @@ -283,7 +286,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) } if (indices.empty()) { - return r.end(); + return end; } return cmRemoveIndices(r, indices); } From ea98667682f29e8f900c01c5c36eebebf80ea8c7 Mon Sep 17 00:00:00 2001 From: Gunnar Roth Date: Fri, 13 Feb 2015 10:10:26 -0500 Subject: [PATCH 0229/1029] MSVC: Define /DWINCE when building for WinCE platforms (#14552) --- Modules/Platform/Windows-MSVC.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 2440f89be..4098c3f77 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -150,7 +150,7 @@ if(WINCE) message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}") endif() - set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE") + set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE /DWINCE") set(_PLATFORM_DEFINES_C " /D${_MSVC_C_ARCHITECTURE_FAMILY} /D_${_MSVC_C_ARCHITECTURE_FAMILY_UPPER}_") set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_") From 886dcaa7c5f91269b91da857d6eb2db3610d385e Mon Sep 17 00:00:00 2001 From: Gunnar Roth Date: Fri, 13 Feb 2015 10:11:38 -0500 Subject: [PATCH 0230/1029] MSVC: Distinguish among ARM architectures more precisely (#14552) Detect the exact ARM architecture instead of just "ARM". Treat "ARM" as an architecture family that includes THUMB (ARMV4I and ARMV5I). --- Modules/CMakeDetermineCompilerId.cmake | 2 -- Modules/CMakePlatformId.h.in | 11 +++++++- Modules/Platform/Windows-MSVC.cmake | 36 +++++++++++++++++++------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index d22a867c5..403ac089a 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -508,8 +508,6 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(ARCHITECTURE_ID "SH4") elseif(peheader STREQUAL "50450000a801") set(ARCHITECTURE_ID "SH5") - elseif(peheader STREQUAL "50450000c201") - set(ARCHITECTURE_ID "THUMB") endif() endif() diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index bc26c0773..da99b9e6d 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -1,3 +1,6 @@ +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + /* Identify known platforms by name. */ #if defined(__linux) || defined(__linux__) || defined(linux) # define PLATFORM_ID "Linux" @@ -112,7 +115,13 @@ # define ARCHITECTURE_ID "X86" # elif defined(_M_ARM) -# define ARCHITECTURE_ID "ARM" +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif # elif defined(_M_MIPS) # define ARCHITECTURE_ID "MIPS" diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 4098c3f77..6df377b64 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -131,14 +131,18 @@ endif() # default to Debug builds set(CMAKE_BUILD_TYPE_INIT Debug) +# Compute an architecture family from the architecture id. +foreach(lang C CXX) + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}") + if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM") + elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx") + endif() +endforeach() + if(WINCE) foreach(lang C CXX) - set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}") - if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "THUMB") - set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM") - elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH") - set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx") - endif() string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER) endforeach() @@ -168,7 +172,7 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") if(WINDOWS_PHONE) set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") - elseif(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM) + elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") else() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") @@ -176,7 +180,7 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) else() set(_PLATFORM_DEFINES "/DWIN32") - if(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM) + if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") elseif(MSVC_VERSION GREATER 1310) set(_RTC1 "/RTC1") @@ -200,9 +204,21 @@ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") # set the machine type if(MSVC_C_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") + if(MSVC_C_ARCHITECTURE_ID MATCHES "^ARMV.I") + set(_MACHINE_ARCH_FLAG "/machine:THUMB") + elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(_MACHINE_ARCH_FLAG "/machine:ARM") + else() + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") + endif() elseif(MSVC_CXX_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") + if(MSVC_CXX_ARCHITECTURE_ID MATCHES "^ARMV.I") + set(_MACHINE_ARCH_FLAG "/machine:THUMB") + elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(_MACHINE_ARCH_FLAG "/machine:ARM") + else() + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") + endif() elseif(MSVC_Fortran_ARCHITECTURE_ID) set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") endif() From 3d612c735285d9a63d4981a2ca7bff44cd741e4b Mon Sep 17 00:00:00 2001 From: Gunnar Roth Date: Fri, 13 Feb 2015 10:14:34 -0500 Subject: [PATCH 0231/1029] MSVC: Compile with arch-specific flags on ARM platforms (#14552) Define the exact ARM architecture name as a preprocessor symbol. Compile with /QRarch4T or /QRarch5T on ARMV4I or ARMV5I. --- Modules/Platform/Windows-MSVC.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 6df377b64..267de3c0d 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -159,7 +159,18 @@ if(WINCE) set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_") set(_RTC1 "") + set(_FLAGS_C "") set(_FLAGS_CXX " /GR /EHsc") + + foreach(lang C CXX) + if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM") + set(_PLATFORM_DEFINES_${lang} "${_PLATFORM_DEFINES_${lang}} /D${MSVC_${lang}_ARCHITECTURE_ID}") + if(MSVC_${lang}_ARCHITECTURE_ID MATCHES "^ARMV([45])I$") + set(_FLAGS_${lang} "${_FLAGS_${lang}} /QRarch${CMAKE_MATCH_1}T") + endif() + endif() + endforeach() + set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") From 5d5067ae57c9d02656a54076cdf121c7084a4de3 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Tue, 24 Feb 2015 14:20:16 +0100 Subject: [PATCH 0232/1029] Check*CompilerFlag: Refactor method used to pass flags Refactor the Check*CompilerFlag modules to pass the flags to Check*SourceCompiles using CMAKE_REQUIRED_FLAGS instead of CMAKE_REQUIRED_DEFINITIONS. Both end up being used, but the variable for "FLAGS" is more precise. --- Modules/CheckCCompilerFlag.cmake | 8 ++++---- Modules/CheckCXXCompilerFlag.cmake | 8 ++++---- Modules/CheckFortranCompilerFlag.cmake | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 53f345473..750e4fbef 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -13,7 +13,7 @@ # Will be created as an internal cache variable. # # This internally calls the check_c_source_compiles macro and sets -# CMAKE_REQUIRED_DEFINITIONS to . See help for +# CMAKE_REQUIRED_FLAGS to . See help for # CheckCSourceCompiles for a listing of variables that can otherwise # modify the build. The result only tells that the compiler does not # give an error message when it encounters the flag. If the flag has @@ -38,8 +38,8 @@ include(CheckCSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${_FLAG}") # Normalize locale during test compilation. set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) @@ -60,5 +60,5 @@ macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) unset(_CheckCCompilerFlag_LOCALE_VARS) unset(_CheckCCompilerFlag_COMMON_PATTERNS) - set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") endmacro () diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index fab3a053d..71b3fd210 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -12,7 +12,7 @@ # - variable to store the result # # This internally calls the check_cxx_source_compiles macro and sets -# CMAKE_REQUIRED_DEFINITIONS to . See help for +# CMAKE_REQUIRED_FLAGS to . See help for # CheckCXXSourceCompiles for a listing of variables that can otherwise # modify the build. The result only tells that the compiler does not # give an error message when it encounters the flag. If the flag has @@ -37,8 +37,8 @@ include(CheckCXXSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${_FLAG}") # Normalize locale during test compilation. set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) @@ -59,6 +59,6 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) unset(_CheckCXXCompilerFlag_LOCALE_VARS) unset(_CheckCXXCompilerFlag_COMMON_PATTERNS) - set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") endmacro () diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake index 53fd8d64d..c47666143 100644 --- a/Modules/CheckFortranCompilerFlag.cmake +++ b/Modules/CheckFortranCompilerFlag.cmake @@ -13,7 +13,7 @@ # Will be created as an internal cache variable. # # This internally calls the check_fortran_source_compiles macro and -# sets CMAKE_REQUIRED_DEFINITIONS to . See help for +# sets CMAKE_REQUIRED_FLAGS to . See help for # CheckFortranSourceCompiles for a listing of variables that can # otherwise modify the build. The result only tells that the compiler # does not give an error message when it encounters the flag. If the @@ -40,8 +40,8 @@ include(CheckFortranSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${_FLAG}") # Normalize locale during test compilation. set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) @@ -62,5 +62,5 @@ macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT) unset(_CheckFortranCompilerFlag_LOCALE_VARS) unset(_CheckFortranCompilerFlag_COMMON_PATTERNS) - set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") endmacro () From b10310e6e69588dc389dea7220f3bf3db8bc0d42 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 24 Feb 2015 10:02:23 -0500 Subject: [PATCH 0233/1029] Tests: Drop CTestTestFailedSubmit-* tests Everything they cover is now covered by RunCMake.ctest_submit test cases (except ctest_coverage LABELS which were not actually checked anyway). Drop these redundant tests. --- Tests/CMakeLists.txt | 42 ------------------- Tests/CTestTestFailedSubmits/test.cmake.in | 49 ---------------------- 2 files changed, 91 deletions(-) delete mode 100644 Tests/CTestTestFailedSubmits/test.cmake.in diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4d3aeafd2..08765de85 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2743,48 +2743,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log" ) - function(add_failed_submit_test name source build in out log regex) - configure_file("${in}" "${out}" @ONLY) - add_test(${name} ${CMAKE_CTEST_COMMAND} -S "${out}" -V --output-log "${log}") - set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}") - endfunction() - - set(regex "(Problems when submitting via S*CP") - set(regex "${regex}|Error message was: ") - set(regex "${regex}([Cc]ould *n.t resolve host") - set(regex "${regex}|[Cc]ould *n.t connect to host") - set(regex "${regex}|Failed *t*o* connect to") - set(regex "${regex}|Connection timed out after [0-9]+ milliseconds") - set(regex "${regex}|Empty reply from server") - set(regex "${regex}|The requested URL returned error") - set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)") - set(regex "${regex}|Submission method .xmlrpc. not compiled into CTest") - set(regex "${regex}|Submission problem") - set(regex "${regex}|Submission successful)") - - set(ctest_coverage_labels_args "") - - foreach(drop_method cp ftp http https scp xmlrpc) - # Cycle through these values each time through the loop: - if(ctest_coverage_labels_args STREQUAL "") - set(ctest_coverage_labels_args "LABELS Everything") - elseif(ctest_coverage_labels_args STREQUAL "LABELS Everything") - set(ctest_coverage_labels_args "LABELS 0ArgTest") - else() - set(ctest_coverage_labels_args "") - endif() - - add_failed_submit_test(CTestTestFailedSubmit-${drop_method} - "${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast" - "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/${drop_method}" - "${CMake_SOURCE_DIR}/Tests/CTestTestFailedSubmits/test.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/test-${drop_method}.cmake" - "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/test-${drop_method}.log" - "${regex}" - ) - endforeach() - - if (CMAKE_TESTS_CDASH_SERVER) set(regex "^([^:]+)://([^/]+)(.*)$") diff --git a/Tests/CTestTestFailedSubmits/test.cmake.in b/Tests/CTestTestFailedSubmits/test.cmake.in deleted file mode 100644 index 5ff836fee..000000000 --- a/Tests/CTestTestFailedSubmits/test.cmake.in +++ /dev/null @@ -1,49 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -# CTestConfig.cmake settings: -set(CTEST_PROJECT_NAME "SmallAndFast") - -# Intentionally leave out other upload-related CTestConfig.cmake settings -# so that the ctest_submit call below fails with an error message... -# -set(CTEST_DROP_METHOD "@drop_method@") - -# Settings: -set(CTEST_USE_LAUNCHERS 1) - -# Emit these compiler warnings: -set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Wall") - -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTestLaunchers-@drop_method@") - -set(CTEST_SOURCE_DIRECTORY "@source@") -set(CTEST_BINARY_DIRECTORY "@build@") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -CTEST_START(Experimental) - -# explicitly do not use CTEST_UPDATE - avoid network activity - -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" - OPTIONS "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS};-DSAF_INTENTIONAL_COMPILE_ERROR:BOOL=ON;-DSAF_INTENTIONAL_COMPILE_WARNING:BOOL=ON" - RETURN_VALUE res) -CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_COVERAGE(BUILD "${CTEST_BINARY_DIRECTORY}" @ctest_coverage_labels_args@ RETURN_VALUE res) - -# ok to call ctest_submit - still avoids network activity because there is -# not a valid drop location given above... -CTEST_SUBMIT(RETURN_VALUE res) - -# Add coverage for the new APPEND arg to ctest_start: -# -CTEST_START(Experimental APPEND) From 4ee9005d7304f922c95db19ffab2a9da4145b93b Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 24 Feb 2015 10:34:15 -0500 Subject: [PATCH 0234/1029] cmVisualStudio10TargetGenerator: Wrap long line --- Source/cmVisualStudio10TargetGenerator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ca8310c91..04d148715 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2522,7 +2522,8 @@ WriteMidlOptions(std::string const& /*config*/, } this->WriteString("%(AdditionalIncludeDirectories)" "\n", 0); - this->WriteString("$(ProjectDir)/$(IntDir)\n", 3); + this->WriteString("$(ProjectDir)/$(IntDir)" + "\n", 3); this->WriteString("%(Filename).h\n", 3); this->WriteString( "%(Filename).tlb\n", 3); From 1826aadcf3ee7f0d3a35927d32226513d265accc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 25 Feb 2015 00:01:09 -0500 Subject: [PATCH 0235/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 12242a345..a92923245 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150224) +set(CMake_VERSION_PATCH 20150225) #set(CMake_VERSION_RC 1) From f7f4ca55bde68b174b7542fe417426a7cbf76fe3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Feb 2015 08:11:39 -0500 Subject: [PATCH 0236/1029] ExternalData: Add support for custom algorithm-to-URL mapping Allow URL templates to contain a %(algo:) placeholder that is replaced by mapping the canonical hash algorithm name through a map defined by the . Extend the Module.ExternalData test to cover the behavior. Extend the RunCMake.ExternalData test to cover error cases. --- .../release/dev/ExternalData-url-algo-map.rst | 8 ++++ Modules/ExternalData.cmake | 41 ++++++++++++++++++- .../dded55e43cd6529ee35d24113dfc87a3 | 1 + .../85158f0c1996837976e858c42a9a7634bfe91b93 | 1 + Tests/Module/ExternalData/CMakeLists.txt | 4 ++ Tests/Module/ExternalData/Data1Check.cmake | 8 ++++ .../Module/ExternalData/DataAlgoMapA.dat.md5 | 1 + .../Module/ExternalData/DataAlgoMapB.dat.sha1 | 1 + .../ExternalData/BadAlgoMap1-result.txt | 1 + .../ExternalData/BadAlgoMap1-stderr.txt | 9 ++++ Tests/RunCMake/ExternalData/BadAlgoMap1.cmake | 5 +++ .../ExternalData/BadAlgoMap2-result.txt | 1 + .../ExternalData/BadAlgoMap2-stderr.txt | 9 ++++ Tests/RunCMake/ExternalData/BadAlgoMap2.cmake | 5 +++ .../RunCMake/ExternalData/RunCMakeTest.cmake | 2 + 15 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/ExternalData-url-algo-map.rst create mode 100644 Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 create mode 100644 Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 create mode 100644 Tests/Module/ExternalData/DataAlgoMapA.dat.md5 create mode 100644 Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 create mode 100644 Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt create mode 100644 Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt create mode 100644 Tests/RunCMake/ExternalData/BadAlgoMap1.cmake create mode 100644 Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt create mode 100644 Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt create mode 100644 Tests/RunCMake/ExternalData/BadAlgoMap2.cmake diff --git a/Help/release/dev/ExternalData-url-algo-map.rst b/Help/release/dev/ExternalData-url-algo-map.rst new file mode 100644 index 000000000..baf661f65 --- /dev/null +++ b/Help/release/dev/ExternalData-url-algo-map.rst @@ -0,0 +1,8 @@ +ExternalData-url-algo-map +------------------------- + +* The :module:`ExternalData` module learned a new URL template + placeholder ``%(algo:)`` to allow custom mapping from + algorithm name to URL component through configuration of new + :variable:`ExternalData_URL_ALGO__` variables. + This allows more flexibility in remote URLs. diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 741db81b8..b3206beb5 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -155,13 +155,23 @@ calling any of the functions provided by this module. inactivity timeout, in seconds, with a default of ``60`` seconds. Set to ``0`` to disable enforcement. +.. variable:: ExternalData_URL_ALGO__ + + Specify a custom URL component to be substituted for URL template + placeholders of the form ``%(algo:)``, where ```` is a + valid C identifier, when fetching an object referenced via hash + algorithm ````. If not defined, the default URL component + is just ```` for any ````. + .. variable:: ExternalData_URL_TEMPLATES The ``ExternalData_URL_TEMPLATES`` may be set to provide a list of of URL templates using the placeholders ``%(algo)`` and ``%(hash)`` in each template. Data fetch rules try each URL template in order by substituting the hash algorithm name for ``%(algo)`` and the hash - value for ``%(hash)``. + value for ``%(hash)``. Alternatively one may use ``%(algo:)`` + with ``ExternalData_URL_ALGO__`` variables to gain more + flexibility in remote URLs. Referencing Files ^^^^^^^^^^^^^^^^^ @@ -349,6 +359,25 @@ function(ExternalData_add_target target) "The key must be a valid C identifier.") endif() endif() + + # Store custom algorithm name to URL component maps. + if("${url_template}" MATCHES "%\\(algo:([^)]*)\\)") + set(key "${CMAKE_MATCH_1}") + if(key MATCHES "^[A-Za-z_][A-Za-z0-9_]*$") + string(REPLACE "|" ";" _algos "${_ExternalData_REGEX_ALGO}") + foreach(algo ${_algos}) + if(DEFINED ExternalData_URL_ALGO_${algo}_${key}) + string(CONCAT _ExternalData_CONFIG_CODE "${_ExternalData_CONFIG_CODE}\n" + "set(ExternalData_URL_ALGO_${algo}_${key} \"${ExternalData_URL_ALGO_${algo}_${key}}\")") + endif() + endforeach() + else() + message(FATAL_ERROR + "Bad %(algo:${key}) in URL template:\n" + " ${url_template}\n" + "The transform name must be a valid C identifier.") + endif() + endif() endforeach() # Store configuration for use by build-time script. @@ -904,6 +933,16 @@ function(_ExternalData_download_object name hash algo var_obj) foreach(url_template IN LISTS ExternalData_URL_TEMPLATES) string(REPLACE "%(hash)" "${hash}" url_tmp "${url_template}") string(REPLACE "%(algo)" "${algo}" url "${url_tmp}") + if(url MATCHES "^(.*)%\\(algo:([A-Za-z_][A-Za-z0-9_]*)\\)(.*)$") + set(lhs "${CMAKE_MATCH_1}") + set(key "${CMAKE_MATCH_2}") + set(rhs "${CMAKE_MATCH_3}") + if(DEFINED ExternalData_URL_ALGO_${algo}_${key}) + set(url "${lhs}${ExternalData_URL_ALGO_${algo}_${key}}${rhs}") + else() + set(url "${lhs}${algo}${rhs}") + endif() + endif() message(STATUS "Fetching \"${url}\"") if(url MATCHES "^ExternalDataCustomScript://([A-Za-z_][A-Za-z0-9_]*)/(.*)$") _ExternalData_custom_fetch("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}" "${tmp}" err errMsg) diff --git a/Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 b/Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 new file mode 100644 index 000000000..fa0cb1ad1 --- /dev/null +++ b/Tests/Module/ExternalData/Alt/MyAlgoMap1-md5/dded55e43cd6529ee35d24113dfc87a3 @@ -0,0 +1 @@ +DataAlgoMap \ No newline at end of file diff --git a/Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 b/Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 new file mode 100644 index 000000000..fa0cb1ad1 --- /dev/null +++ b/Tests/Module/ExternalData/Alt/SHA1/85158f0c1996837976e858c42a9a7634bfe91b93 @@ -0,0 +1 @@ +DataAlgoMap \ No newline at end of file diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index f99f6afc5..6c5e59c69 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -10,8 +10,10 @@ if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") endif() set(ExternalData_URL_TEMPLATES "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)" + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/Alt/%(algo:MyAlgoMap1)/%(hash)" "ExternalDataCustomScript://MyScript1/%(algo)/%(hash)" ) +set(ExternalData_URL_ALGO_MD5_MyAlgoMap1 MyAlgoMap1-md5) set(ExternalData_CUSTOM_SCRIPT_MyScript1 "${CMAKE_CURRENT_SOURCE_DIR}/MyScript1.cmake") set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData") file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test @@ -26,6 +28,8 @@ ExternalData_Add_Test(Data1 -D Data=DATA{Data.dat} ${Data1CheckSpaces} -D DataScript=DATA{DataScript.dat} + -D DataAlgoMapA=DATA{DataAlgoMapA.dat} + -D DataAlgoMapB=DATA{DataAlgoMapB.dat} -D DataMissing=DATA{DataMissing.dat} -D DataMissingWithAssociated=DATA{DataMissing.dat,Data.dat} -D SeriesA=DATA{SeriesA.dat,:} diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake index a7aa4aee6..9845a3b83 100644 --- a/Tests/Module/ExternalData/Data1Check.cmake +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -12,6 +12,14 @@ file(STRINGS "${DataScript}" lines LIMIT_INPUT 1024) if(NOT "x${lines}" STREQUAL "xDataScript") message(SEND_ERROR "Input file:\n ${DataScript}\ndoes not have expected content, but [[${lines}]]") endif() +file(STRINGS "${DataAlgoMapA}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xDataAlgoMap") + message(SEND_ERROR "Input file:\n ${DataAlgoMapA}\ndoes not have expected content, but [[${lines}]]") +endif() +file(STRINGS "${DataAlgoMapB}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xDataAlgoMap") + message(SEND_ERROR "Input file:\n ${DataAlgoMapB}\ndoes not have expected content, but [[${lines}]]") +endif() if(DataMissing) if(EXISTS "${DataMissing}") message(SEND_ERROR diff --git a/Tests/Module/ExternalData/DataAlgoMapA.dat.md5 b/Tests/Module/ExternalData/DataAlgoMapA.dat.md5 new file mode 100644 index 000000000..7281481ba --- /dev/null +++ b/Tests/Module/ExternalData/DataAlgoMapA.dat.md5 @@ -0,0 +1 @@ +dded55e43cd6529ee35d24113dfc87a3 diff --git a/Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 b/Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 new file mode 100644 index 000000000..4fd7c06fd --- /dev/null +++ b/Tests/Module/ExternalData/DataAlgoMapB.dat.sha1 @@ -0,0 +1 @@ +85158f0c1996837976e858c42a9a7634bfe91b93 diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt b/Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadAlgoMap1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt b/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt new file mode 100644 index 000000000..c3708a9c8 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadAlgoMap1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Bad %\(algo:\) in URL template: + + file:///path/to/%\(algo:\)/%\(hash\) + + The transform name must be a valid C identifier. +Call Stack \(most recent call first\): + BadAlgoMap1.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap1.cmake b/Tests/RunCMake/ExternalData/BadAlgoMap1.cmake new file mode 100644 index 000000000..542ec1dab --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadAlgoMap1.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///path/to/%(algo:)/%(hash)" + ) +ExternalData_Add_Target(Data) diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt b/Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadAlgoMap2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt b/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt new file mode 100644 index 000000000..1f10644dc --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadAlgoMap2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Bad %\(algo:0BadMap\(\) in URL template: + + file:///path/to/%\(algo:0BadMap\(\)/%\(hash\) + + The transform name must be a valid C identifier. +Call Stack \(most recent call first\): + BadAlgoMap2.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadAlgoMap2.cmake b/Tests/RunCMake/ExternalData/BadAlgoMap2.cmake new file mode 100644 index 000000000..0537a7b93 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadAlgoMap2.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///path/to/%(algo:0BadMap()/%(hash)" + ) +ExternalData_Add_Target(Data) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index 7afd2893b..241fa1fba 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(BadAlgoMap1) +run_cmake(BadAlgoMap2) run_cmake(BadCustom1) run_cmake(BadCustom2) run_cmake(BadCustom3) From 1de4a0fb09fded1401ecb1aeaecb1159ae46a3c6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Feb 2015 11:12:06 -0500 Subject: [PATCH 0237/1029] RC: Drop unused CMAKE_COMPILE_RESOURCE variable setting This variable has long been replaced by CMAKE_RC_COMPILE_OBJECT. Stop setting it in platform modules. --- Modules/Platform/Windows-MSVC.cmake | 1 - Modules/Platform/Windows-df.cmake | 2 -- 2 files changed, 3 deletions(-) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 2440f89be..b101b6331 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -55,7 +55,6 @@ endif() # make sure to enable languages after setting configuration types enable_language(RC) -set(CMAKE_COMPILE_RESOURCE "rc /fo ") if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(MSVC_IDE 1) diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index 59d88a350..0beba732d 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -24,8 +24,6 @@ set(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /o set(CMAKE_Fortran_COMPILE_OBJECT " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /object: /compile_only ${CMAKE_END_TEMP_FILE}") -set(CMAKE_COMPILE_RESOURCE "rc /fo ") - set(CMAKE_Fortran_LINK_EXECUTABLE " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /exe: /link ${CMAKE_END_TEMP_FILE}") From 4300de3e2759810ddfd253352eb42cd7f3514c85 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Feb 2015 11:15:51 -0500 Subject: [PATCH 0238/1029] RC: Enable language after C, CXX, or Fortran is enabled (#15404) The RC language is special in that it is automatically enabled on Windows-based platforms when another primary language is enabled. Move enablement of RC from early in the enablement of the other language to late. This will allow it to use information detected as part of enabling C, CXX, or Fortran. --- Modules/Platform/CYGWIN-GNU.cmake | 3 ++- Modules/Platform/Windows-GNU.cmake | 4 ++-- Modules/Platform/Windows-MSVC.cmake | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index fe25ab214..3144ac483 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -25,7 +25,6 @@ set(CMAKE_CREATE_WIN32_EXE "-mwindows") set(CMAKE_GNULD_IMAGE_VERSION "-Wl,--major-image-version,,--minor-image-version,") set(CMAKE_GENERATOR_RC windres) -enable_language(RC) macro(__cygwin_compiler_gnu lang) # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE @@ -53,4 +52,6 @@ macro(__cygwin_compiler_gnu lang) # TODO: Is -Wl,--enable-auto-import now always default? set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") + + enable_language(RC) endmacro() diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index a7653cfee..c827c325e 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -61,8 +61,6 @@ if(NOT CMAKE_GENERATOR_RC AND CMAKE_GENERATOR MATCHES "Unix Makefiles") set(CMAKE_GENERATOR_RC windres) endif() -enable_language(RC) - macro(__windows_compiler_gnu lang) if(MSYS OR MINGW) @@ -139,6 +137,8 @@ macro(__windows_compiler_gnu lang) ) endforeach() endif() + + enable_language(RC) endmacro() macro(__windows_compiler_gnu_abi lang) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index b101b6331..7ac299a1c 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -53,9 +53,6 @@ if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") set (CMAKE_NO_BUILD_TYPE 1) endif() -# make sure to enable languages after setting configuration types -enable_language(RC) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(MSVC_IDE 1) else() @@ -273,4 +270,6 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) + + enable_language(RC) endmacro() From 772eae446409fb853585e196009c87d3037fbc22 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Feb 2015 11:26:48 -0500 Subject: [PATCH 0239/1029] RC: Add platform-specific preprocessor definitions (#15404) In Platform/Windows-MSVC the C and CXX flags are initialized to contain preprocessor definitions describing the platform. On WinCE platforms this may not be just -DWIN32. This information may be important to RC sources too, so add such preprocessor definitions to the default RC flags. Suggested-by: Gunnar Roth --- Modules/Platform/Windows-MSVC.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 7ac299a1c..9298da297 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -271,5 +271,9 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) + if(NOT CMAKE_RC_FLAGS_INIT) + set(CMAKE_RC_FLAGS_INIT "${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}") + endif() + enable_language(RC) endmacro() From 1c3799b151b6ff79472281cd35ece3e067bc526b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 26 Feb 2015 00:01:08 -0500 Subject: [PATCH 0240/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a92923245..b64641a19 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150225) +set(CMake_VERSION_PATCH 20150226) #set(CMake_VERSION_RC 1) From 5e2b418f7b0083b01004910848eb4823ea014ec1 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 25 Feb 2015 09:31:23 -0500 Subject: [PATCH 0241/1029] KWSys 2015-02-25 (1b75ad3d) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 1b75ad3d | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' d4e7f08e..1b75ad3d Domen Vrankar (3): 2b042ff6 SystemTools: Optionally report error from GetRealPath 7c9a970a Glob: Remove dead code 1b75ad3d Glob: Remove addition of extra '/' Change-Id: I04ac5aa4748925bc953db0abff2d4418080882b5 --- Glob.cxx | 24 ++----------------- SystemTools.cxx | 58 +++++++++++++++++++++++++++++++++++++++++----- SystemTools.hxx.in | 7 ++++-- 3 files changed, 59 insertions(+), 30 deletions(-) diff --git a/Glob.cxx b/Glob.cxx index 5a96aed43..1476c25e3 100644 --- a/Glob.cxx +++ b/Glob.cxx @@ -223,7 +223,6 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, return; } unsigned long cc; - kwsys_stl::string fullname; kwsys_stl::string realname; kwsys_stl::string fname; for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ ) @@ -248,15 +247,6 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, fname = kwsys::SystemTools::LowerCase(fname); #endif - if ( start == 0 ) - { - fullname = dir + fname; - } - else - { - fullname = dir + "/" + fname; - } - bool isDir = kwsys::SystemTools::FileIsDirectory(realname); bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname); @@ -302,7 +292,6 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, return; } unsigned long cc; - kwsys_stl::string fullname; kwsys_stl::string realname; kwsys_stl::string fname; for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ ) @@ -327,19 +316,10 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, fname = kwsys::SystemTools::LowerCase(fname); #endif - if ( start == 0 ) - { - fullname = dir + fname; - } - else - { - fullname = dir + "/" + fname; - } - //kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl; //kwsys_ios::cout << "Match: " // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl; - //kwsys_ios::cout << "Full name: " << fullname << kwsys_ios::endl; + //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl; if ( !last && !kwsys::SystemTools::FileIsDirectory(realname) ) @@ -355,7 +335,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, } else { - this->ProcessDirectory(start+1, realname + "/"); + this->ProcessDirectory(start+1, realname); } } } diff --git a/SystemTools.cxx b/SystemTools.cxx index 27082115d..bf6f458e1 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -250,17 +250,46 @@ inline int Chdir(const kwsys_stl::string& dir) return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); #endif } -inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path) +inline void Realpath(const kwsys_stl::string& path, + kwsys_stl::string& resolved_path, + kwsys_stl::string* errorMessage = 0) { kwsys_stl::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path); wchar_t *ptemp; wchar_t fullpath[MAX_PATH]; - if( GetFullPathNameW(tmp.c_str(), sizeof(fullpath)/sizeof(fullpath[0]), - fullpath, &ptemp) ) + DWORD bufferLen = GetFullPathNameW(tmp.c_str(), + sizeof(fullpath) / sizeof(fullpath[0]), + fullpath, &ptemp); + if( bufferLen < sizeof(fullpath)/sizeof(fullpath[0]) ) { resolved_path = KWSYS_NAMESPACE::Encoding::ToNarrow(fullpath); KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path); } + else if(errorMessage) + { + if(bufferLen) + { + *errorMessage = "Destination path buffer size too small."; + } + else if(unsigned int errorId = GetLastError()) + { + LPSTR message = NULL; + DWORD size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, errorId, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&message, 0, NULL); + *errorMessage = std::string(message, size); + LocalFree(message); + } + else + { + *errorMessage = "Unknown error."; + } + + resolved_path = ""; + } else { resolved_path = path; @@ -287,15 +316,31 @@ inline int Chdir(const kwsys_stl::string& dir) { return chdir(dir.c_str()); } -inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path) +inline void Realpath(const kwsys_stl::string& path, + kwsys_stl::string& resolved_path, + kwsys_stl::string* errorMessage = 0) { char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH]; + errno = 0; char *ret = realpath(path.c_str(), resolved_name); if(ret) { resolved_path = ret; } + else if(errorMessage) + { + if(errno) + { + *errorMessage = strerror(errno); + } + else + { + *errorMessage = "Unknown error."; + } + + resolved_path = ""; + } else { // if path resolution fails, return what was passed in @@ -3046,10 +3091,11 @@ kwsys_stl::string SystemTools return ""; } -kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path) +kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path, + kwsys_stl::string* errorMessage) { kwsys_stl::string ret; - Realpath(path, ret); + Realpath(path, ret, errorMessage); return ret; } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index beb2a7e12..93cde0261 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -385,9 +385,12 @@ public: /** * Get the real path for a given path, removing all symlinks. In * the event of an error (non-existent path, permissions issue, - * etc.) the original path is returned. + * etc.) the original path is returned if errorMessage pointer is + * NULL. Otherwise empty string is returned and errorMessage + * contains error description. */ - static kwsys_stl::string GetRealPath(const kwsys_stl::string& path); + static kwsys_stl::string GetRealPath(const kwsys_stl::string& path, + kwsys_stl::string* errorMessage = 0); /** * Split a path name into its root component and the rest of the From ce935ebe50926bde199d86fbde4a78974a4043f9 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 26 Feb 2015 11:32:26 +0100 Subject: [PATCH 0242/1029] cmake: Teach --build to honor CMAKE_VERBOSE_MAKEFILE for Ninja The Ninja build system does not support a in-file verbositiy switch. Instead teach 'cmake --build' to extract the CMAKE_VERBOSE_MAKEFILE setting and pass it as an optional '-v' argument to Ninja. This can serve as a reasonable fallback. Signed-off-by: Gregor Jasny --- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 +- Source/cmGlobalGenerator.cxx | 11 ++++++----- Source/cmGlobalGenerator.h | 5 +++-- Source/cmGlobalNinjaGenerator.cxx | 6 ++++++ Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmake.cxx | 7 ++++++- 17 files changed, 35 insertions(+), 22 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 006239aac..ee255afbb 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -664,7 +664,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram, installProjectName, installDirectory, globalGenerator->GetPreinstallTargetName(), - buildConfig, false); + buildConfig, false, false); std::string buildCommandStr = cmSystemTools::PrintSingleCommand(buildCommand); cmCPackLogger(cmCPackLog::LOG_DEBUG, diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 4cdce71b7..08270375e 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -310,7 +310,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) output, this->BuildMakeProgram, config, !this->BuildNoClean, - false, remainingTime); + false, false, remainingTime); out << output; // if the build failed then return if (retVal) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 61470092f..36395aa67 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1677,14 +1677,14 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, newTarget, - output,"",config,false,fast, + output,"",config,false,fast,false, this->TryCompileTimeout); } void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const std::string&, const std::string&, const std::string&, const std::string&, - const std::string&, bool, + const std::string&, bool, bool, std::vector const&) { makeCommand.push_back( @@ -1697,7 +1697,7 @@ int cmGlobalGenerator::Build( std::string& output, const std::string& makeCommandCSTR, const std::string& config, - bool clean, bool fast, + bool clean, bool fast, bool verbose, double timeout, cmSystemTools::OutputOption outputflag, std::vector const& nativeOptions) @@ -1722,7 +1722,7 @@ int cmGlobalGenerator::Build( { std::vector cleanCommand; this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName, - bindir, "clean", config, fast); + bindir, "clean", config, fast, verbose); output += "\nRun Clean Command:"; output += cmSystemTools::PrintSingleCommand(cleanCommand); output += "\n"; @@ -1745,7 +1745,8 @@ int cmGlobalGenerator::Build( // now build std::vector makeCommand; this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, - bindir, target, config, fast, nativeOptions); + bindir, target, config, fast, verbose, + nativeOptions); std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand); output += "\nRun Build Command:"; output += makeCommandStr; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 08f061a6f..5b9ddee5b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -134,7 +134,7 @@ public: const std::string& projectName, const std::string& targetName, std::string& output, const std::string& makeProgram, const std::string& config, - bool clean, bool fast, + bool clean, bool fast, bool verbose, double timeout, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, std::vector const& nativeOptions = @@ -144,7 +144,8 @@ public: std::vector& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, - const std::string& targetName, const std::string& config, bool fast, + const std::string& targetName, const std::string& config, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3c07be114..69b1a9dc0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -574,12 +574,18 @@ void cmGlobalNinjaGenerator const std::string& targetName, const std::string& /*config*/, bool /*fast*/, + bool verbose, std::vector const& makeOptions) { makeCommand.push_back( this->SelectMakeProgram(makeProgram) ); + if(verbose) + { + makeCommand.push_back("-v"); + } + makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); if(!targetName.empty()) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3d443d8ed..c7bb7825e 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -196,7 +196,7 @@ public: const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index e0ccaa99d..1d2dd347d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -554,7 +554,7 @@ void cmGlobalUnixMakefileGenerator3 const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, - bool fast, + bool fast, bool /*verbose*/, std::vector const& makeOptions) { makeCommand.push_back( diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index c61c36e06..50a901e2f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -114,7 +114,7 @@ public: const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 531a714e7..7df207332 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -459,7 +459,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions) { // Select the caller- or user-preferred make program, else MSBuild. @@ -507,7 +507,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( // Use devenv to build solutions containing Intel Fortran projects. cmGlobalVisualStudio7Generator::GenerateBuildCommand( makeCommand, makeProgram, projectName, projectDir, - targetName, config, fast, makeOptions); + targetName, config, fast, verbose, makeOptions); return; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 3b0a5cfcd..92202ba6d 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -41,7 +41,7 @@ public: const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 455a7a2d9..62a308e1d 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -120,7 +120,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, - bool /*fast*/, + bool /*fast*/, bool /*verbose*/, std::vector const& makeOptions ) { diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 58efb2553..a59a0b2df 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -59,7 +59,7 @@ public: const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 401e4758d..0e0e63a9c 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -191,7 +191,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, - bool /*fast*/, + bool /*fast*/, bool /*verbose*/, std::vector const& makeOptions) { // Select the caller- or user-preferred make program, else devenv. diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index b591653e3..d641c025e 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -69,7 +69,7 @@ public: const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index aea134e11..e89161d70 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -310,7 +310,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, - bool /*fast*/, + bool /*fast*/, bool /*verbose*/, std::vector const& makeOptions) { // now build the test diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index f513e2839..b272f6a94 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -60,7 +60,7 @@ public: const std::string& projectDir, const std::string& targetName, const std::string& config, - bool fast, + bool fast, bool verbose, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 47be48157..80e90a8cb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2789,11 +2789,16 @@ int cmake::Build(const std::string& dir, return 1; } projName = it.GetValue(); + bool verbose = false; + if(it.Find("CMAKE_VERBOSE_MAKEFILE")) + { + verbose = it.GetValueAsBool(); + } return gen->Build("", dir, projName, target, output, "", - config, clean, false, 0, + config, clean, false, verbose, 0, cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions); } From d1082448a8d0a75974920690dcbad8895169bfd6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 26 Feb 2015 10:21:09 -0500 Subject: [PATCH 0243/1029] Tests: Extend RunCMake.CommandLine to cover 'cmake --build' for 'ninja -v' --- .../CommandLine/Build-ninja-v-stdout.txt | 1 + Tests/RunCMake/CommandLine/Build.cmake | 5 +++++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt create mode 100644 Tests/RunCMake/CommandLine/Build.cmake diff --git a/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt b/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt new file mode 100644 index 000000000..83c62ec99 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Build-ninja-v-stdout.txt @@ -0,0 +1 @@ +-E echo CustomCommand diff --git a/Tests/RunCMake/CommandLine/Build.cmake b/Tests/RunCMake/CommandLine/Build.cmake new file mode 100644 index 000000000..20df108ef --- /dev/null +++ b/Tests/RunCMake/CommandLine/Build.cmake @@ -0,0 +1,5 @@ +add_custom_command( + OUTPUT output.txt + COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt + ) +add_custom_target(CustomTarget ALL DEPENDS output.txt) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 2be6651fa..a9c49e788 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -18,6 +18,22 @@ run_cmake_command(build-no-generator run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +if(RunCMake_GENERATOR STREQUAL "Ninja") + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) + run_cmake(Build) + unset(RunCMake_TEST_OPTIONS) + run_cmake_command(Build-ninja-v ${CMAKE_COMMAND} --build .) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endif() + if(UNIX) run_cmake_command(E_create_symlink-missing-dir ${CMAKE_COMMAND} -E create_symlink T missing-dir/L From e3363bfbec592393780f9d769bd32334bcfd5953 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Thu, 26 Feb 2015 17:16:42 +0100 Subject: [PATCH 0244/1029] Help: Refine the .rst formatting of macro and function documentation --- Help/command/function.rst | 39 ++++++++++++++++++++------------------- Help/command/macro.rst | 30 +++++++++++++++--------------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/Help/command/function.rst b/Help/command/function.rst index b18e03cfe..5bbffbf45 100644 --- a/Help/command/function.rst +++ b/Help/command/function.rst @@ -1,9 +1,7 @@ function -------- -Start recording a function for later invocation as a command. - -:: +Start recording a function for later invocation as a command:: function( [arg1 [arg2 [arg3 ...]]]) COMMAND1(ARGS ...) @@ -11,21 +9,24 @@ Start recording a function for later invocation as a command. ... endfunction() -Define a function named that takes arguments named arg1 arg2 -arg3 (...). Commands listed after function, but before the matching -endfunction, are not invoked until the function is invoked. When it -is invoked, the commands recorded in the function are first modified -by replacing formal parameters (${arg1}) with the arguments passed, -and then invoked as normal commands. In addition to referencing the -formal parameters you can reference the variable ARGC which will be -set to the number of arguments passed into the function as well as -ARGV0 ARGV1 ARGV2 ... which will have the actual values of the -arguments passed in. This facilitates creating functions with -optional arguments. Additionally ARGV holds the list of all arguments -given to the function and ARGN holds the list of arguments past the -last expected argument. +Define a function named ```` that takes arguments named ``arg1``, +``arg2``, ``arg3``, (...). +Commands listed after function, but before the matching +:command:`endfunction()`, are not invoked until the function is invoked. +When it is invoked, the commands recorded in the function are first +modified by replacing formal parameters (``${arg1}``) with the arguments +passed, and then invoked as normal commands. +In addition to referencing the formal parameters you can reference the +``ARGC`` variable which will be set to the number of arguments passed +into the function as well as ``ARGV0``, ``ARGV1``, ``ARGV2``, ... which +will have the actual values of the arguments passed in. +This facilitates creating functions with optional arguments. +Additionally ``ARGV`` holds the list of all arguments given to the +function and ``ARGN`` holds the list of arguments past the last expected +argument. -A function opens a new scope: see set(var PARENT_SCOPE) for details. +A function opens a new scope: see :command:`set(var PARENT_SCOPE)` for +details. -See the cmake_policy() command documentation for the behavior of -policies inside functions. +See the :command:`cmake_policy()` command documentation for the behavior +of policies inside functions. diff --git a/Help/command/macro.rst b/Help/command/macro.rst index 258dc50aa..33249c914 100644 --- a/Help/command/macro.rst +++ b/Help/command/macro.rst @@ -1,9 +1,7 @@ macro ----- -Start recording a macro for later invocation as a command. - -:: +Start recording a macro for later invocation as a command:: macro( [arg1 [arg2 [arg3 ...]]]) COMMAND1(ARGS ...) @@ -11,22 +9,24 @@ Start recording a macro for later invocation as a command. ... endmacro() -Define a macro named that takes arguments named arg1 arg2 arg3 -(...). Commands listed after macro, but before the matching endmacro, -are not invoked until the macro is invoked. When it is invoked, the -commands recorded in the macro are first modified by replacing formal -parameters (``${arg1}``) with the arguments passed, and then invoked as -normal commands. In addition to referencing the formal parameters you -can reference the values ``${ARGC}`` which will be set to the number of -arguments passed into the function as well as ``${ARGV0}`` ``${ARGV1}`` -``${ARGV2}`` ... which will have the actual values of the arguments -passed in. This facilitates creating macros with optional arguments. +Define a macro named ```` that takes arguments named ``arg1``, +``arg2``, ``arg3``, (...). +Commands listed after macro, but before the matching +:command:`endmacro()`, are not invoked until the macro is invoked. +When it is invoked, the commands recorded in the macro are first +modified by replacing formal parameters (``${arg1}``) with the arguments +passed, and then invoked as normal commands. +In addition to referencing the formal parameters you can reference the +values ``${ARGC}`` which will be set to the number of arguments passed +into the function as well as ``${ARGV0}``, ``${ARGV1}``, ``${ARGV2}``, +... which will have the actual values of the arguments passed in. +This facilitates creating macros with optional arguments. Additionally ``${ARGV}`` holds the list of all arguments given to the macro and ``${ARGN}`` holds the list of arguments past the last expected argument. -See the cmake_policy() command documentation for the behavior of -policies inside macros. +See the :command:`cmake_policy()` command documentation for the behavior +of policies inside macros. Macro Argument Caveats ^^^^^^^^^^^^^^^^^^^^^^ From 4efef3f775e78bdcb4591dc37aa974bc28e8fd84 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 6 Feb 2015 16:53:44 +0100 Subject: [PATCH 0245/1029] Help: Clarify that ARGV# beyond ARGC will have an undefined behavior (#15380) --- Help/command/function.rst | 4 ++++ Help/command/macro.rst | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Help/command/function.rst b/Help/command/function.rst index 5bbffbf45..7ffdfee65 100644 --- a/Help/command/function.rst +++ b/Help/command/function.rst @@ -24,6 +24,10 @@ This facilitates creating functions with optional arguments. Additionally ``ARGV`` holds the list of all arguments given to the function and ``ARGN`` holds the list of arguments past the last expected argument. +Referencing to ``ARGV#`` arguments beyond ``ARGC`` have undefined +behavior. Checking that ``ARGC`` is greater than ``#`` is the only way +to ensure that ``ARGV#`` was passed to the function as an extra +argument. A function opens a new scope: see :command:`set(var PARENT_SCOPE)` for details. diff --git a/Help/command/macro.rst b/Help/command/macro.rst index 33249c914..6bee69c73 100644 --- a/Help/command/macro.rst +++ b/Help/command/macro.rst @@ -24,6 +24,10 @@ This facilitates creating macros with optional arguments. Additionally ``${ARGV}`` holds the list of all arguments given to the macro and ``${ARGN}`` holds the list of arguments past the last expected argument. +Referencing to ``${ARGV#}`` arguments beyond ``${ARGC}`` have undefined +behavior. Checking that ``${ARGC}`` is greater than ``#`` is the only +way to ensure that ``${ARGV#}`` was passed to the function as an extra +argument. See the :command:`cmake_policy()` command documentation for the behavior of policies inside macros. @@ -37,10 +41,15 @@ replacements much like the C preprocessor would do with a macro. Therefore you will NOT be able to use commands like:: if(ARGV1) # ARGV1 is not a variable + if(DEFINED ARGV2) # ARGV2 is not a variable + if(ARGC GREATER 2) # ARGC is not a variable foreach(loop_var IN LISTS ARGN) # ARGN is not a variable -In the first case you can use ``if(${ARGV1})``, in the second case, you can -use ``foreach(loop_var ${ARGN})`` but this will skip empty arguments. +In the first case, you can use ``if(${ARGV1})``. +In the second and third case, the proper way to check if an optional +variable was passed to the macro is to use ``if(${ARGC} GREATER 2)``. +In the last case, you can use ``foreach(loop_var ${ARGN})`` but this +will skip empty arguments. If you need to include them, you can use:: set(list_var "${ARGN}") From 4bef659da525441464ed110d362b46a6eac50a82 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 27 Feb 2015 00:01:09 -0500 Subject: [PATCH 0246/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b64641a19..8c0147954 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150226) +set(CMake_VERSION_PATCH 20150227) #set(CMake_VERSION_RC 1) From 3db740cb31afd32548bdeec5f1c35c6cfb3c0693 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Fri, 27 Feb 2015 00:36:25 +0100 Subject: [PATCH 0247/1029] CPackRPM: Consolidate CPackComponentsForAll test case coverage Use test infrastructure added by commit 1cbb1562 (Fix handling of relocation prefix parent directories, 2015-02-26) to cover the same use cases from tests added by commit 5857ca5e (CPackRPM: Drop explicit handling of '@' symbols that breaks them, 2015-01-07) and drop the latter. --- .../RunCPackVerifyResult.cmake | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 9b9ca0a9f..c7ec7094f 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -192,7 +192,11 @@ if(CPackGen MATCHES "RPM") set(spec_regex "*Unspecified*") set(check_content_list "^/usr/foo/bar /usr/foo/bar/bin -/usr/foo/bar/bin/mylibapp2$") +/usr/foo/bar/bin/@in@_@path@@with +/usr/foo/bar/bin/@in@_@path@@with/@and +/usr/foo/bar/bin/@in@_@path@@with/@and/@ +/usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@ +/usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2$") else() message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") endif() @@ -244,29 +248,5 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() - - # test package content - foreach(check_file ${expected_file}) - string(REGEX MATCH ".*Unspecified.*" check_file_Unspecified_match ${check_file}) - - if(check_file_Unspecified_match) - execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file} - OUTPUT_VARIABLE check_file_content - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - - string(REGEX MATCH ".*bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2$" check_at_in_path ${check_file_content}) - - if(NOT check_at_in_path) - file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*Unspecified*.spec") - - if(spec_file) - file(READ ${spec_file} spec_file_content) - endif() - - message(FATAL_ERROR "error: '${check_file}' rpm package path with @ characters is missing or invalid. RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") - endif() - endif() - endforeach() endif() endif() From 6bf130979e68201aac99c0d2009b50b26a389993 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Thu, 26 Feb 2015 09:00:10 -0500 Subject: [PATCH 0248/1029] CTest: Drop "Error in read script" message at end of testing A more-specific error message is always displayed earlier in the output if any real error occurred. This final summary message is distracting to readers searching through the output for the word "error". Simply drop it. --- Source/CTest/cmCTestScriptHandler.cxx | 6 +----- .../ctest_memcheck/DummyAddressSanitizer-stderr.txt | 1 - Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt | 1 - Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt | 1 - .../RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt | 1 - .../RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt | 1 - .../RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt | 1 - .../DummyUndefinedBehaviorSanitizer-stderr.txt | 1 - .../ctest_memcheck/DummyValgrindCustomOptions-stderr.txt | 1 - .../ctest_memcheck/DummyValgrindFailPost-stderr.txt | 1 - .../RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt | 1 - .../ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt | 1 - .../ctest_memcheck/DummyValgrindNoLogFile-stderr.txt | 1 - Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt | 1 - Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt | 1 - Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt | 1 - Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt | 1 - Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt | 1 - Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt | 1 - Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt | 1 - Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt | 1 - 21 files changed, 1 insertion(+), 25 deletions(-) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 8184bb459..379295379 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -454,12 +454,8 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) if (!this->Makefile->ReadListFile(0, script.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read script: " - << script - << std::endl); // Reset the error flag so that it can run more than - // one script with an error when you - // use ctest_run_script + // one script with an error when you use ctest_run_script. cmSystemTools::ResetErrorOccuredFlag(); return 2; } diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt index 00f477986..8fa3f1b8b 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt index 5c582ac2b..adc744b9f 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt @@ -1,3 +1,2 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-build/Testing/Temporary/MemoryChecker.1.log .*Error parsing XML in stream at line 1: no element found -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt index c09934019..35510431d 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt index 6c42ec1ba..02d562674 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt index 41120b593..653c1367e 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-build/Testing/Temporary/MemoryChecker.1.log -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt index cb353ad55..5f6c6c1a8 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt index 7ce798c04..423b7f704 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt index 97bb833cb..032b5b44f 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-build/Testing/Temporary/MemoryChecker.1.log -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt index 0c997ff2c..6f5231867 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt @@ -1,3 +1,2 @@ Problem running command: .*memcheck_fail.* Problem executing post-memcheck command\(s\). -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt index 1d1b1e7d9..973c01486 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt @@ -1,3 +1,2 @@ Problem running command: .*memcheck_fail.* Problem executing pre-memcheck command\(s\). -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt index 65beb81ad..42cd5e80b 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt @@ -1,2 +1 @@ Cannot find memory checker suppression file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-build/does-not-exist -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt index e2a836f39..18d9f035f 100644 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt @@ -1,2 +1 @@ Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-build/Testing/Temporary/MemoryChecker.1.log -Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt b/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt index 99df8b39b..8868e0c83 100644 --- a/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt +++ b/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt @@ -1,2 +1 @@ Do not understand memory checker: .*/cmake.* -Error in read script: .*/Tests/RunCMake/ctest_memcheck/Unknown/test.cmake diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt index ec0a8693f..adf334bba 100644 --- a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt +++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt @@ -1,4 +1,3 @@ *Error when uploading file: .*/Configure.xml *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) *Problems when submitting via HTTP - *Error in read script: .*/Tests/RunCMake/ctest_submit/CDashSubmitQuiet/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt index c3c084d5a..00a60ac91 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-cp-stderr.txt @@ -1,4 +1,3 @@ Missing arguments for submit via cp: .* Problems when submitting via CP -Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-cp/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt index 4345918bf..64c301132 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt @@ -1,3 +1,2 @@ Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) Problems when submitting via FTP -Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-ftp/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt index 9895181a6..73f013880 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt @@ -1,3 +1,2 @@ Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) Problems when submitting via HTTP -Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-http/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt index a9c5d58d7..a1ba4f636 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt @@ -1,3 +1,2 @@ Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*|Protocol "https" not supported or disabled in .*|.* was built with SSL disabled.*) Problems when submitting via HTTP -Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-https/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt index 07902977b..ef671499e 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-scp-stderr.txt @@ -1,2 +1 @@ Problems when submitting via SCP -Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-scp/test.cmake diff --git a/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt index 23ea92cc5..c0f718e76 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc-stderr.txt @@ -1,2 +1 @@ (Problems when submitting via XML-RPC|Submission method "xmlrpc" not compiled into CTest!) -Error in read script: .*/Tests/RunCMake/ctest_submit/FailDrop-xmlrpc/test.cmake From 6a661f06030b85b4484733375bbb0aa23eca7446 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 27 Feb 2015 16:32:03 +0100 Subject: [PATCH 0249/1029] CTest: To enforce the C locale use LC_ALL instead of LC_MESSAGES. If LC_ALL is set it takes precedence over LC_MESSAGES. --- Source/CTest/cmCTestUpdateHandler.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index b18786a32..b9da8a01d 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -72,37 +72,37 @@ public: cmCTestUpdateHandlerLocale(); ~cmCTestUpdateHandlerLocale(); private: - std::string saveLCMessages; + std::string saveLCAll; }; cmCTestUpdateHandlerLocale::cmCTestUpdateHandlerLocale() { - const char* lcmess = cmSystemTools::GetEnv("LC_MESSAGES"); - if(lcmess) + const char* lcall = cmSystemTools::GetEnv("LC_ALL"); + if(lcall) { - saveLCMessages = lcmess; + saveLCAll = lcall; } - // if LC_MESSAGES is not set to C, then + // if LC_ALL is not set to C, then // set it, so that svn/cvs info will be in english ascii - if(! (lcmess && strcmp(lcmess, "C") == 0)) + if(! (lcall && strcmp(lcall, "C") == 0)) { - cmSystemTools::PutEnv("LC_MESSAGES=C"); + cmSystemTools::PutEnv("LC_ALL=C"); } } cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale() { - // restore the value of LC_MESSAGES after running the version control + // restore the value of LC_ALL after running the version control // commands - if(!saveLCMessages.empty()) + if(!saveLCAll.empty()) { - std::string put = "LC_MESSAGES="; - put += saveLCMessages; + std::string put = "LC_ALL="; + put += saveLCAll; cmSystemTools::PutEnv(put); } else { - cmSystemTools::UnsetEnv("LC_MESSAGES"); + cmSystemTools::UnsetEnv("LC_ALL"); } } From a7631fc4e026f2e330b10eae73f473f240c3d0c1 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Thu, 26 Feb 2015 17:26:12 +0100 Subject: [PATCH 0250/1029] Modules: Check for ARGC before using ARGV# ARGV# could be defined from a parent scope. --- Modules/BundleUtilities.cmake | 6 +- Modules/DeployQt4.cmake | 90 ++++++++++++++++++++++++------ Modules/ExternalProject.cmake | 2 +- Modules/FeatureSummary.cmake | 10 +++- Modules/FindPkgConfig.cmake | 2 +- Modules/GenerateExportHeader.cmake | 2 +- Modules/GetPrerequisites.cmake | 36 ++++++++---- Modules/Qt4Macros.cmake | 12 +++- 8 files changed, 121 insertions(+), 39 deletions(-) diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index ce90f305c..b7975d3ea 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -457,7 +457,11 @@ endfunction() function(set_bundle_key_values keys_var context item exepath dirs copyflag) - set(rpaths "${ARGV6}") + if(ARGC GREATER 6) + set(rpaths "${ARGV6}") + else() + set(rpaths "") + endif() get_filename_component(item_name "${item}" NAME) get_item_key("${item}" key) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index b1a2370b4..de475e45f 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -126,7 +126,10 @@ function(write_qt4_conf qt_conf_dir qt_conf_contents) endfunction() function(resolve_qt4_paths paths_var) - set(executable_path ${ARGV1}) + unset(executable_path) + if(ARGC GREATER 1) + set(executable_path ${ARGV1}) + endif() set(paths_resolved) foreach(path ${${paths_var}}) @@ -144,11 +147,26 @@ function(resolve_qt4_paths paths_var) endfunction() function(fixup_qt4_executable executable) - set(qtplugins ${ARGV1}) - set(libs ${ARGV2}) - set(dirs ${ARGV3}) - set(plugins_dir ${ARGV4}) - set(request_qt_conf ${ARGV5}) + unset(qtplugins) + if(ARGC GREATER 1) + set(qtplugins ${ARGV1}) + endif() + unset(libs) + if(ARGC GREATER 2) + set(libs ${ARGV2}) + endif() + unset(dirs) + if(ARGC GREATER 3) + set(dirs ${ARGV3}) + endif() + unset(plugins_dir) + if(ARGC GREATER 4) + set(plugins_dir ${ARGV4}) + endif() + unset(request_qt_conf) + if(ARGC GREATER 5) + set(request_qt_conf ${ARGV5}) + endif() message(STATUS "fixup_qt4_executable") message(STATUS " executable='${executable}'") @@ -169,7 +187,7 @@ function(fixup_qt4_executable executable) set(qt_conf_dir "${executable}/Contents/Resources") set(executable_path "${executable}") set(write_qt_conf TRUE) - if(NOT plugins_dir) + if(NOT DEFINED plugins_dir) set(plugins_dir "${DeployQt4_apple_plugins_dir}") endif() else() @@ -204,9 +222,19 @@ function(fixup_qt4_executable executable) endfunction() function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var) - set(plugins_dir ${ARGV4}) - set(component ${ARGV5}) - set(configurations ${ARGV6}) + unset(plugins_dir) + if(ARGC GREATER 4) + set(plugins_dir ${ARGV4}) + endif() + unset(component) + if(ARGC GREATER 5) + set(component ${ARGV5}) + endif() + unset(configurations) + if(ARGC GREATER 6) + set(configurations ${ARGV6}) + endif() + if(EXISTS "${plugin}") if(APPLE) if(NOT plugins_dir) @@ -253,8 +281,15 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va endfunction() function(install_qt4_plugin plugin executable copy installed_plugin_path_var) - set(plugins_dir ${ARGV4}) - set(component ${ARGV5}) + unset(plugins_dir) + if(ARGC GREATER 4) + set(plugins_dir ${ARGV4}) + endif() + unset(component) + if(ARGC GREATER 5) + set(component ${ARGV5}) + endif() + if(EXISTS "${plugin}") install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}") else() @@ -287,12 +322,31 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) endfunction() function(install_qt4_executable executable) - set(qtplugins ${ARGV1}) - set(libs ${ARGV2}) - set(dirs ${ARGV3}) - set(plugins_dir ${ARGV4}) - set(request_qt_conf ${ARGV5}) - set(component ${ARGV6}) + unset(qtplugins) + if(ARGC GREATER 1) + set(qtplugins ${ARGV1}) + endif() + unset(libs) + if(ARGC GREATER 2) + set(libs ${ARGV2}) + endif() + unset(dirs) + if(ARGC GREATER 3) + set(dirs ${ARGV3}) + endif() + unset(plugins_dir) + if(ARGC GREATER 4) + set(plugins_dir ${ARGV4}) + endif() + unset(request_qt_conf) + if(ARGC GREATER 5) + set(request_qt_conf ${ARGV5}) + endif() + unset(component) + if(ARGC GREATER 6) + set(component ${ARGV6}) + endif() + if(QT_LIBRARY_DIR) list(APPEND dirs "${QT_LIBRARY_DIR}") endif() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 74e8ae27f..1f9f4d3e8 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1360,7 +1360,7 @@ endfunction() function(ExternalProject_Add_StepTargets name) set(steps ${ARGN}) - if("${ARGV1}" STREQUAL "NO_DEPENDS") + if(ARGC GREATER 1 AND "${ARGV1}" STREQUAL "NO_DEPENDS") set(no_deps 1) list(REMOVE_AT steps 0) endif() diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index ce5a4ed60..dc3108623 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -562,8 +562,14 @@ endfunction() # The stuff below is only kept for compatibility function(SET_PACKAGE_INFO _name _desc) - set(_url "${ARGV2}") - set(_purpose "${ARGV3}") + unset(_url) + unset(_purpose) + if(ARGC GREATER 2) + set(_url "${ARGV2}") + endif() + if(ARGC GREATER 3) + set(_purpose "${ARGV3}") + endif() set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) if(NOT _url STREQUAL "") set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" ) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index bf58ede56..64ccde586 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -143,7 +143,7 @@ endmacro() # - _pkgconfig_add_extra_path(_extra_paths ENV VAR) function(_pkgconfig_add_extra_path _extra_paths_var _var) set(_is_env 0) - if(_var STREQUAL "ENV") + if(ARGC GREATER 2 AND _var STREQUAL "ENV") set(_var ${ARGV2}) set(_is_env 1) endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 0c6256cf7..aab29eac4 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -395,7 +395,7 @@ function(add_compiler_export_flags) # Either return the extra flags needed in the supplied argument, or to the # CMAKE_CXX_FLAGS if no argument is supplied. - if(ARGV0) + if(ARGC GREATER 0) set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 9fb85feb1..23d486ead 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -330,7 +330,11 @@ endfunction() function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 0) set(resolved_item "${item}") - set(rpaths "${ARGV5}") + if(ARGC GREATER 5) + set(rpaths "${ARGV5}") + else() + set(rpaths "") + endif() # Is it already resolved? # @@ -481,7 +485,11 @@ endfunction() function(gp_resolved_file_type original_file file exepath dirs type_var) - set(rpaths "${ARGV5}") + if(ARGC GREATER 5) + set(rpaths "${ARGV5}") + else() + set(rpaths "") + endif() #message(STATUS "**") if(NOT IS_ABSOLUTE "${original_file}") @@ -623,7 +631,11 @@ endfunction() function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs) set(verbose 0) set(eol_char "E") - set(rpaths "${ARGV6}") + if(ARGC GREATER 6) + set(rpaths "${ARGV6}") + else() + set(rpaths "") + endif() if(NOT IS_ABSOLUTE "${target}") message("warning: target '${target}' is not absolute...") @@ -881,22 +893,22 @@ endfunction() function(list_prerequisites target) - if("${ARGV1}" STREQUAL "") - set(all 1) - else() + if(ARGC GREATER 1 AND NOT "${ARGV1}" STREQUAL "") set(all "${ARGV1}") + else() + set(all 1) endif() - if("${ARGV2}" STREQUAL "") - set(exclude_system 0) - else() + if(ARGC GREATER 2 AND NOT "${ARGV2}" STREQUAL "") set(exclude_system "${ARGV2}") + else() + set(exclude_system 0) endif() - if("${ARGV3}" STREQUAL "") - set(verbose 0) - else() + if(ARGC GREATER 3 AND NOT "${ARGV3}" STREQUAL "") set(verbose "${ARGV3}") + else() + set(verbose 0) endif() set(count 0) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 6516b0a27..3b0a6cc26 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -158,7 +158,7 @@ macro (QT4_GENERATE_MOC infile outfile ) set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") endif() - if ("x${ARGV2}" STREQUAL "xTARGET") + if (${ARGC} GREATER 3 AND "x${ARGV2}" STREQUAL "xTARGET") set(moc_target ${ARGV3}) endif() QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") @@ -329,7 +329,10 @@ endmacro() macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) get_filename_component(_infile ${_xml_file} ABSOLUTE) - set(_optionalBasename "${ARGV4}") + unset(_optionalBasename) + if(${ARGC} GREATER 4) + set(_optionalBasename "${ARGV4}") + endif() if (_optionalBasename) set(_basename ${_optionalBasename} ) else () @@ -337,7 +340,10 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional string(TOLOWER ${_basename} _basename) endif () - set(_optionalClassName "${ARGV5}") + unset(_optionalClassName) + if(${ARGC} GREATER 5) + set(_optionalClassName "${ARGV5}") + endif() set(_header "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h") set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") From ae09fce8319112f8a401a843d4297e7c157a112a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 28 Feb 2015 00:01:09 -0500 Subject: [PATCH 0251/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8c0147954..e7ce8dd0d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150227) +set(CMake_VERSION_PATCH 20150228) #set(CMake_VERSION_RC 1) From cfb22354b8bff1f7eddc117616a80774d456f467 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 28 Feb 2015 14:22:41 +0100 Subject: [PATCH 0252/1029] FindHg: Run hg with C locale when querying its version. LANGUAGE should be ignored when LC_ALL=C. It seems this isn't the case with hg so set both. --- Modules/FindHg.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake index 34d763edc..bdbb79b19 100644 --- a/Modules/FindHg.cmake +++ b/Modules/FindHg.cmake @@ -63,11 +63,21 @@ find_program(HG_EXECUTABLE mark_as_advanced(HG_EXECUTABLE) if(HG_EXECUTABLE) + set(_saved_lc_all "$ENV{LC_ALL}") + set(ENV{LC_ALL} "C") + + set(_saved_language "$ENV{LANGUAGE}") + set(ENV{LANGUAGE}) + execute_process(COMMAND ${HG_EXECUTABLE} --version OUTPUT_VARIABLE hg_version ERROR_QUIET RESULT_VARIABLE hg_result OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(ENV{LC_ALL} ${_saved_lc_all}) + set(ENV{LANGUAGE} ${_saved_language}) + if(hg_result MATCHES "is not a valid Win32 application") set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND") endif() From 1c29a5583c55f5388f0be230f9cffa660398968e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 1 Mar 2015 00:01:09 -0500 Subject: [PATCH 0253/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e7ce8dd0d..1521c21a9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150228) +set(CMake_VERSION_PATCH 20150301) #set(CMake_VERSION_RC 1) From a8b2224eb64e9a8b55634ba40dc1354bd3880d3d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 2 Mar 2015 00:01:08 -0500 Subject: [PATCH 0254/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1521c21a9..22af221ca 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150301) +set(CMake_VERSION_PATCH 20150302) #set(CMake_VERSION_RC 1) From 7c9afb573844fdef0a8c29bb7f8c4474b910d83f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 27 Feb 2015 11:12:18 -0500 Subject: [PATCH 0255/1029] KWSys 2015-02-27 (d2aa1afd) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ d2aa1afd | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 1b75ad3d..d2aa1afd Paul Martin (1): d2aa1afd SystemTools: Update CopyFileAlways stream library workarounds Change-Id: I676f2f11ac0d52f7ffc3af5bb444d3726c121be0 --- SystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SystemTools.cxx b/SystemTools.cxx index bf6f458e1..8a481d654 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2375,6 +2375,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st { fout.write(buffer, fin.gcount()); } + else + { + break; + } } // Make sure the operating system has finished writing the file From 3b9f963f3fb1db05e90cfad606c62a7b3e9b18dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=94=D0=BE=D0=BD=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sun, 1 Mar 2015 02:38:52 +0300 Subject: [PATCH 0256/1029] CPack: be more stringent when selecting variables to encode The old version would admit, for example, a variable named "xxxCPACK". --- Modules/CPack.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index ce1536ef9..532596dc9 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -314,7 +314,7 @@ macro(cpack_encode_variables) set(_CPACK_OTHER_VARIABLES_) get_cmake_property(res VARIABLES) foreach(var ${res}) - if("xxx${var}" MATCHES "xxxCPACK") + if(var MATCHES "^CPACK") set(_CPACK_OTHER_VARIABLES_ "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") endif() From 3e98ebbaef9cfa1544f960320ebc4258e82909bd Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 2 Mar 2015 10:08:09 -0500 Subject: [PATCH 0257/1029] JOM: Pass /NOLOGO when driving builds as is done for NMake This fixes RunCMake.(Configure|configure_file|try_compile) test failures that failed to match empty stderr due to jom printing its identification line. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 1d2dd347d..570156434 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -563,7 +563,7 @@ void cmGlobalUnixMakefileGenerator3 // Since we have full control over the invocation of nmake, let us // make it quiet. - if ( this->GetName() == "NMake Makefiles" ) + if (cmHasLiteralPrefix(this->GetName(), "NMake Makefiles")) { makeCommand.push_back("/NOLOGO"); } From 02611986539366644661138153ebf816a0febd61 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 3 Mar 2015 00:01:09 -0500 Subject: [PATCH 0258/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 22af221ca..e4956c880 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150302) +set(CMake_VERSION_PATCH 20150303) #set(CMake_VERSION_RC 1) From d6a320ab5ef12459b98fae2711b9a386b4a01466 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 3 Mar 2015 09:14:29 -0500 Subject: [PATCH 0259/1029] InstallRequiredSystemLibraries: Format documentation --- Modules/InstallRequiredSystemLibraries.cmake | 59 +++++++++++--------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 5afb517d6..bd7f5b2d6 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -2,33 +2,42 @@ # InstallRequiredSystemLibraries # ------------------------------ # +# Include this module to search for compiler-provided system runtime +# libraries and add install rules for them. Some optional variables +# may be set prior to including the module to adjust behavior: # +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` +# Specify additional runtime libraries that may not be detected. +# After inclusion any detected libraries will be appended to this. # -# By including this file, all library files listed in the variable -# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will be installed with -# install(PROGRAMS ...) into bin for WIN32 and lib for non-WIN32. If -# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP is set to TRUE before including -# this file, then the INSTALL command is not called. The user can use -# the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a custom install -# command and install them however they want. If it is the MSVC -# compiler, then the microsoft run time libraries will be found and -# automatically added to the CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS, and -# installed. If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC -# compiler, then the debug libraries are installed when available. If -# CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY is set then only the debug -# libraries are installed when both debug and release are available. If -# CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time libraries are -# installed as well as the CRT run time libraries. If -# CMAKE_INSTALL_OPENMP_LIBRARIES is set then the OpenMP run time libraries -# are installed as well. If -# CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are -# installed to that directory rather than the default. If -# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this -# file warns about required files that do not exist. You can set this -# variable to ON before including this file to avoid the warning. For -# example, the Visual Studio Express editions do not include the -# redistributable files, so if you include this file on a machine with -# only VS Express installed, you'll get the warning. +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP`` +# Set to TRUE to skip calling the :command:`install(PROGRAMS)` command to +# allow the includer to specify its own install rule, using the value of +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` to get the list of libraries. +# +# ``CMAKE_INSTALL_DEBUG_LIBRARIES`` +# Set to TRUE to install the debug runtime libraries when available +# with MSVC tools. +# +# ``CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY`` +# Set to TRUE to install only the debug runtime libraries with MSVC +# tools even if the release runtime libraries are also available. +# +# ``CMAKE_INSTALL_MFC_LIBRARIES`` +# Set to TRUE to install the MSVC MFC runtime libraries. +# +# ``CMAKE_INSTALL_OPENMP_LIBRARIES`` +# Set to TRUE to install the MSVC OpenMP runtime libraries +# +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION`` +# Specify the :command:`install(PROGRAMS)` command ``DESTINATION`` +# option. If not specified, the default is ``bin`` on Windows +# and ``lib`` elsewhere. +# +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS`` +# Set to TRUE to disable warnings about required library files that +# do not exist. (For example, Visual Studio Express editions may +# not provide the redistributable files.) #============================================================================= # Copyright 2006-2009 Kitware, Inc. From e97141c2bc11d1cda3adc2579eeab53620d3b921 Mon Sep 17 00:00:00 2001 From: Johan Andruejol Date: Mon, 2 Mar 2015 14:28:14 -0500 Subject: [PATCH 0260/1029] InstallRequiredSystemLibraries: Add option to specify install COMPONENT Previously the module did not support projects using installation components because install(PROGRAMS) was never called with COMPONENT. Add an option to specify the COMPONENT so that projects doing this do not have to resort to using CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP and writing the install rule by hand. --- .../InstallRequiredSystemLibraries-COMPONENT.rst | 6 ++++++ Modules/InstallRequiredSystemLibraries.cmake | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst diff --git a/Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst b/Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst new file mode 100644 index 000000000..e6ebc2de6 --- /dev/null +++ b/Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst @@ -0,0 +1,6 @@ +InstallRequiredSystemLibraries-COMPONENT +---------------------------------------- + +* The :module:`InstallRequiredSystemLibraries` module learned a new + ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT`` option to specify the + installation component. diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index bd7f5b2d6..c7e88baf5 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -38,9 +38,13 @@ # Set to TRUE to disable warnings about required library files that # do not exist. (For example, Visual Studio Express editions may # not provide the redistributable files.) +# +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT`` +# Specify the :command:`install(PROGRAMS)` command ``COMPONENT`` +# option. If not specified, no such option will be used. #============================================================================= -# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2015 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -486,7 +490,13 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib) endif() endif() + if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT) + set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT + COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}) + endif() install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} - DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}) + DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION} + ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT} + ) endif() endif() From ebcb75e62658ac5060a71f3153f1de72c9c613e1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 4 Mar 2015 00:01:09 -0500 Subject: [PATCH 0261/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e4956c880..1dc871290 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150303) +set(CMake_VERSION_PATCH 20150304) #set(CMake_VERSION_RC 1) From aa84d26e631e11d73328c24ac0301c43f661869b Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 3 Mar 2015 08:50:09 -0500 Subject: [PATCH 0262/1029] KWSys 2015-03-03 (4890f30c) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 4890f30c | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' d2aa1afd..4890f30c Domen Vrankar (2): 5d6204e9 Glob: Handle symlink cycles in directory paths 4890f30c Glob: Add support for directory listing Change-Id: Id8b77dabf8f50efeffdeaf1c826154fd2a25e17b --- Glob.cxx | 93 ++++++++++++++++++++++++++++++++++++++++++++++------- Glob.hxx.in | 47 ++++++++++++++++++++++++--- 2 files changed, 124 insertions(+), 16 deletions(-) diff --git a/Glob.cxx b/Glob.cxx index 1476c25e3..11bfd16b1 100644 --- a/Glob.cxx +++ b/Glob.cxx @@ -19,6 +19,7 @@ #include KWSYS_HEADER(Directory.hxx) #include KWSYS_HEADER(stl/string) #include KWSYS_HEADER(stl/vector) +#include KWSYS_HEADER(stl/algorithm) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -30,6 +31,8 @@ # include "SystemTools.hxx.in" # include "kwsys_stl.hxx.in" # include "kwsys_stl_string.hxx.in" +# include "kwsys_stl_vector.hxx.in" +# include "kwsys_stl_algorithm.hxx.in" #endif #include @@ -66,6 +69,10 @@ Glob::Glob() // RecurseThroughSymlinks is true by default for backwards compatibility, // not because it's a good idea... this->FollowedSymlinkCount = 0; + + // Keep separate variables for directory listing for back compatibility + this->ListDirs = true; + this->RecurseListDirs = false; } //---------------------------------------------------------------------------- @@ -214,13 +221,13 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern, } //---------------------------------------------------------------------------- -void Glob::RecurseDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir) +bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, + const kwsys_stl::string& dir, GlobMessages* messages) { kwsys::Directory d; if ( !d.Load(dir) ) { - return; + return true; } unsigned long cc; kwsys_stl::string realname; @@ -255,8 +262,67 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, if (isSymLink) { ++this->FollowedSymlinkCount; + kwsys_stl::string realPathErrorMessage; + kwsys_stl::string canonicalPath(SystemTools::GetRealPath(dir, + &realPathErrorMessage)); + + if(!realPathErrorMessage.empty()) + { + if(messages) + { + messages->push_back(Message( + Glob::error, "Canonical path generation from path '" + + dir + "' failed! Reason: '" + realPathErrorMessage + "'")); + } + return false; + } + + if(kwsys_stl::find(this->VisitedSymlinks.begin(), + this->VisitedSymlinks.end(), + canonicalPath) == this->VisitedSymlinks.end()) + { + if(this->RecurseListDirs) + { + // symlinks are treated as directories + this->AddFile(this->Internals->Files, realname); + } + + this->VisitedSymlinks.push_back(canonicalPath); + if(!this->RecurseDirectory(start+1, realname, messages)) + { + this->VisitedSymlinks.pop_back(); + + return false; + } + this->VisitedSymlinks.pop_back(); + } + // else we have already visited this symlink - prevent cyclic recursion + else if(messages) + { + kwsys_stl::string message; + for(kwsys_stl::vector::const_iterator + pathIt = kwsys_stl::find(this->VisitedSymlinks.begin(), + this->VisitedSymlinks.end(), + canonicalPath); + pathIt != this->VisitedSymlinks.end(); ++pathIt) + { + message += *pathIt + "\n"; + } + message += canonicalPath + "/" + fname; + messages->push_back(Message(Glob::cyclicRecursion, message)); + } + } + else + { + if(this->RecurseListDirs) + { + this->AddFile(this->Internals->Files, realname); + } + if(!this->RecurseDirectory(start+1, realname, messages)) + { + return false; + } } - this->RecurseDirectory(start+1, realname); } else { @@ -267,17 +333,19 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, } } } + + return true; } //---------------------------------------------------------------------------- void Glob::ProcessDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir) + const kwsys_stl::string& dir, GlobMessages* messages) { //kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl; bool last = ( start == this->Internals->Expressions.size()-1 ); if ( last && this->Recurse ) { - this->RecurseDirectory(start, dir); + this->RecurseDirectory(start, dir, messages); return; } @@ -321,8 +389,9 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl; //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl; - if ( !last && - !kwsys::SystemTools::FileIsDirectory(realname) ) + if( (!last && !kwsys::SystemTools::FileIsDirectory(realname)) + || (!this->ListDirs && last && + kwsys::SystemTools::FileIsDirectory(realname)) ) { continue; } @@ -335,14 +404,14 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, } else { - this->ProcessDirectory(start+1, realname); + this->ProcessDirectory(start+1, realname, messages); } } } } //---------------------------------------------------------------------------- -bool Glob::FindFiles(const kwsys_stl::string& inexpr) +bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages) { kwsys_stl::string cexpr; kwsys_stl::string::size_type cc; @@ -438,11 +507,11 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr) // Handle network paths if ( skip > 0 ) { - this->ProcessDirectory(0, fexpr.substr(0, skip) + "/"); + this->ProcessDirectory(0, fexpr.substr(0, skip) + "/", messages); } else { - this->ProcessDirectory(0, "/"); + this->ProcessDirectory(0, "/", messages); } return true; } diff --git a/Glob.hxx.in b/Glob.hxx.in index d8b8491dc..39b7ce7e7 100644 --- a/Glob.hxx.in +++ b/Glob.hxx.in @@ -39,12 +39,37 @@ class GlobInternals; */ class @KWSYS_NAMESPACE@_EXPORT Glob { +public: + enum MessageType + { + error, + cyclicRecursion + }; + + struct Message + { + MessageType type; + kwsys_stl::string content; + + Message(MessageType t, const kwsys_stl::string& c) : + type(t), + content(c) + {} + Message(const Message& msg) : + type(msg.type), + content(msg.content) + {} + }; + + typedef kwsys_stl::vector GlobMessages; + typedef kwsys_stl::vector::iterator GlobMessagesIterator; public: Glob(); ~Glob(); //! Find all files that match the pattern. - bool FindFiles(const kwsys_stl::string& inexpr); + bool FindFiles(const kwsys_stl::string& inexpr, + GlobMessages* messages = 0); //! Return the list of files that matched. kwsys_stl::vector& GetFiles(); @@ -80,15 +105,26 @@ public: bool require_whole_string = true, bool preserve_case = false); + /** Getters and setters for enabling and disabling directory + listing in recursive and non recursive globbing mode. + If listing is enabled in recursive mode it also lists + directory symbolic links even if follow symlinks is enabled. */ + void SetListDirs(bool list) { this->ListDirs=list; } + bool GetListDirs() const { return this->ListDirs; } + void SetRecurseListDirs(bool list) { this->RecurseListDirs=list; } + bool GetRecurseListDirs() const { return this->RecurseListDirs; } + protected: //! Process directory void ProcessDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir); + const kwsys_stl::string& dir, + GlobMessages* messages); //! Process last directory, but only when recurse flags is on. That is // effectively like saying: /path/to/file/**/file - void RecurseDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir); + bool RecurseDirectory(kwsys_stl::string::size_type start, + const kwsys_stl::string& dir, + GlobMessages* messages); //! Add regular expression void AddExpression(const kwsys_stl::string& expr); @@ -101,6 +137,9 @@ protected: kwsys_stl::string Relative; bool RecurseThroughSymlinks; unsigned int FollowedSymlinkCount; + kwsys_stl::vector VisitedSymlinks; + bool ListDirs; + bool RecurseListDirs; private: Glob(const Glob&); // Not implemented. From 67a74c44541ed42b6898e98c87f4a9f625f9a458 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 5 Mar 2015 00:01:09 -0500 Subject: [PATCH 0263/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1dc871290..1660cd876 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150304) +set(CMake_VERSION_PATCH 20150305) #set(CMake_VERSION_RC 1) From 8f38b8a4433b26da8f64b705fa82e520c40106d5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 6 Mar 2015 00:01:09 -0500 Subject: [PATCH 0264/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1660cd876..3ca0984db 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150305) +set(CMake_VERSION_PATCH 20150306) #set(CMake_VERSION_RC 1) From 099b0cab1d12b5b3734342ac516c8d42c78cdef7 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 6 Mar 2015 09:48:33 +0100 Subject: [PATCH 0265/1029] CodeBlocks: Declare which source file belongs to which targets. This should allow the consuming IDE to determine which target specific preprocessor definitions and include directories are relevant for a given source file. --- Source/cmExtraCodeBlocksGenerator.cxx | 71 ++++++++++++++------------- Source/cmExtraCodeBlocksGenerator.h | 4 ++ 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef3e..d46d9417e 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -376,11 +376,13 @@ void cmExtraCodeBlocksGenerator fout<<" \n"; - // Collect all used source files in the project - // Sort them into two containers, one for C/C++ implementation files - // which may have an acompanying header, one for all other files - std::map cFiles; - std::set otherFiles; + // Collect all used source files in the project. + // Keep a list of C/C++ source files which might have an acompanying header + // that should be looked for. + typedef std::map all_files_map_t; + all_files_map_t allFiles; + std::vector cFiles; + for (std::vector::const_iterator lg=lgs.begin(); lg!=lgs.end(); lg++) { @@ -429,15 +431,15 @@ void cmExtraCodeBlocksGenerator } } - // then put it accordingly into one of the two containers - if (isCFile) + std::string fullPath = (*si)->GetFullPath(); + + if(isCFile) { - cFiles[(*si)->GetFullPath()] = *si ; - } - else - { - otherFiles.insert((*si)->GetFullPath()); + cFiles.push_back(fullPath); } + + CbpUnit &cbpUnit = allFiles[fullPath]; + cbpUnit.Targets.push_back(&(ti->second)); } } default: // intended fallthrough @@ -447,19 +449,21 @@ void cmExtraCodeBlocksGenerator } // The following loop tries to add header files matching to implementation - // files to the project. It does that by iterating over all source files, + // files to the project. It does that by iterating over all + // C/C++ source files, // replacing the file name extension with ".h" and checks whether such a // file exists. If it does, it is inserted into the map of files. // A very similar version of that code exists also in the kdevelop // project generator. - for (std::map::const_iterator + for (std::vector::const_iterator sit=cFiles.begin(); sit!=cFiles.end(); ++sit) { - std::string headerBasename=cmSystemTools::GetFilenamePath(sit->first); + std::string const& fileName = *sit; + std::string headerBasename=cmSystemTools::GetFilenamePath(fileName); headerBasename+="/"; - headerBasename+=cmSystemTools::GetFilenameWithoutExtension(sit->first); + headerBasename+=cmSystemTools::GetFilenameWithoutExtension(fileName); // check if there's a matching header around for(std::vector::const_iterator @@ -471,37 +475,38 @@ void cmExtraCodeBlocksGenerator hname += "."; hname += *ext; // if it's already in the set, don't check if it exists on disk - std::set::const_iterator headerIt=otherFiles.find(hname); - if (headerIt != otherFiles.end()) + if (allFiles.find(hname) != allFiles.end()) { break; } if(cmSystemTools::FileExists(hname.c_str())) { - otherFiles.insert(hname); + allFiles[hname].Targets = allFiles[fileName].Targets; break; } } } // insert all source files in the CodeBlocks project - // first the C/C++ implementation files, then all others - for (std::map::const_iterator - sit=cFiles.begin(); - sit!=cFiles.end(); + for (all_files_map_t::const_iterator + sit=allFiles.begin(); + sit!=allFiles.end(); ++sit) { - fout<<" first <<"\">\n" - " \n"; - } - for (std::set::const_iterator - sit=otherFiles.begin(); - sit!=otherFiles.end(); - ++sit) - { - fout<<" \n" - " \n"; + std::string const& unitFilename = sit->first; + CbpUnit const& unit = sit->second; + + fout<<" \n"; + + for(std::vector::const_iterator ti = unit.Targets.begin(); + ti != unit.Targets.end(); ++ti) + { + std::string const& targetName = (*ti)->GetName(); + fout<<" \n"; } // Add CMakeLists.txt diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 0435ad8c9..97da1b862 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -39,6 +39,10 @@ public: virtual void Generate(); private: + struct CbpUnit + { + std::vector Targets; + }; void CreateProjectFile(const std::vector& lgs); From c771f9d945444f6cfe41195e26653f368aff7f42 Mon Sep 17 00:00:00 2001 From: Joseph Snyder Date: Fri, 6 Mar 2015 11:18:19 -0500 Subject: [PATCH 0266/1029] CTest: Fix Jacoco Coverage Rename the example jacoco.xml file to be jacoco.xml.in to stop CMake from apptempting to calculate Jacoco Coverage when running over itself. Enclose a push of -1 to the coverage vector to only happen if there is a fin to calculate for. This prevents a crash if the target file doesn't exist. --- Source/CTest/cmParseJacocoCoverage.cxx | 5 ++++- Tests/CMakeLists.txt | 2 ++ .../Coverage/target/site/{jacoco.xml => jacoco.xml.in} | 0 3 files changed, 6 insertions(+), 1 deletion(-) rename Tests/JacocoCoverage/Coverage/target/site/{jacoco.xml => jacoco.xml.in} (100%) diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index ec4cfadd6..31ad9febc 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -78,7 +78,10 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser std::string line; FileLinesType& curFileLines = this->Coverage.TotalCoverage[this->CurFileName]; - curFileLines.push_back(-1); + if(fin) + { + curFileLines.push_back(-1); + } while(cmSystemTools::GetLineFromStream(fin, line)) { curFileLines.push_back(-1); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 08765de85..703c54823 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2409,6 +2409,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl") file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage" DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage") + configure_file("${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml.in" + "${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml") add_test(NAME CTestJacocoCoverage COMMAND cmake -E chdir ${CMake_BINARY_DIR}/Testing/JacocoCoverage diff --git a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in similarity index 100% rename from Tests/JacocoCoverage/Coverage/target/site/jacoco.xml rename to Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in From b0852ebc09eec44041e8aa624ec4bb17bda14dac Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 6 Mar 2015 20:40:53 +0100 Subject: [PATCH 0267/1029] CPackWIX: Support patching of root elements. --- Modules/CPackWIX.cmake | 6 ++++-- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 105df96fc..5fe51a641 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -148,8 +148,10 @@ # Currently fragments can be injected into most # Component, File and Directory elements. # -# The special Id ``#PRODUCT`` can be used to inject content -# into the ```` element. +# The following additional special Ids can be used: +# +# * ``#PRODUCT`` for the ```` element. +# * ``#PRODUCTFEATURE`` for the root ```` element. # # The following example illustrates how this works. # diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 4b8daf827..13edde3b8 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -474,6 +474,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.AddAttribute("Title", cpackPackageName); featureDefinitions.AddAttribute("Level", "1"); + this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions); const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); if(package) From 2e16aff1e2218f042f403971403fe583fc5bec97 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 6 Mar 2015 14:19:30 +0100 Subject: [PATCH 0268/1029] CPackWIX: Fix .wixobj output locations and filenames. Preserve all but the last extension when generating .wixobj output filenames from source files and make sure they are unique. Output .wixobj files in cpack staging area instead of the current working directory. --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 13edde3b8..257ce7ae3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -265,13 +265,30 @@ bool cmCPackWIXGenerator::PackageFilesImpl() AppendUserSuppliedExtraSources(); + std::set usedBaseNames; + std::stringstream objectFiles; for(size_t i = 0; i < this->WixSources.size(); ++i) { std::string const& sourceFilename = this->WixSources[i]; + std::string baseName = + cmSystemTools::GetFilenameWithoutLastExtension(sourceFilename); + + unsigned int counter = 0; + std::string uniqueBaseName = baseName; + + while(usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) + { + std::stringstream tmp; + tmp << baseName << ++counter; + uniqueBaseName = tmp.str(); + } + + usedBaseNames.insert(uniqueBaseName); + std::string objectFilename = - cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; + this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj"; if(!RunCandleCommand(sourceFilename, objectFilename)) { From 90a051f443c4cb400696b28651877c53e3c56607 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 7 Mar 2015 00:01:10 -0500 Subject: [PATCH 0269/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3ca0984db..6f17e27b6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150306) +set(CMake_VERSION_PATCH 20150307) #set(CMake_VERSION_RC 1) From 4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Mar 2015 16:50:07 -0500 Subject: [PATCH 0270/1029] VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed These placeholders are used only in the .dsp templates for targets that actually compile sources. --- Source/cmLocalVisualStudio6Generator.cxx | 147 ++++++++++++----------- 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1d6209378..0848b038b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1701,15 +1701,15 @@ void cmLocalVisualStudio6Generator = this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX"); cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX", debugPostfix?debugPostfix:""); - // store flags for each configuration - std::string flags = " "; - std::string flagsRelease = " "; - std::string flagsMinSizeRel = " "; - std::string flagsDebug = " "; - std::string flagsRelWithDebInfo = " "; if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::OBJECT_LIBRARY) { + // store flags for each configuration + std::string flags = " "; + std::string flagsRelease = " "; + std::string flagsMinSizeRel = " "; + std::string flagsDebug = " "; + std::string flagsRelWithDebInfo = " "; std::vector configs; target.GetMakefile()->GetConfigurations(configs); std::vector::const_iterator it = configs.begin(); @@ -1760,73 +1760,78 @@ void cmLocalVisualStudio6Generator "MinSizeRel"); this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage, "RelWithDebInfo"); + + // if _UNICODE and _SBCS are not found, then add -D_MBCS + std::string defs = this->Makefile->GetDefineFlags(); + if(flags.find("D_UNICODE") == flags.npos && + defs.find("D_UNICODE") == flags.npos && + flags.find("D_SBCS") == flags.npos && + defs.find("D_SBCS") == flags.npos) + { + flags += " /D \"_MBCS\""; + } + + // Add per-target and per-configuration preprocessor definitions. + std::set definesSet; + std::set debugDefinesSet; + std::set releaseDefinesSet; + std::set minsizeDefinesSet; + std::set debugrelDefinesSet; + + this->AddCompileDefinitions(definesSet, &target, ""); + this->AddCompileDefinitions(debugDefinesSet, &target, + "DEBUG"); + this->AddCompileDefinitions(releaseDefinesSet, &target, + "RELEASE"); + this->AddCompileDefinitions(minsizeDefinesSet, &target, + "MINSIZEREL"); + this->AddCompileDefinitions(debugrelDefinesSet, &target, + "RELWITHDEBINFO"); + + std::string defines = " "; + std::string debugDefines = " "; + std::string releaseDefines = " "; + std::string minsizeDefines = " "; + std::string debugrelDefines = " "; + + this->JoinDefines(definesSet, defines, ""); + this->JoinDefines(debugDefinesSet, debugDefines, ""); + this->JoinDefines(releaseDefinesSet, releaseDefines, ""); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); + + flags += defines; + flagsDebug += debugDefines; + flagsRelease += releaseDefines; + flagsMinSizeRel += minsizeDefines; + flagsRelWithDebInfo += debugrelDefines; + + // The template files have CXX FLAGS in them, that need to be replaced. + // There are not separate CXX and C template files, so we use the same + // variable names. The previous code sets up flags* variables to + // contain the correct C or CXX flags + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", + flagsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", + flagsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + flagsRelWithDebInfo.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", + flagsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); + + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", + minsizeDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", + debugDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", + debugrelDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", + releaseDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", + defines.c_str()); } - // if _UNICODE and _SBCS are not found, then add -D_MBCS - std::string defs = this->Makefile->GetDefineFlags(); - if(flags.find("D_UNICODE") == flags.npos && - defs.find("D_UNICODE") == flags.npos && - flags.find("D_SBCS") == flags.npos && - defs.find("D_SBCS") == flags.npos) - { - flags += " /D \"_MBCS\""; - } - - // Add per-target and per-configuration preprocessor definitions. - std::set definesSet; - std::set debugDefinesSet; - std::set releaseDefinesSet; - std::set minsizeDefinesSet; - std::set debugrelDefinesSet; - - this->AddCompileDefinitions(definesSet, &target, ""); - this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG"); - this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE"); - this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL"); - this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO"); - - std::string defines = " "; - std::string debugDefines = " "; - std::string releaseDefines = " "; - std::string minsizeDefines = " "; - std::string debugrelDefines = " "; - - this->JoinDefines(definesSet, defines, ""); - this->JoinDefines(debugDefinesSet, debugDefines, ""); - this->JoinDefines(releaseDefinesSet, releaseDefines, ""); - this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); - this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); - - flags += defines; - flagsDebug += debugDefines; - flagsRelease += releaseDefines; - flagsMinSizeRel += minsizeDefines; - flagsRelWithDebInfo += debugrelDefines; - - // The template files have CXX FLAGS in them, that need to be replaced. - // There are not separate CXX and C template files, so we use the same - // variable names. The previous code sets up flags* variables to contain - // the correct C or CXX flags - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", - flagsMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", - flagsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", - flagsRelWithDebInfo.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", - flagsRelease.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); - - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", - minsizeDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", - debugDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", - debugrelDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", - releaseDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str()); - fout << line.c_str() << std::endl; } } From e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 22 Feb 2015 17:43:13 +0100 Subject: [PATCH 0271/1029] Genex: Add a COMPILE_LANGUAGE generator expression. --- Source/cmGeneratorExpression.cxx | 10 ++++-- Source/cmGeneratorExpression.h | 6 ++-- Source/cmGeneratorExpressionEvaluator.cxx | 32 ++++++++++++++++++- Source/cmGeneratorExpressionEvaluator.h | 1 + ...ILE_LANGUAGE-add_custom_command-result.txt | 1 + ...ILE_LANGUAGE-add_custom_command-stderr.txt | 10 ++++++ .../COMPILE_LANGUAGE-add_custom_command.cmake | 8 +++++ ...PILE_LANGUAGE-add_custom_target-result.txt | 1 + ...PILE_LANGUAGE-add_custom_target-stderr.txt | 10 ++++++ .../COMPILE_LANGUAGE-add_custom_target.cmake | 6 ++++ ...COMPILE_LANGUAGE-add_executable-result.txt | 1 + ...COMPILE_LANGUAGE-add_executable-stderr.txt | 10 ++++++ .../COMPILE_LANGUAGE-add_executable.cmake | 4 +++ .../COMPILE_LANGUAGE-add_library-result.txt | 1 + .../COMPILE_LANGUAGE-add_library-stderr.txt | 10 ++++++ .../COMPILE_LANGUAGE-add_library.cmake | 4 +++ .../COMPILE_LANGUAGE-add_test-result.txt | 1 + .../COMPILE_LANGUAGE-add_test-stderr.txt | 10 ++++++ .../COMPILE_LANGUAGE-add_test.cmake | 5 +++ .../COMPILE_LANGUAGE-install-result.txt | 1 + .../COMPILE_LANGUAGE-install-stderr.txt | 8 +++++ .../COMPILE_LANGUAGE-install.cmake | 5 +++ ...COMPILE_LANGUAGE-target_sources-result.txt | 1 + ...COMPILE_LANGUAGE-target_sources-stderr.txt | 10 ++++++ .../COMPILE_LANGUAGE-target_sources.cmake | 5 +++ .../GeneratorExpression/RunCMakeTest.cmake | 7 ++++ 26 files changed, 162 insertions(+), 6 deletions(-) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index bf96951ee..0a270162a 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -52,14 +52,16 @@ cmGeneratorExpression::~cmGeneratorExpression() const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language) const { return this->Evaluate(mf, config, quiet, headTarget, headTarget, - dagChecker); + dagChecker, + language); } //---------------------------------------------------------------------------- @@ -67,7 +69,8 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language) const { if (!this->NeedsEvaluation) { @@ -93,6 +96,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; context.Backtrace = this->Backtrace; + context.Language = language; for ( ; it != end; ++it) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 57f78c516..55d969170 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -80,11 +80,13 @@ public: bool quiet = false, cmTarget const* headTarget = 0, cmTarget const* currentTarget = 0, - cmGeneratorExpressionDAGChecker *dagChecker = 0) const; + cmGeneratorExpressionDAGChecker *dagChecker = 0, + std::string const& language = std::string()) const; const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const; + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language = std::string()) const; /** Get set of targets found during evaluations. */ std::set const& GetTargets() const diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index ba18faabb..63a46f274 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -16,6 +16,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" #include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmSourceFile.h" #include @@ -89,7 +90,8 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( context->Quiet, headTarget, currentTarget, - dagChecker); + dagChecker, + context->Language); if (cge->GetHadContextSensitiveCondition()) { context->HadContextSensitiveCondition = true; @@ -806,6 +808,33 @@ static const struct JoinNode : public cmGeneratorExpressionNode } } joinNode; +static const struct CompileLanguageNode : public cmGeneratorExpressionNode +{ + CompileLanguageNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if(context->Language.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used to specify include " + "directories compile definitions, compile options and to evaluate " + "components of the file(GENERATE) command."); + return std::string(); + } + if (parameters.empty()) + { + return context->Language; + } + return context->Language == parameters.front() ? "1" : "0"; + } +} languageNode; + #define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ , "INTERFACE_" #PROPERTY @@ -1829,6 +1858,7 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["INSTALL_PREFIX"] = &installPrefixNode; nodeMap["JOIN"] = &joinNode; nodeMap["LINK_ONLY"] = &linkOnlyNode; + nodeMap["COMPILE_LANGUAGE"] = &languageNode; } NodeMap::const_iterator i = nodeMap.find(identifier); if (i == nodeMap.end()) diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0bf17974e..b1fec0b37 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -36,6 +36,7 @@ struct cmGeneratorExpressionContext MaxLanguageStandard; cmMakefile *Makefile; std::string Config; + std::string Language; cmTarget const* HeadTarget; // The target whose property is being evaluated. cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears // directly or indirectly in the property. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt new file mode 100644 index 000000000..789b4d09a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_command.cmake:6 \(add_custom_command\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake new file mode 100644 index 000000000..f4ba26153 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake @@ -0,0 +1,8 @@ + +enable_language(C) + +add_library(empty empty.c) + +add_custom_command(TARGET empty PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $ +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt new file mode 100644 index 000000000..400fbc035 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_target.cmake:4 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake new file mode 100644 index 000000000..4102623f8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake @@ -0,0 +1,6 @@ + +enable_language(C) + +add_custom_target(empty + COMMAND ${CMAKE_COMMAND} -E echo $ +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt new file mode 100644 index 000000000..e45bb020e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_executable.cmake:4 \(add_executable\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake new file mode 100644 index 000000000..5c2ff351c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake @@ -0,0 +1,4 @@ + +enable_language(C) + +add_executable(empty empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt new file mode 100644 index 000000000..c9ee6fe2a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_library.cmake:4 \(add_library\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake new file mode 100644 index 000000000..dd9f82403 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake @@ -0,0 +1,4 @@ + +enable_language(C) + +add_library(empty empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt new file mode 100644 index 000000000..9955f5d91 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake new file mode 100644 index 000000000..deedf659e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt new file mode 100644 index 000000000..eca700f4d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake new file mode 100644 index 000000000..92c20e32d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$ + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt new file mode 100644 index 000000000..2d324e2ac --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-target_sources.cmake:5 \(target_sources\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake new file mode 100644 index 000000000..0c78acd74 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(empty empty.c) +target_sources(empty PRIVATE empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6c32393fc..f591c3dca 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,6 +16,13 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) +run_cmake(COMPILE_LANGUAGE-add_custom_target) +run_cmake(COMPILE_LANGUAGE-add_custom_command) +run_cmake(COMPILE_LANGUAGE-install) +run_cmake(COMPILE_LANGUAGE-target_sources) +run_cmake(COMPILE_LANGUAGE-add_executable) +run_cmake(COMPILE_LANGUAGE-add_library) +run_cmake(COMPILE_LANGUAGE-add_test) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) From 42f0cb0c103ba83eadff09485bab2287655ffbea Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 8 Mar 2015 00:01:09 -0500 Subject: [PATCH 0272/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6f17e27b6..332d8024a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150307) +set(CMake_VERSION_PATCH 20150308) #set(CMake_VERSION_RC 1) From bdb00b36133c64a36fbba7fd6c648725062b6732 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 9 Mar 2015 00:01:09 -0400 Subject: [PATCH 0273/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 332d8024a..038a09fe2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150308) +set(CMake_VERSION_PATCH 20150309) #set(CMake_VERSION_RC 1) From 242c396656783b1b3d542b14bc62710a46a87518 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Mon, 9 Mar 2015 12:12:13 +0100 Subject: [PATCH 0274/1029] add_custom_command: Diagnose MAIN_DEPENDENCY limitation. The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across multiple custom commands. --- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0057.rst | 21 +++++++++++++++ .../dev/main_dependency_diagnostic.rst | 6 +++++ Source/cmMakefile.cxx | 27 +++++++++++++++++++ Source/cmPolicies.cxx | 5 ++++ Source/cmPolicies.h | 2 ++ Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt | 1 + Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt | 4 +++ Tests/RunCMake/CMP0057/CMP0057-NEW.cmake | 13 +++++++++ Tests/RunCMake/CMP0057/CMP0057-OLD.cmake | 13 +++++++++ .../RunCMake/CMP0057/CMP0057-WARN-stderr.txt | 9 +++++++ Tests/RunCMake/CMP0057/CMP0057-WARN.cmake | 11 ++++++++ .../RunCMake/CMP0057/CMP0057-once_is_ok.cmake | 8 ++++++ Tests/RunCMake/CMP0057/CMakeLists.txt | 3 +++ Tests/RunCMake/CMP0057/RunCMakeTest.cmake | 7 +++++ Tests/RunCMake/CMP0057/input.txt | 0 Tests/RunCMake/CMakeLists.txt | 1 + 17 files changed, 132 insertions(+) create mode 100644 Help/policy/CMP0057.rst create mode 100644 Help/release/dev/main_dependency_diagnostic.rst create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-OLD.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-WARN.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake create mode 100644 Tests/RunCMake/CMP0057/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0057/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CMP0057/input.txt diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 96f39e66e..76ca5d4ed 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -114,3 +114,4 @@ All Policies /policy/CMP0054 /policy/CMP0055 /policy/CMP0056 + /policy/CMP0057 diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst new file mode 100644 index 000000000..5cf078470 --- /dev/null +++ b/Help/policy/CMP0057.rst @@ -0,0 +1,21 @@ +CMP0057 +------- + +Disallow multiple ``MAIN_DEPENDENCY`` specifications for the same file. + +CMake 3.3 and above no longer allow the same input file to be used +as a ``MAIN_DEPENDENCY`` in more than one custom command. + +Listing the same input file more than once in this context has not been +supported by earlier versions either and would lead to build time issues +but was not diagnosed. + +The ``OLD`` behavior for this policy is to allow using the same input file +in a ``MAIN_DEPENDENCY`` specfication more than once. +The ``NEW`` behavior is to disallow using the same input file in a +``MAIN_DEPENDENCY`` specification more than once. + +This policy was introduced in CMake version 3.3. +CMake version |release| warns when the policy is not set and uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set +it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/release/dev/main_dependency_diagnostic.rst b/Help/release/dev/main_dependency_diagnostic.rst new file mode 100644 index 000000000..13486efd5 --- /dev/null +++ b/Help/release/dev/main_dependency_diagnostic.rst @@ -0,0 +1,6 @@ +main_dependency_diagnostic +-------------------------- + +* Listing the same input file as a MAIN_DEPENDENCY of a custom command + can lead to broken build time behavior. This is now diagnosed. + See policy :policy:`CMP0057`. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1e1..6de1c61cd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -985,6 +985,33 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, } else { + std::ostringstream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + bool issueMessage = false; + + switch(this->GetPolicyStatus(cmPolicies::CMP0057)) + { + case cmPolicies::WARN: + e << (this->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0057)) << "\n"; + issueMessage = true; + case cmPolicies::OLD: + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + issueMessage = true; + messageType = cmake::FATAL_ERROR; + break; + } + + if(issueMessage) + { + e << "\"" << main_dependency << "\" can only be specified as a " + "custom command MAIN_DEPENDENCY once."; + IssueMessage(messageType, e.str()); + } + // The existing custom command is different. We need to // generate a rule file for this new command. file = 0; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a4810125..07e210ebc 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -374,6 +374,11 @@ cmPolicies::cmPolicies() CMP0056, "CMP0056", "Honor link flags in try_compile() source-file signature.", 3,2,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0057, "CMP0057", + "Disallow multiple MAIN_DEPENDENCY specifications for the same file.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index c393c2f70..854b132c8 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -113,6 +113,8 @@ public: /// or keywords when unquoted. CMP0055, ///< Strict checking for break() command. CMP0056, ///< Honor link flags in try_compile() source-file signature. + CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications + /// for the same file. /** \brief Always the last entry. * diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt new file mode 100644 index 000000000..9607d5460 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0057-NEW.cmake:8 \(add_custom_command\): + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake new file mode 100644 index 000000000..22dbfb343 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake new file mode 100644 index 000000000..ccf4fcb3c --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 OLD) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt new file mode 100644 index 000000000..da3a1cbf1 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0057-WARN.cmake:6 \(add_custom_command\): + Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications + for the same file. Run "cmake --help-policy CMP0057" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake new file mode 100644 index 000000000..1837968b7 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake @@ -0,0 +1,11 @@ +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake new file mode 100644 index 000000000..8ce02f96c --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1) diff --git a/Tests/RunCMake/CMP0057/CMakeLists.txt b/Tests/RunCMake/CMP0057/CMakeLists.txt new file mode 100644 index 000000000..ef2163c29 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake new file mode 100644 index 000000000..f79235f98 --- /dev/null +++ b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(CMP0057-OLD) +run_cmake(CMP0057-NEW) +run_cmake(CMP0057-WARN) + +run_cmake(CMP0057-once_is_ok) diff --git a/Tests/RunCMake/CMP0057/input.txt b/Tests/RunCMake/CMP0057/input.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb4205740..3bc96c982 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -63,6 +63,7 @@ add_RunCMake_test(CMP0051) add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) +add_RunCMake_test(CMP0057) add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) From 86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Lehmann?= Date: Fri, 6 Mar 2015 11:43:16 +0100 Subject: [PATCH 0275/1029] ExternalProject: Replace placeholder tokens in BYPRODUCTS This allows the developer to specify the byproducts relative to the binary directory without the need to set the binary directory location explicitly. --- .../dev/ExternalProject-byproducts-tokens.rst | 5 +++++ Modules/ExternalProject.cmake | 6 +++--- Tests/CustomCommandByproducts/CMakeLists.txt | 21 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Help/release/dev/ExternalProject-byproducts-tokens.rst diff --git a/Help/release/dev/ExternalProject-byproducts-tokens.rst b/Help/release/dev/ExternalProject-byproducts-tokens.rst new file mode 100644 index 000000000..20b4dd468 --- /dev/null +++ b/Help/release/dev/ExternalProject-byproducts-tokens.rst @@ -0,0 +1,5 @@ +ExternalProject-byproducts-tokens +--------------------------------- + +* The :module:`ExternalProject` module learned to replace tokens + like ```` in the ``BYPRODUCTS`` of each step. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1f9f4d3e8..d7b985de9 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -251,8 +251,8 @@ Create custom targets to build projects in external trees ``LOG 1`` Wrap step in script to log output - The command line, comment, and working directory of every standard and - custom step is processed to replace tokens ````, + The command line, comment, working directory, and byproducts of every + standard and custom step are processed to replace tokens ````, ````, ````, and ```` with corresponding property values. @@ -1443,7 +1443,7 @@ function(ExternalProject_Add_Step name step) endif() # Replace location tags. - _ep_replace_location_tags(${name} comment command work_dir) + _ep_replace_location_tags(${name} comment command work_dir byproducts) # Custom comment? get_property(comment_set TARGET ${name} PROPERTY _EP_${step}_COMMENT SET) diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt index 884f8c231..3289e8f9f 100644 --- a/Tests/CustomCommandByproducts/CMakeLists.txt +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -102,6 +102,27 @@ add_library(ExternalLibrary STATIC IMPORTED) set_property(TARGET ExternalLibrary PROPERTY IMPORTED_LOCATION ${ExternalLibrary_LIBRARY}) add_dependencies(ExternalLibrary ExternalTarget) +# Generate the library file of an imported target as a byproduct +# of an external project. The byproduct uses that is substituted +# by the real binary path +if(CMAKE_CONFIGURATION_TYPES) + set(cfg /${CMAKE_CFG_INTDIR}) +else() + set(cfg) +endif() +include(ExternalProject) +ExternalProject_Add(ExtTargetSubst + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS "${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) +ExternalProject_Get_Property(ExtTargetSubst binary_dir) +add_library(ExternalLibraryWithSubstitution STATIC IMPORTED) +set_property(TARGET ExternalLibraryWithSubstitution PROPERTY IMPORTED_LOCATION + ${binary_dir}${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}) +add_dependencies(ExternalLibraryWithSubstitution ExtTargetSubst) + # Add an executable consuming all the byproducts. add_executable(CustomCommandByproducts CustomCommandByproducts.c From 5c559f11137dcb14113a3c5df99ff896c65c7596 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 25 Nov 2014 22:47:44 +0100 Subject: [PATCH 0276/1029] Genex: Enable use of COMPILE_LANGUAGE for compile options. Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators. --- Help/manual/cmake-generator-expressions.7.rst | 30 ++++++++++++++++ Source/cmGeneratorExpressionEvaluator.cxx | 34 +++++++++++++++++++ Source/cmLocalGenerator.cxx | 4 +-- Source/cmTarget.cxx | 26 +++++++++----- Source/cmTarget.h | 3 +- .../target_compile_options/CMakeLists.txt | 15 ++++++++ .../target_compile_options/consumer.c | 23 +++++++++++++ .../target_compile_options/consumer.cpp | 18 ++++++++++ Tests/RunCMake/CMakeLists.txt | 2 ++ .../COMPILE_LANGUAGE-genex/CMakeLists.txt | 3 ++ .../CompileOptions-result.txt | 1 + .../CompileOptions-stderr-VS.txt | 8 +++++ .../CompileOptions.cmake | 5 +++ .../COMPILE_LANGUAGE-genex/RunCMakeTest.cmake | 6 ++++ .../RunCMake/COMPILE_LANGUAGE-genex/main.cpp | 5 +++ .../COMPILE_LANGUAGE-unknown-lang-result.txt | 1 + .../COMPILE_LANGUAGE-unknown-lang-stderr.txt | 8 +++++ .../COMPILE_LANGUAGE-unknown-lang.cmake | 4 +++ .../GeneratorExpression/RunCMakeTest.cmake | 1 + 19 files changed, 185 insertions(+), 12 deletions(-) create mode 100644 Tests/CMakeCommands/target_compile_options/consumer.c create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index c47a7c44f..b1b11024e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -93,6 +93,32 @@ Available logical expressions are: for the 'head' target, an error is reported. See the :manual:`cmake-compile-features(7)` manual for information on compile features. +``$`` + ``1`` when the language used for compilation unit matches ``lang``, + otherwise ``0``. This expression used to specify compile options for + source files of a particular language in a target. For example, to specify + the use of the ``-fno-exceptions`` compile option (compiler id checks + elided): + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_options(myapp + PRIVATE $<$:-fno-exceptions> + ) + + This generator expression has limited use because it is not possible to + use it with the Visual Studio generators. Portable buildsystems would + not use this expression, and would create separate libraries for each + source file language instead: + + .. code-block:: cmake + + add_library(myapp_c foo.c) + add_library(myapp_cxx foo.c) + target_compile_options(myapp_cxx PUBLIC -fno-exceptions) + add_executable(myapp main.cpp) + target_link_libraries(myapp myapp_c myapp_cxx) Informational Expressions ========================= @@ -174,6 +200,10 @@ Available informational expressions are: ``$`` Content of the install prefix when the target is exported via :command:`install(EXPORT)` and empty otherwise. +``$`` + The compile language of source files when evaluating compile options. See + the unary version for notes about portability of this generator + expression. Output Expressions ================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 63a46f274..6a9f251b2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -827,6 +827,40 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "components of the file(GENERATE) command."); return std::string(); } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + + std::string genName = gg->GetName(); + if (genName.find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else + { + if(genName.find("Makefiles") == std::string::npos && + genName.find("Ninja") == std::string::npos && + genName.find("Watcom WMake") == std::string::npos && + genName.find("Xcode") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } if (parameters.empty()) { return context->Language; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7c83f2737..be8208568 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1453,7 +1453,7 @@ void cmLocalGenerator::AddCompileOptions( { cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); } - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1474,7 +1474,7 @@ void cmLocalGenerator::AddCompileOptions( this->AppendFlags(flags, targetFlags); } std::vector opts; - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e046bef27..c54d69423 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2192,7 +2192,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName, + std::string const& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -2204,7 +2205,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, + language), entryOptions); std::string usedOptions; for(std::vector::iterator @@ -2238,10 +2240,12 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options"); + dagChecker, config, debugOptions, "options", + language); } //---------------------------------------------------------------------------- @@ -2271,7 +2275,8 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2303,7 +2308,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); std::vector linkInterfaceCompileOptionsEntries; @@ -2318,7 +2324,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); deleteAndClear(linkInterfaceCompileOptionsEntries); } @@ -2333,7 +2340,7 @@ static void processCompileDefinitions(cmTarget const* tgt, { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions"); + "definitions", std::string()); } //---------------------------------------------------------------------------- @@ -2431,7 +2438,8 @@ static void processCompileFeatures(cmTarget const* tgt, const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features"); + dagChecker, config, debugOptions, "features", + std::string()); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ddd985973..56db22eb7 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -577,7 +577,8 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; void GetAutoUicOptions(std::vector &result, const std::string& config) const; void GetCompileFeatures(std::vector &features, diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 1d0463927..35dd276ba 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,6 +23,21 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$ + -DLANG_IS_CXX=$ + -DLANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_compile_options(consumer PRIVATE $<$:$> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c new file mode 100644 index 000000000..5796d9652 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 12996065b..c5882a54b 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,4 +15,22 @@ #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb4205740..9f1256ea7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -208,3 +208,5 @@ add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) if(RPMBUILD_EXECUTABLE) add_RunCMake_test(CPackRPM) endif() + +add_RunCMake_test(COMPILE_LANGUAGE-genex) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt new file mode 100644 index 000000000..ef2163c29 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt new file mode 100644 index 000000000..e9e8e9f1e --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileOptions.cmake:5 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake new file mode 100644 index 000000000..6c92abca9 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_options(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake new file mode 100644 index 000000000..2c5d9aecd --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +if (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) + run_cmake(CompileOptions) +endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp new file mode 100644 index 000000000..31a133726 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt new file mode 100644 index 000000000..444da45ef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ Unknown language. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake new file mode 100644 index 000000000..cec12a3fb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$:-Wall>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f591c3dca..542b7fc87 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(COMPILE_LANGUAGE-target_sources) run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) +run_cmake(COMPILE_LANGUAGE-unknown-lang) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) From 0b945ea9a6a38d1b3ee27cc32afb4268bd571600 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 4 Mar 2015 21:46:42 +0100 Subject: [PATCH 0277/1029] Genex: Allow COMPILE_LANGUAGE when processing compile definitions. Issue an error if this is encountered by an IDE generator. --- Help/manual/cmake-generator-expressions.7.rst | 10 ++++++ Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 15 +++++++-- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 6 ++-- Source/cmLocalGenerator.h | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 32 +++++++++---------- Source/cmLocalVisualStudio6Generator.cxx | 10 +++--- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmTarget.cxx | 14 +++++--- Source/cmTarget.h | 3 +- Source/cmVisualStudio10TargetGenerator.cxx | 3 +- .../target_compile_definitions/CMakeLists.txt | 15 +++++++++ .../target_compile_definitions/consumer.c | 23 +++++++++++++ .../target_compile_definitions/consumer.cpp | 18 +++++++++++ .../CompileDefinitions-result.txt | 1 + .../CompileDefinitions-stderr-VS.txt | 8 +++++ .../CompileDefinitions-stderr-Xcode.txt | 9 ++++++ .../CompileDefinitions.cmake | 5 +++ .../COMPILE_LANGUAGE-genex/RunCMakeTest.cmake | 7 ++++ 24 files changed, 154 insertions(+), 42 deletions(-) create mode 100644 Tests/CMakeCommands/target_compile_definitions/consumer.c create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b1b11024e..b6d97d17e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -120,6 +120,16 @@ Available logical expressions are: add_executable(myapp main.cpp) target_link_libraries(myapp myapp_c myapp_cxx) + The ``Makefile`` and ``Ninja`` based generators can also use this + expression to specify compile-language specific compile definitions: + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_definitions(myapp + PRIVATE $<$:COMPILING_CXX> + ) + Informational Expressions ========================= diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef3e..614e7d9c2 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -599,7 +599,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the compilerdefines for this target std::vector cdefs; - target->GetCompileDefinitions(cdefs, buildType); + target->GetCompileDefinitions(cdefs, buildType, "C"); // Expand the list. for(std::vector::const_iterator di = cdefs.begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5fff0fb27..25f90052e 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -436,7 +436,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, } // Add preprocessor definitions for this target and configuration. - lg->AddCompileDefinitions(defines, target, config); + lg->AddCompileDefinitions(defines, target, config, language); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6a9f251b2..3ec8595a9 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -817,7 +817,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const + cmGeneratorExpressionDAGChecker *dagChecker) const { if(context->Language.empty()) { @@ -849,12 +849,21 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "generators."); return std::string(); } + else if (genName.find("Xcode") != std::string::npos) + { + if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } else { if(genName.find("Makefiles") == std::string::npos && genName.find("Ninja") == std::string::npos && - genName.find("Watcom WMake") == std::string::npos && - genName.find("Xcode") == std::string::npos) + genName.find("Watcom WMake") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e89161d70..bd8a1f51a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "C"); this->AppendDefines(ppDefs, targetDefines); buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index be8208568..735dfa96b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1428,11 +1428,11 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config) + const std::string& config, + const std::string& lang) { std::vector targetDefines; - target->GetCompileDefinitions(targetDefines, - config); + target->GetCompileDefinitions(targetDefines, config, lang); this->AppendDefines(defines, targetDefines); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3a9d5be80..f1f0da1a4 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -239,7 +239,8 @@ public: const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config); + const std::string& config, + const std::string& lang); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 432cb3af3..9ecb02948 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2094,26 +2094,26 @@ void cmLocalUnixMakefileGenerator3 << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } - } - // Build a list of preprocessor definitions for the target. - std::set defines; - this->AddCompileDefinitions(defines, &target, - this->ConfigurationName); - if(!defines.empty()) - { - cmakefileStream - << "\n" - << "# Preprocessor definitions for this target.\n" - << "set(CMAKE_TARGET_DEFINITIONS\n"; - for(std::set::const_iterator di = defines.begin(); - di != defines.end(); ++di) + // Build a list of preprocessor definitions for the target. + std::set defines; + this->AddCompileDefinitions(defines, &target, + this->ConfigurationName, l->first); + if(!defines.empty()) { cmakefileStream - << " " << this->EscapeForCMake(*di) << "\n"; + << "\n" + << "# Preprocessor definitions for this target.\n" + << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; + for(std::set::const_iterator di = defines.begin(); + di != defines.end(); ++di) + { + cmakefileStream + << " " << this->EscapeForCMake(*di) << "\n"; + } + cmakefileStream + << " )\n"; } - cmakefileStream - << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0848b038b..2b999eb1e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1778,15 +1778,15 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, ""); + this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); this->AddCompileDefinitions(debugDefinesSet, &target, - "DEBUG"); + "DEBUG", linkLanguage); this->AddCompileDefinitions(releaseDefinesSet, &target, - "RELEASE"); + "RELEASE", linkLanguage); this->AddCompileDefinitions(minsizeDefinesSet, &target, - "MINSIZEREL"); + "MINSIZEREL", linkLanguage); this->AddCompileDefinitions(debugrelDefinesSet, &target, - "RELWITHDEBINFO"); + "RELWITHDEBINFO", linkLanguage); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa14..f53f82558 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -775,7 +775,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "CXX"); targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 20207f50b..57c49f165 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName); + this->LocalGenerator->ConfigurationName, l); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index cfd8937c6..92fccd399 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -231,7 +231,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->GetConfigName()); + this->GetConfigName(), language); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e18e75734..844d70870 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -507,7 +507,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, incs = cmJoin(includeDirs, ";"); std::set defines; - localGen->AddCompileDefinitions(defines, target, config); + localGen->AddCompileDefinitions(defines, target, config, "CXX"); defs += cmJoin(defines, ";"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c54d69423..87dcc99a4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2336,16 +2336,18 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions", std::string()); + "definitions", language); } //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2377,7 +2379,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); std::vector linkInterfaceCompileDefinitionsEntries; @@ -2424,7 +2427,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); deleteAndClear(linkInterfaceCompileDefinitionsEntries); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56db22eb7..0356c1ec1 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -496,7 +496,8 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 04d148715..19444edc1 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1876,7 +1876,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector targetDefines; - this->Target->GetCompileDefinitions(targetDefines, configName.c_str()); + this->Target->GetCompileDefinitions(targetDefines, + configName.c_str(), "CXX"); clOptions.AddDefines(targetDefines); if(this->MSTools) { diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 14d40aa54..f96283d55 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -26,6 +26,21 @@ target_compile_definitions(consumer PRIVATE ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_definitions(consumer + PRIVATE + CONSUMER_LANG_$ + LANG_IS_CXX=$ + LANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + add_definitions(-DSOME_DEF) add_library(imp UNKNOWN IMPORTED) get_target_property(_res imp COMPILE_DEFINITIONS) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c new file mode 100644 index 000000000..5796d9652 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp index a39111416..778f57e55 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -15,4 +15,22 @@ #error Expected DASH_D_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt new file mode 100644 index 000000000..73b66acc7 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt new file mode 100644 index 000000000..a1ed63390 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake new file mode 100644 index 000000000..7935d881b --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_definitions(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 2c5d9aecd..8a32aef49 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -4,3 +4,10 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) run_cmake(CompileOptions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) + run_cmake(CompileDefinitions) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) + run_cmake(CompileDefinitions) +endif() From b734fa44719a780683e2eb0dfaabd38d64daa3f6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 4 Mar 2015 21:53:15 +0100 Subject: [PATCH 0278/1029] Genex: Allow COMPILE_LANGUAGE when processing include directories. Issue an error if this is encountered by an IDE generator. --- Help/manual/cmake-generator-expressions.7.rst | 6 +++- Source/cmGeneratorExpressionEvaluator.cxx | 3 +- Source/cmGeneratorTarget.cxx | 5 +-- Source/cmGeneratorTarget.h | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 26 ++++++++++++++ Source/cmMakefileTargetGenerator.cxx | 34 ------------------- Source/cmTarget.cxx | 14 +++++--- Source/cmTarget.h | 3 +- .../target_include_directories/CMakeLists.txt | 14 ++++++++ .../c_only/c_only.h | 2 ++ .../target_include_directories/consumer.c | 10 ++++++ .../target_include_directories/consumer.cpp | 9 +++++ .../cxx_only/cxx_only.h | 2 ++ .../IncludeDirectories-result.txt | 1 + .../IncludeDirectories-stderr-VS.txt | 8 +++++ .../IncludeDirectories-stderr-Xcode.txt | 9 +++++ .../IncludeDirectories.cmake | 5 +++ .../COMPILE_LANGUAGE-genex/RunCMakeTest.cmake | 7 ++++ 19 files changed, 116 insertions(+), 46 deletions(-) create mode 100644 Tests/CMakeCommands/target_include_directories/c_only/c_only.h create mode 100644 Tests/CMakeCommands/target_include_directories/consumer.c create mode 100644 Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b6d97d17e..d38cf7ee7 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -121,7 +121,8 @@ Available logical expressions are: target_link_libraries(myapp myapp_c myapp_cxx) The ``Makefile`` and ``Ninja`` based generators can also use this - expression to specify compile-language specific compile definitions: + expression to specify compile-language specific compile definitions + and include directories: .. code-block:: cmake @@ -129,6 +130,9 @@ Available logical expressions are: target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX> ) + target_include_directories(myapp + PRIVATE $<$:/opt/foo/cxx_headers> + ) Informational Expressions ========================= diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3ec8595a9..756d93206 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -851,7 +851,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } else if (genName.find("Xcode") != std::string::npos) { - if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) { reportError(context, content->GetOriginalExpression(), "$ may only be used with COMPILE_OPTIONS " diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44c9e9a59..b7b2effc4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -960,9 +960,10 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config, + const std::string& lang) const { - return this->Target->GetIncludeDirectories(config); + return this->Target->GetIncludeDirectories(config, lang); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2083b8858..c329cf55e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -85,7 +85,7 @@ public: /** Get the include directories for this target. */ std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, const std::string& lang) const; bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 735dfa96b..37cc2c662 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1600,7 +1600,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Get the target-specific include directories. std::vector includes; - includes = target->GetIncludeDirectories(config); + includes = target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9ecb02948..50491af28 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2114,6 +2114,32 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << " )\n"; } + + // Target-specific include directories: + cmakefileStream + << "\n" + << "# The include file search paths:\n"; + cmakefileStream + << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; + std::vector includes; + + cmGeneratorTarget* gt = this->GetGlobalGenerator() + ->GetGeneratorTarget(&target); + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->GetIncludeDirectories(includes, gt, + l->first, config); + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + cmakefileStream + << " \"" + << this->Convert(*i, cmLocalGenerator::HOME_OUTPUT) + << "\"\n"; + } + cmakefileStream + << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 57c49f165..c7a7110a1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1056,40 +1056,6 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } - // Target-specific include directories: - *this->InfoFileStream - << "\n" - << "# The include file search paths:\n"; - *this->InfoFileStream - << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; - std::vector includes; - - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - for(std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) - { - *this->InfoFileStream - << " \"" - << this->LocalGenerator->Convert(*i, - cmLocalGenerator::HOME_OUTPUT) - << "\"\n"; - } - *this->InfoFileStream - << " )\n"; - *this->InfoFileStream - << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - // and now write the rule to use it std::vector depends; std::vector commands; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 87dcc99a4..7a6ad8b4f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1979,7 +1979,8 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugIncludes) + const std::string& config, bool debugIncludes, + const std::string& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -1995,7 +1996,7 @@ static void processIncludeDirectories(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, language), entryIncludes); std::string usedIncludes; @@ -2106,7 +2107,8 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const std::string& config) const +cmTarget::GetIncludeDirectories(const std::string& config, + const std::string& language) const { std::vector includes; UNORDERED_SET uniqueIncludes; @@ -2139,7 +2141,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); std::vector linkInterfaceIncludeDirectoriesEntries; @@ -2179,7 +2182,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); deleteAndClear(linkInterfaceIncludeDirectoriesEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0356c1ec1..5170b3190 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -568,7 +568,8 @@ public: bool contentOnly) const; std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, + const std::string& language) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 661bbaab6..d57556aad 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -42,6 +42,20 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_include_directories(consumer + PRIVATE + $<$:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/c_only> + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_include_directories(consumer PRIVATE $ diff --git a/Tests/CMakeCommands/target_include_directories/c_only/c_only.h b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h new file mode 100644 index 000000000..29f68ee33 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h @@ -0,0 +1,2 @@ + +#define C_ONLY_DEFINE diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c new file mode 100644 index 000000000..8821f5bc7 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -0,0 +1,10 @@ + +#ifdef TEST_LANG_DEFINES + #include "c_only.h" + + #ifndef C_ONLY_DEFINE + #error Expected C_ONLY_DEFINE + #endif +#endif + +int consumer_c() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 7e3443ec3..649510ce0 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -4,6 +4,9 @@ #include "interfaceinclude.h" #include "relative_dir.h" #include "consumer.h" +#ifdef TEST_LANG_DEFINES + #include "cxx_only.h" +#endif #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -29,4 +32,10 @@ #error Expected CONSUMER_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CXX_ONLY_DEFINE + #error Expected CXX_ONLY_DEFINE + #endif +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h new file mode 100644 index 000000000..67289a4fb --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h @@ -0,0 +1,2 @@ + +#define CXX_ONLY_DEFINE diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt new file mode 100644 index 000000000..ec15068e9 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt new file mode 100644 index 000000000..fdf92b28f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake new file mode 100644 index 000000000..31771f64d --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_include_directories(main PRIVATE $<$:anydir>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 8a32aef49..5e0a5f512 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -11,3 +11,10 @@ elseif (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) run_cmake(CompileDefinitions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt) + run_cmake(IncludeDirectories) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt) + run_cmake(IncludeDirectories) +endif() From 9e1689413fd1e54e8056b7d369cd508636987072 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 22 Feb 2015 17:44:59 +0100 Subject: [PATCH 0279/1029] File(GENERATE): Process genex evaluation files for each language. --- .../cmGeneratorExpressionEvaluationFile.cxx | 51 ++++++++++++++----- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- .../COMPILE_LANGUAGE-genex-result.txt | 1 + .../COMPILE_LANGUAGE-genex.cmake | 12 +++++ .../File_Generate/OutputConflict-stderr.txt | 2 +- .../RunCMake/File_Generate/RunCMakeTest.cmake | 10 ++++ Tests/RunCMake/File_Generate/empty.c | 8 +++ 7 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt create mode 100644 Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake create mode 100644 Tests/RunCMake/File_Generate/empty.c diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 4e2a86861..fa00283c2 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -38,13 +38,15 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, + const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) { - std::string condResult = this->Condition->Evaluate(this->Makefile, config); + std::string condResult = this->Condition->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); if (condResult == "0") { return; @@ -60,9 +62,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } const std::string outputFileName - = this->OutputFileExpr->Evaluate(this->Makefile, config); + = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); const std::string outputContent - = inputExpression->Evaluate(this->Makefile, config); + = inputExpression->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); std::map::iterator it = outputFiles.find(outputFileName); @@ -75,7 +79,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } std::ostringstream e; e << "Evaluation file to be written multiple times for different " - "configurations with different content:\n " << outputFileName; + "configurations or languages with different content:\n " + << outputFileName; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -97,14 +102,22 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { - std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config); - cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); - sf->SetProperty("GENERATED", "1"); - + std::vector enabledLanguages; cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->SetFilenameTargetDepends(sf, + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) + { + std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, *le); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); + sf->SetProperty("GENERATED", "1"); + + gg->SetFilenameTargetDepends(sf, this->OutputFileExpr->GetSourceSensitiveTargets()); + } } //---------------------------------------------------------------------------- @@ -153,13 +166,23 @@ void cmGeneratorExpressionEvaluationFile::Generate() { allConfigs.push_back(""); } - for(std::vector::const_iterator li = allConfigs.begin(); - li != allConfigs.end(); ++li) + + std::vector enabledLanguages; + cmGlobalGenerator *gg + = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) { - this->Generate(*li, inputExpression.get(), outputFiles, perm); - if(cmSystemTools::GetFatalErrorOccured()) + for(std::vector::const_iterator li = allConfigs.begin(); + li != allConfigs.end(); ++li) { - return; + this->Generate(*li, *le, inputExpression.get(), outputFiles, perm); + if(cmSystemTools::GetFatalErrorOccured()) + { + return; + } } } } diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 3394ade8f..4424bec82 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: void CreateOutputFile(std::string const& config); private: - void Generate(const std::string& config, + void Generate(const std::string& config, const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm); diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake new file mode 100644 index 000000000..e2b081d48 --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX C) + +add_library(empty empty.cpp empty.c) +target_compile_options(empty + PRIVATE LANG_IS_$ +) + +file(GENERATE + OUTPUT opts-$.txt + CONTENT "$\n" +) diff --git a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt index dbd39de50..0abb7df69 100644 --- a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: Evaluation file to be written multiple times for different configurations - with different content: + or languages with different content: .*output.txt diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 97f93d5af..db344ef4b 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,16 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() +if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(COMPILE_LANGUAGE-genex) + foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() + endforeach() +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c new file mode 100644 index 000000000..563eef01c --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.c @@ -0,0 +1,8 @@ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty_c() +{ + return 0; +} From a5505c4c53672a55f5e9e577ffb0ac3bd78c7847 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 10 Mar 2015 00:01:19 -0400 Subject: [PATCH 0280/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 038a09fe2..8fcdac997 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150309) +set(CMake_VERSION_PATCH 20150310) #set(CMake_VERSION_RC 1) From 18d5a4bcfd688687d334d645dfdaa7fd5a207bd9 Mon Sep 17 00:00:00 2001 From: Oyvind Jensen Date: Thu, 5 Mar 2015 14:49:14 +0100 Subject: [PATCH 0281/1029] VS: Add more Fortran compiler flags to flag table (#15381) Due to a difference in how AdditionalOptions are implemented in the Fortran component of VS and the C/C++ component, flags that are not listed in the flag table are at risk of being overwritten. --- Source/cmLocalVisualStudio7Generator.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa14..25d80f25c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -391,6 +391,13 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {"OptimizeForProcessor", "QxT", "", "codeExclusivelyCore2Duo", 0}, {"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0}, {"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0}, + {"OpenMP", "Qopenmp", "", "OpenMPParallelCode", 0}, + {"OpenMP", "Qopenmp-stubs", "", "OpenMPSequentialCode", 0}, + {"Traceback", "traceback", "", "true", 0}, + {"Traceback", "notraceback", "", "false", 0}, + {"FloatingPointExceptionHandling", "fpe:0", "", "fpe0", 0}, + {"FloatingPointExceptionHandling", "fpe:1", "", "fpe1", 0}, + {"FloatingPointExceptionHandling", "fpe:3", "", "fpe3", 0}, {"ModulePath", "module:", "", "", cmVS7FlagTable::UserValueRequired}, From 94887cb6f1200c505d86e3e52f7abf88cb5e2a72 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Mar 2015 08:42:18 -0400 Subject: [PATCH 0282/1029] cmake: Teach --build to get VCExpress output (#15437) VCExpress does not produce output if its pipes are connected to an interactive terminal. Add a special case to 'cmake --build' to capture the output through a pipe and re-print it instead of sharing output pipes with VCExpress. --- Source/cmGlobalGenerator.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36395aa67..e95cf5066 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1717,6 +1717,19 @@ int cmGlobalGenerator::Build( std::string outputBuffer; std::string* outputPtr = &outputBuffer; + std::vector makeCommand; + this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, + bindir, target, config, fast, verbose, + nativeOptions); + + // Workaround to convince VCExpress.exe to produce output. + if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH && + !makeCommand.empty() && cmSystemTools::LowerCase( + cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe") + { + outputflag = cmSystemTools::OUTPUT_NORMAL; + } + // should we do a clean first? if (clean) { @@ -1743,10 +1756,6 @@ int cmGlobalGenerator::Build( } // now build - std::vector makeCommand; - this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, - bindir, target, config, fast, verbose, - nativeOptions); std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand); output += "\nRun Build Command:"; output += makeCommandStr; From 232a6883a1fe480def1743af6d711097b98b026e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Mar 2015 21:54:28 +0100 Subject: [PATCH 0283/1029] Help: Add release notes for target-language-genex. --- Help/release/dev/target-language-genex.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Help/release/dev/target-language-genex.rst diff --git a/Help/release/dev/target-language-genex.rst b/Help/release/dev/target-language-genex.rst new file mode 100644 index 000000000..ed4cb5e78 --- /dev/null +++ b/Help/release/dev/target-language-genex.rst @@ -0,0 +1,9 @@ +target-language-genex +--------------------- + +* A new ``COMPILE_LANGUAGE`` generator expression was introduced to + allow specification of compile options for target files based on the + :prop_sf:`LANGUAGE` of each source file. Due to limitations of the + underlying native build tools, this feature has varying support across + generators. See the :manual:`cmake-generator-expressions(7)` manual + for details. From 77534e84b27701e371ccee780be5acffe7cced59 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Mar 2015 14:49:40 -0400 Subject: [PATCH 0284/1029] Add options to build CMake without any language dialects If CMake_NO__STANDARD is set, do not set CMAKE__STANDARD. This will allow users to build with their own -std= flags without CMake adding any itself. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1250a9477..d86ae96cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,10 +37,10 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") endif() # Use most-recent available language dialects with GNU and Clang -if(NOT DEFINED CMAKE_C_STANDARD) +if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD) set(CMAKE_C_STANDARD 11) endif() -if(NOT DEFINED CMAKE_CXX_STANDARD) +if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() From 642048ce356304155bf67b85deeacb9d030c3300 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 22 Feb 2015 23:52:11 +0100 Subject: [PATCH 0285/1029] Help: Move docs of $<0:...> and $<1:...> to output section. These are not 'logical' expressions. They create output and are often used together with the logical expressions. --- Help/manual/cmake-generator-expressions.7.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index d38cf7ee7..477a132d3 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -40,10 +40,6 @@ otherwise expands to nothing. Available logical expressions are: -``$<0:...>`` - Empty string (ignores ``...``) -``$<1:...>`` - Content of ``...`` ``$`` ``1`` if the ``...`` is true, else ``0`` ``$`` @@ -241,6 +237,10 @@ where ``${prop}`` refers to a helper variable:: Available output expressions are: +``$<0:...>`` + Empty string (ignores ``...``) +``$<1:...>`` + Content of ``...`` ``$`` Joins the list with the content of ``...`` ``$`` From 80b9f0cbe263c64613acd18e4e94505924fce40e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 22 Feb 2015 21:30:44 +0100 Subject: [PATCH 0286/1029] Genex: Extract an evaluateWithContext method. Make it easier to make modifications to the context before evaluating with it. --- Source/cmGeneratorExpression.cxx | 32 ++++++++++++++++++++------------ Source/cmGeneratorExpression.h | 4 ++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 0a270162a..a4990dc09 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,18 +72,6 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - if (!this->NeedsEvaluation) - { - return this->Input.c_str(); - } - - this->Output = ""; - - std::vector::const_iterator it - = this->Evaluators.begin(); - const std::vector::const_iterator end - = this->Evaluators.end(); - cmGeneratorExpressionContext context; context.Makefile = mf; context.Config = config; @@ -98,6 +86,26 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Backtrace = this->Backtrace; context.Language = language; + return this->EvaluateWithContext(context, dagChecker); +} + +//---------------------------------------------------------------------------- +const char* cmCompiledGeneratorExpression::EvaluateWithContext( + cmGeneratorExpressionContext& context, + cmGeneratorExpressionDAGChecker *dagChecker) const +{ + if (!this->NeedsEvaluation) + { + return this->Input.c_str(); + } + + this->Output = ""; + + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + for ( ; it != end; ++it) { this->Output += (*it)->Evaluate(&context, dagChecker); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 55d969170..11c27fdcf 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -24,6 +24,7 @@ class cmMakefile; class cmListFileBacktrace; struct cmGeneratorExpressionEvaluator; +struct cmGeneratorExpressionContext; struct cmGeneratorExpressionDAGChecker; class cmCompiledGeneratorExpression; @@ -131,6 +132,9 @@ public: std::map& mapping); private: + const char* EvaluateWithContext(cmGeneratorExpressionContext& context, + cmGeneratorExpressionDAGChecker *dagChecker) const; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, const std::string& input); From 3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 5 Mar 2015 23:14:27 +0100 Subject: [PATCH 0287/1029] cmAlgorithms: Add early return in cmRemoveIndices. Avoid derefencing the iterator and segfaulting if the range is empty. --- Source/cmAlgorithms.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9d7e7889..be57da3dc 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -237,6 +237,11 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) { typename InputRange::const_iterator remIt = rem.begin(); typename InputRange::const_iterator remEnd = rem.end(); + const typename Range::iterator rangeEnd = r.end(); + if (remIt == remEnd) + { + return rangeEnd; + } typename Range::iterator writer = r.begin(); std::advance(writer, *remIt); @@ -244,7 +249,6 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) typename InputRange::value_type prevRem = *remIt; ++remIt; size_t count = 1; - const typename Range::iterator rangeEnd = r.end(); for ( ; writer != rangeEnd && remIt != remEnd; ++count, ++remIt) { std::advance(pivot, *remIt - prevRem); From 9df1f0fce19d893b75108fa29eb06cf6b2ce4997 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 22 Feb 2015 23:32:11 +0100 Subject: [PATCH 0288/1029] Genex: Split cmGeneratorExpressionNode into own file. --- Source/CMakeLists.txt | 2 + Source/cmGeneratorExpressionEvaluator.cxx | 1892 +-------------------- Source/cmGeneratorExpressionNode.cxx | 1870 ++++++++++++++++++++ Source/cmGeneratorExpressionNode.h | 70 + bootstrap | 1 + 5 files changed, 1946 insertions(+), 1889 deletions(-) create mode 100644 Source/cmGeneratorExpressionNode.cxx create mode 100644 Source/cmGeneratorExpressionNode.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5b518b8f0..8d0d48494 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -244,6 +244,8 @@ set(SRCS cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx cmGeneratorExpressionLexer.h + cmGeneratorExpressionNode.cxx + cmGeneratorExpressionNode.h cmGeneratorExpressionParser.cxx cmGeneratorExpressionParser.h cmGeneratorExpression.cxx diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 756d93206..f2ffeefc3 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,1894 +24,7 @@ #include #include -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; - -//---------------------------------------------------------------------------- -std::string cmGeneratorExpressionNode::EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) -{ - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(makefile, - context->Config, - context->Quiet, - headTarget, - currentTarget, - dagChecker, - context->Language); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } - return result; -} - -//---------------------------------------------------------------------------- -static const struct ZeroNode : public cmGeneratorExpressionNode -{ - ZeroNode() {} - - virtual bool GeneratesContent() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return std::string(); - } -} zeroNode; - -//---------------------------------------------------------------------------- -static const struct OneNode : public cmGeneratorExpressionNode -{ - OneNode() {} - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } -} oneNode; - -//---------------------------------------------------------------------------- -static const struct OneNode buildInterfaceNode; - -//---------------------------------------------------------------------------- -static const struct ZeroNode installInterfaceNode; - -//---------------------------------------------------------------------------- -#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ -static const struct OP ## Node : public cmGeneratorExpressionNode \ -{ \ - OP ## Node () {} \ - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ - \ - std::string Evaluate(const std::vector ¶meters, \ - cmGeneratorExpressionContext *context, \ - const GeneratorExpressionContent *content, \ - cmGeneratorExpressionDAGChecker *) const \ - { \ - std::vector::const_iterator it = parameters.begin(); \ - const std::vector::const_iterator end = parameters.end(); \ - for ( ; it != end; ++it) \ - { \ - if (*it == #FAILURE_VALUE) \ - { \ - return #FAILURE_VALUE; \ - } \ - else if (*it != #SUCCESS_VALUE) \ - { \ - reportError(context, content->GetOriginalExpression(), \ - "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ - return std::string(); \ - } \ - } \ - return #SUCCESS_VALUE; \ - } \ -} OPNAME; - -BOOLEAN_OP_NODE(andNode, AND, 1, 0) -BOOLEAN_OP_NODE(orNode, OR, 0, 1) - -#undef BOOLEAN_OP_NODE - -//---------------------------------------------------------------------------- -static const struct NotNode : public cmGeneratorExpressionNode -{ - NotNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (*parameters.begin() != "0" && *parameters.begin() != "1") - { - reportError(context, content->GetOriginalExpression(), - "$ parameter must resolve to exactly one '0' or '1' value."); - return std::string(); - } - return *parameters.begin() == "0" ? "1" : "0"; - } -} notNode; - -//---------------------------------------------------------------------------- -static const struct BoolNode : public cmGeneratorExpressionNode -{ - BoolNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; - } -} boolNode; - -//---------------------------------------------------------------------------- -static const struct StrEqualNode : public cmGeneratorExpressionNode -{ - StrEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return *parameters.begin() == parameters[1] ? "1" : "0"; - } -} strEqualNode; - -//---------------------------------------------------------------------------- -static const struct EqualNode : public cmGeneratorExpressionNode -{ - EqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - char *pEnd; - - int base = 0; - bool flipSign = false; - - const char *lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) - { - base = 2; - lhs += 2; - } - if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) - { - base = 2; - lhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) - { - base = 2; - lhs += 3; - } - - long lnum = strtol(lhs, &pEnd, base); - if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[0] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - lnum = -lnum; - } - - base = 0; - flipSign = false; - - const char *rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) - { - base = 2; - rhs += 2; - } - if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) - { - base = 2; - rhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) - { - base = 2; - rhs += 3; - } - - long rnum = strtol(rhs, &pEnd, base); - if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[1] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - rnum = -rnum; - } - - return lnum == rnum ? "1" : "0"; - } -} equalNode; - -//---------------------------------------------------------------------------- -static const struct LowerCaseNode : public cmGeneratorExpressionNode -{ - LowerCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::LowerCase(parameters.front()); - } -} lowerCaseNode; - -//---------------------------------------------------------------------------- -static const struct UpperCaseNode : public cmGeneratorExpressionNode -{ - UpperCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::UpperCase(parameters.front()); - } -} upperCaseNode; - -//---------------------------------------------------------------------------- -static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode -{ - MakeCIdentifierNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::MakeCidentifier(parameters.front()); - } -} makeCIdentifierNode; - -//---------------------------------------------------------------------------- -static const struct Angle_RNode : public cmGeneratorExpressionNode -{ - Angle_RNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ">"; - } -} angle_rNode; - -//---------------------------------------------------------------------------- -static const struct CommaNode : public cmGeneratorExpressionNode -{ - CommaNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ","; - } -} commaNode; - -//---------------------------------------------------------------------------- -static const struct SemicolonNode : public cmGeneratorExpressionNode -{ - SemicolonNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ";"; - } -} semicolonNode; - -//---------------------------------------------------------------------------- -struct CompilerIdNode : public cmGeneratorExpressionNode -{ - CompilerIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerId = - context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); - if (parameters.empty()) - { - return compilerId ? compilerId : ""; - } - static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), compilerId) == 0) - { - return "1"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) - { - switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) - { - case cmPolicies::WARN: - { - std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::AUTHOR_WARNING, - e.str(), context->Backtrace); - } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } - return "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerIdNode : public CompilerIdNode -{ - CCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerIdNode; - -//---------------------------------------------------------------------------- -static const struct CXXCompilerIdNode : public CompilerIdNode -{ - CXXCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerIdNode; - -//---------------------------------------------------------------------------- -struct CompilerVersionNode : public cmGeneratorExpressionNode -{ - CompilerVersionNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerVersion = context->Makefile->GetSafeDefinition( - "CMAKE_" + lang + "_COMPILER_VERSION"); - if (parameters.empty()) - { - return compilerVersion ? compilerVersion : ""; - } - - static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerVersion) - { - return parameters.front().empty() ? "1" : "0"; - } - - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.begin()->c_str(), - compilerVersion) ? "1" : "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerVersionNode : public CompilerVersionNode -{ - CCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerVersionNode; - -//---------------------------------------------------------------------------- -static const struct CxxCompilerVersionNode : public CompilerVersionNode -{ - CxxCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerVersionNode; - - -//---------------------------------------------------------------------------- -struct PlatformIdNode : public cmGeneratorExpressionNode -{ - PlatformIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - const char *platformId = - context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - if (parameters.empty()) - { - return platformId ? platformId : ""; - } - - if (!platformId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), platformId) == 0) - { - return "1"; - } - return "0"; - } -} platformIdNode; - -//---------------------------------------------------------------------------- -static const struct VersionGreaterNode : public cmGeneratorExpressionNode -{ - VersionGreaterNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionGreaterNode; - -//---------------------------------------------------------------------------- -static const struct VersionLessNode : public cmGeneratorExpressionNode -{ - VersionLessNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionLessNode; - -//---------------------------------------------------------------------------- -static const struct VersionEqualNode : public cmGeneratorExpressionNode -{ - VersionEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionEqualNode; - -//---------------------------------------------------------------------------- -static const struct LinkOnlyNode : public cmGeneratorExpressionNode -{ - LinkOnlyNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(!dagChecker->GetTransitivePropertiesOnly()) - { - return parameters.front(); - } - return ""; - } -} linkOnlyNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationNode : public cmGeneratorExpressionNode -{ - ConfigurationNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - context->HadContextSensitiveCondition = true; - return context->Config; - } -} configurationNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationTestNode : public cmGeneratorExpressionNode -{ - ConfigurationTestNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (parameters.empty()) - { - return configurationNode.Evaluate(parameters, context, content, 0); - } - static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); - if (!configValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - context->HadContextSensitiveCondition = true; - if (context->Config.empty()) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config.c_str()) == 0) - { - return "1"; - } - - if (context->CurrentTarget - && context->CurrentTarget->IsImported()) - { - const char* loc = 0; - const char* imp = 0; - std::string suffix; - if (context->CurrentTarget->GetMappedConfig(context->Config, - &loc, - &imp, - suffix)) - { - // This imported target has an appropriate location - // for this (possibly mapped) config. - // Check if there is a proper config mapping for the tested config. - std::vector mappedConfigs; - std::string mapProp = "MAP_IMPORTED_CONFIG_"; - mapProp += cmSystemTools::UpperCase(context->Config); - if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp)) - { - cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), - mappedConfigs); - return std::find(mappedConfigs.begin(), mappedConfigs.end(), - cmSystemTools::UpperCase(parameters.front())) - != mappedConfigs.end() ? "1" : "0"; - } - } - } - return "0"; - } -} configurationTestNode; - -static const struct JoinNode : public cmGeneratorExpressionNode -{ - JoinNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - std::vector list; - cmSystemTools::ExpandListArgument(parameters.front(), list); - return cmJoin(list, parameters[1]); - } -} joinNode; - -static const struct CompileLanguageNode : public cmGeneratorExpressionNode -{ - CompileLanguageNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(context->Language.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used to specify include " - "directories compile definitions, compile options and to evaluate " - "components of the file(GENERATE) command."); - return std::string(); - } - - std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->GetEnabledLanguages(enabledLanguages); - if (!parameters.empty() && - std::find(enabledLanguages.begin(), enabledLanguages.end(), - parameters.front()) == enabledLanguages.end()) - { - reportError(context, content->GetOriginalExpression(), - "$ Unknown language."); - return std::string(); - } - - std::string genName = gg->GetName(); - if (genName.find("Visual Studio") != std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ may not be used with Visual Studio " - "generators."); - return std::string(); - } - else if (genName.find("Xcode") != std::string::npos) - { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() - || dagChecker->EvaluatingIncludeDirectories())) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with COMPILE_OPTIONS " - "with the Xcode generator."); - return std::string(); - } - } - else - { - if(genName.find("Makefiles") == std::string::npos && - genName.find("Ninja") == std::string::npos && - genName.find("Watcom WMake") == std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ not supported for this generator."); - return std::string(); - } - } - if (parameters.empty()) - { - return context->Language; - } - return context->Language == parameters.front() ? "1" : "0"; - } -} languageNode; - -#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ - , "INTERFACE_" #PROPERTY - -//---------------------------------------------------------------------------- -static const char* targetPropertyTransitiveWhitelist[] = { - 0 - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) -}; - -#undef TRANSITIVE_PROPERTY_NAME - -template -std::string -getLinkedTargetsContent( - std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) -{ - std::string linkedTargetsContent; - std::string sep; - std::string depString; - for (typename std::vector::const_iterator it = libraries.begin(); - it != libraries.end(); ++it) - { - // Broken code can have a target in its own link interface. - // Don't follow such link interface entries so as not to create a - // self-referencing loop. - if (it->Target && it->Target != target) - { - depString += - sep + "$Target->GetName() + "," + interfacePropertyName + ">"; - sep = ";"; - } - } - if(!depString.empty()) - { - linkedTargetsContent = - cmGeneratorExpressionNode::EvaluateDependentExpression(depString, - target->GetMakefile(), context, - headTarget, target, dagChecker); - } - linkedTargetsContent = - cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); - return linkedTargetsContent; -} - -//---------------------------------------------------------------------------- -static const struct TargetPropertyNode : public cmGeneratorExpressionNode -{ - TargetPropertyNode() {} - - // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagCheckerParent - ) const - { - if (parameters.size() != 1 && parameters.size() != 2) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires one or two parameters"); - return std::string(); - } - static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); - - cmTarget const* target = context->HeadTarget; - std::string propertyName = *parameters.begin(); - - if (parameters.size() == 1) - { - context->HadHeadSensitiveCondition = true; - } - if (!target && parameters.size() == 1) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target. " - "Specify the target to read a property from using the " - "$ signature instead."); - return std::string(); - } - - if (parameters.size() == 2) - { - if (parameters.begin()->empty() && parameters[1].empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name and property name."); - return std::string(); - } - if (parameters.begin()->empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name."); - return std::string(); - } - - std::string targetName = parameters.front(); - propertyName = parameters[1]; - if (!cmGeneratorExpression::IsValidTargetName(targetName)) - { - if (!propertyNameValidator.find(propertyName.c_str())) - { - ::reportError(context, content->GetOriginalExpression(), - "Target name and property name not supported."); - return std::string(); - } - ::reportError(context, content->GetOriginalExpression(), - "Target name not supported."); - return std::string(); - } - if(propertyName == "ALIASED_TARGET") - { - if(context->Makefile->IsAlias(targetName)) - { - if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) - { - return tgt->GetName(); - } - } - return ""; - } - target = context->Makefile->FindTargetToUse(targetName); - - if (!target) - { - std::ostringstream e; - e << "Target \"" - << targetName - << "\" not found."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - context->AllTargets.insert(target); - } - - if (target == context->HeadTarget) - { - // Keep track of the properties seen while processing. - // The evaluation of the LINK_LIBRARIES generator expressions - // will check this to ensure that properties have one consistent - // value for all evaluations. - context->SeenTargetProperties.insert(propertyName); - } - if (propertyName == "SOURCES") - { - context->SourceSensitiveTargets.insert(target); - } - - if (propertyName.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty property " - "name."); - return std::string(); - } - - if (!propertyNameValidator.find(propertyName)) - { - ::reportError(context, content->GetOriginalExpression(), - "Property name not supported."); - return std::string(); - } - - assert(target); - - if (propertyName == "LINKER_LANGUAGE") - { - if (target->LinkLanguagePropagatesToDependents() && - dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() - || dagCheckerParent->EvaluatingSources())) - { - reportError(context, content->GetOriginalExpression(), - "LINKER_LANGUAGE target property can not be used while evaluating " - "link libraries for a static library"); - return std::string(); - } - return target->GetLinkerLanguage(context->Config); - } - - cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, - target->GetName(), - propertyName, - content, - dagCheckerParent); - - switch (dagChecker.Check()) - { - case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: - dagChecker.ReportError(context, content->GetOriginalExpression()); - return std::string(); - case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: - // No error. We just skip cyclic references. - return std::string(); - case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: - for (size_t i = 1; - i < cmArraySize(targetPropertyTransitiveWhitelist); - ++i) - { - if (targetPropertyTransitiveWhitelist[i] == propertyName) - { - // No error. We're not going to find anything new here. - return std::string(); - } - } - case cmGeneratorExpressionDAGChecker::DAG: - break; - } - - const char *prop = target->GetProperty(propertyName); - - if (dagCheckerParent) - { - if (dagCheckerParent->EvaluatingLinkLibraries()) - { -#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ - (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || - if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) - false) - { - reportError(context, content->GetOriginalExpression(), - "$ expression in link libraries " - "evaluation depends on target property which is transitive " - "over the link libraries, creating a recursion."); - return std::string(); - } -#undef TRANSITIVE_PROPERTY_COMPARE - - if(!prop) - { - return std::string(); - } - } - else - { -#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ - dagCheckerParent->METHOD () || - - assert( - CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - ASSERT_TRANSITIVE_PROPERTY_METHOD) - false); -#undef ASSERT_TRANSITIVE_PROPERTY_METHOD - } - } - - std::string linkedTargetsContent; - - std::string interfacePropertyName; - bool isInterfaceProperty = false; - -#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ - if (propertyName == #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - } \ - else if (propertyName == "INTERFACE_" #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - isInterfaceProperty = true; \ - } \ - else - - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) - // Note that the above macro terminates with an else - /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), - "COMPILE_DEFINITIONS_")) - { - cmPolicies::PolicyStatus polSt = - context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); - if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) - { - interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; - } - } -#undef POPULATE_INTERFACE_PROPERTY_NAME - cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty - ? context->HeadTarget : target; - - if(isInterfaceProperty) - { - if(cmTarget::LinkInterfaceLibraries const* iface = - target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) - { - linkedTargetsContent = - getLinkedTargetsContent(iface->Libraries, target, - headTarget, - context, &dagChecker, - interfacePropertyName); - } - } - else if(!interfacePropertyName.empty()) - { - if(cmTarget::LinkImplementationLibraries const* impl = - target->GetLinkImplementationLibraries(context->Config)) - { - linkedTargetsContent = - getLinkedTargetsContent(impl->Libraries, target, - target, - context, &dagChecker, - interfacePropertyName); - } - } - - if (!prop) - { - if (target->IsImported() - || target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - return linkedTargetsContent; - } - if (target->IsLinkInterfaceDependentBoolProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - return target->GetLinkInterfaceDependentBoolProperty( - propertyName, - context->Config) ? "1" : "0"; - } - if (target->IsLinkInterfaceDependentStringProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentStringProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - - return linkedTargetsContent; - } - - if (!target->IsImported() - && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) - { - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - } - if(!interfacePropertyName.empty()) - { - std::string result = this->EvaluateDependentExpression(prop, - context->Makefile, context, - headTarget, target, &dagChecker); - if (!linkedTargetsContent.empty()) - { - result += (result.empty() ? "" : ";") + linkedTargetsContent; - } - return result; - } - return prop; - } -} targetPropertyNode; - -//---------------------------------------------------------------------------- -static const struct TargetNameNode : public cmGeneratorExpressionNode -{ - TargetNameNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } - - virtual int NumExpectedParameters() const { return 1; } - -} targetNameNode; - -//---------------------------------------------------------------------------- -static const struct TargetObjectsNode : public cmGeneratorExpressionNode -{ - TargetObjectsNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->EvaluateForBuildsystem) - { - std::ostringstream e; - e << "The evaluation of the TARGET_OBJECTS generator expression " - "is only suitable for consumption by CMake. It is not suitable " - "for writing out elsewhere."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::string tgtName = parameters.front(); - cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName); - if (!gt) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but no such target exists."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - if (gt->GetType() != cmTarget::OBJECT_LIBRARY) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but is not an OBJECT library."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::vector objectSources; - gt->GetObjectSources(objectSources, context->Config); - std::map mapping; - - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - std::string obj_dir = gt->ObjectDirectory; - std::string result; - const char* sep = ""; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - // Find the object file name corresponding to this source file. - std::map::const_iterator - map_it = mapping.find(*it); - // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - result += sep; - std::string objFile = obj_dir + map_it->second; - cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); - sf->SetObjectLibrary(tgtName); - sf->SetProperty("EXTERNAL_OBJECT", "1"); - result += objFile; - sep = ";"; - } - return result; - } -} targetObjectsNode; - -//---------------------------------------------------------------------------- -static const struct CompileFeaturesNode : public cmGeneratorExpressionNode -{ - CompileFeaturesNode() {} - - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - cmTarget const* target = context->HeadTarget; - if (!target) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - context->HadHeadSensitiveCondition = true; - - typedef std::map > LangMap; - static LangMap availableFeatures; - - LangMap testedFeatures; - - for (std::vector::const_iterator it = parameters.begin(); - it != parameters.end(); ++it) - { - std::string error; - std::string lang; - if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, - *it, lang, &error)) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - testedFeatures[lang].push_back(*it); - - if (availableFeatures.find(lang) == availableFeatures.end()) - { - const char* featuresKnown - = context->Makefile->CompileFeaturesAvailable(lang, &error); - if (!featuresKnown) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - cmSystemTools::ExpandListArgument(featuresKnown, - availableFeatures[lang]); - } - } - - bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); - - std::string result; - - for (LangMap::const_iterator lit = testedFeatures.begin(); - lit != testedFeatures.end(); ++lit) - { - std::vector const& langAvailable - = availableFeatures[lit->first]; - const char* standardDefault = context->Makefile - ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); - for (std::vector::const_iterator it = lit->second.begin(); - it != lit->second.end(); ++it) - { - if (std::find(langAvailable.begin(), langAvailable.end(), *it) - == langAvailable.end()) - { - return "0"; - } - if (standardDefault && !*standardDefault) - { - // This compiler has no notion of language standard levels. - // All features known for the language are always available. - continue; - } - if (!context->Makefile->HaveStandardAvailable(target, - lit->first, *it)) - { - if (evalLL) - { - const char* l = target->GetProperty(lit->first + "_STANDARD"); - if (!l) - { - l = standardDefault; - } - assert(l); - context->MaxLanguageStandard[target][lit->first] = l; - } - else - { - return "0"; - } - } - } - } - return "1"; - } -} compileFeaturesNode; - -//---------------------------------------------------------------------------- -static const char* targetPolicyWhitelist[] = { - 0 -#define TARGET_POLICY_STRING(POLICY) \ - , #POLICY - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) - -#undef TARGET_POLICY_STRING -}; - -cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, - const char *policy) -{ -#define RETURN_POLICY(POLICY) \ - if (strcmp(policy, #POLICY) == 0) \ - { \ - return tgt->GetPolicyStatus ## POLICY (); \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) - -#undef RETURN_POLICY - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::WARN; -} - -cmPolicies::PolicyID policyForString(const char *policy_id) -{ -#define RETURN_POLICY_ID(POLICY_ID) \ - if (strcmp(policy_id, #POLICY_ID) == 0) \ - { \ - return cmPolicies:: POLICY_ID; \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) - -#undef RETURN_POLICY_ID - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::CMP0002; -} - -//---------------------------------------------------------------------------- -static const struct TargetPolicyNode : public cmGeneratorExpressionNode -{ - TargetPolicyNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context , - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - - context->HadContextSensitiveCondition = true; - context->HadHeadSensitiveCondition = true; - - for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) - { - const char *policy = targetPolicyWhitelist[i]; - if (parameters.front() == policy) - { - cmMakefile *mf = context->HeadTarget->GetMakefile(); - switch(statusForTarget(context->HeadTarget, policy)) - { - case cmPolicies::WARN: - mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::OLD: - return "0"; - case cmPolicies::NEW: - return "1"; - } - } - } - reportError(context, content->GetOriginalExpression(), - "$ may only be used with a limited number of " - "policies. Currently it may be used with the following policies:\n" - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -#define TARGET_POLICY_LIST_ITEM(POLICY) \ - " * " STRINGIFY(POLICY) "\n" - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) - -#undef TARGET_POLICY_LIST_ITEM - ); - return std::string(); - } - -} targetPolicyNode; - -//---------------------------------------------------------------------------- -static const struct InstallPrefixNode : public cmGeneratorExpressionNode -{ - InstallPrefixNode() {} - - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - reportError(context, content->GetOriginalExpression(), - "INSTALL_PREFIX is a marker for install(EXPORT) only. It " - "should never be evaluated."); - return std::string(); - } - -} installPrefixNode; - -//---------------------------------------------------------------------------- -class ArtifactNameTag; -class ArtifactLinkerTag; -class ArtifactSonameTag; -class ArtifactPdbTag; - -class ArtifactPathTag; -class ArtifactDirTag; -class ArtifactNameTag; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is not allowed " - "for DLL target platforms."); - return std::string(); - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is allowed only for " - "SHARED libraries."); - return std::string(); - } - std::string result = target->GetDirectory(context->Config); - result += "/"; - result += target->GetSOName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - std::string language = target->GetLinkerLanguage(context->Config); - - std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; - - if(!context->Makefile->IsOn(pdbSupportVar)) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is not supported by the target linker."); - return std::string(); - } - - cmTarget::TargetType targetType = target->GetType(); - - if(targetType != cmTarget::SHARED_LIBRARY && - targetType != cmTarget::MODULE_LIBRARY && - targetType != cmTarget::EXECUTABLE) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is allowed only for " - "targets with linker created artifacts."); - return std::string(); - } - - std::string result = target->GetPDBDirectory(context->Config); - result += "/"; - result += target->GetPDBName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return std::string(); - } - return target->GetFullPath(context->Config, - target->HasImportLibrary()); - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *) - { - return target->GetFullPath(context->Config, false, true); - } -}; - - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenameName(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenamePath(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return result; } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifact : public cmGeneratorExpressionNode -{ - TargetFilesystemArtifact() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - // Lookup the referenced target. - std::string name = *parameters.begin(); - - if (!cmGeneratorExpression::IsValidTargetName(name)) - { - ::reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - cmTarget* target = context->Makefile->FindTargetToUse(name); - if(!target) - { - ::reportError(context, content->GetOriginalExpression(), - "No target \"" + name + "\""); - return std::string(); - } - if(target->GetType() >= cmTarget::OBJECT_LIBRARY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "Target \"" + name + "\" is not an executable or library."); - return std::string(); - } - if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) - || (dagChecker->EvaluatingSources() - && name == dagChecker->TopTarget()))) - { - ::reportError(context, content->GetOriginalExpression(), - "Expressions which require the linker language may not " - "be used while evaluating link libraries"); - return std::string(); - } - context->DependTargets.insert(target); - context->AllTargets.insert(target); - - std::string result = - TargetFilesystemArtifactResultCreator::Create( - target, - context, - content); - if (context->HadError) - { - return std::string(); - } - return - TargetFilesystemArtifactResultGetter::Get(result); - } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactNodeGroup -{ - TargetFilesystemArtifactNodeGroup() - { - } - - TargetFilesystemArtifact File; - TargetFilesystemArtifact FileName; - TargetFilesystemArtifact FileDir; -}; - -//---------------------------------------------------------------------------- -static const -TargetFilesystemArtifactNodeGroup targetNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; - -//---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) -{ - typedef std::map NodeMap; - static NodeMap nodeMap; - if (nodeMap.empty()) - { - nodeMap["0"] = &zeroNode; - nodeMap["1"] = &oneNode; - nodeMap["AND"] = &andNode; - nodeMap["OR"] = &orNode; - nodeMap["NOT"] = ¬Node; - nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; - nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; - nodeMap["VERSION_GREATER"] = &versionGreaterNode; - nodeMap["VERSION_LESS"] = &versionLessNode; - nodeMap["VERSION_EQUAL"] = &versionEqualNode; - nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; - nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; - nodeMap["PLATFORM_ID"] = &platformIdNode; - nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; - nodeMap["CONFIGURATION"] = &configurationNode; - nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetNodeGroup.File; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; - nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; - nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; - nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; - nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; - nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; - nodeMap["STREQUAL"] = &strEqualNode; - nodeMap["EQUAL"] = &equalNode; - nodeMap["LOWER_CASE"] = &lowerCaseNode; - nodeMap["UPPER_CASE"] = &upperCaseNode; - nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; - nodeMap["BOOL"] = &boolNode; - nodeMap["ANGLE-R"] = &angle_rNode; - nodeMap["COMMA"] = &commaNode; - nodeMap["SEMICOLON"] = &semicolonNode; - nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; - nodeMap["TARGET_NAME"] = &targetNameNode; - nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; - nodeMap["TARGET_POLICY"] = &targetPolicyNode; - nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; - nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; - nodeMap["INSTALL_PREFIX"] = &installPrefixNode; - nodeMap["JOIN"] = &joinNode; - nodeMap["LINK_ONLY"] = &linkOnlyNode; - nodeMap["COMPILE_LANGUAGE"] = &languageNode; - } - NodeMap::const_iterator i = nodeMap.find(identifier); - if (i == nodeMap.end()) - { - return 0; - } - return i->second; - -} +#include "cmGeneratorExpressionNode.h" //---------------------------------------------------------------------------- GeneratorExpressionContent::GeneratorExpressionContent( @@ -2000,7 +113,8 @@ std::string GeneratorExpressionContent::Evaluate( } } - const cmGeneratorExpressionNode *node = GetNode(identifier); + const cmGeneratorExpressionNode *node = + cmGeneratorExpressionNode::GetNode(identifier); if (!node) { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx new file mode 100644 index 000000000..673dcb937 --- /dev/null +++ b/Source/cmGeneratorExpressionNode.cxx @@ -0,0 +1,1870 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionNode.h" +#include "cmGlobalGenerator.h" +#include "cmAlgorithms.h" + +//---------------------------------------------------------------------------- +std::string cmGeneratorExpressionNode::EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker) +{ + cmGeneratorExpression ge(&context->Backtrace); + cmsys::auto_ptr cge = ge.Parse(prop); + cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); + std::string result = cge->Evaluate(makefile, + context->Config, + context->Quiet, + headTarget, + currentTarget, + dagChecker, + context->Language); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } + return result; +} + +//---------------------------------------------------------------------------- +static const struct ZeroNode : public cmGeneratorExpressionNode +{ + ZeroNode() {} + + virtual bool GeneratesContent() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return std::string(); + } +} zeroNode; + +//---------------------------------------------------------------------------- +static const struct OneNode : public cmGeneratorExpressionNode +{ + OneNode() {} + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return parameters.front(); + } +} oneNode; + +//---------------------------------------------------------------------------- +static const struct OneNode buildInterfaceNode; + +//---------------------------------------------------------------------------- +static const struct ZeroNode installInterfaceNode; + +//---------------------------------------------------------------------------- +#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ +static const struct OP ## Node : public cmGeneratorExpressionNode \ +{ \ + OP ## Node () {} \ + virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ + \ + std::string Evaluate(const std::vector ¶meters, \ + cmGeneratorExpressionContext *context, \ + const GeneratorExpressionContent *content, \ + cmGeneratorExpressionDAGChecker *) const \ + { \ + std::vector::const_iterator it = parameters.begin(); \ + const std::vector::const_iterator end = parameters.end(); \ + for ( ; it != end; ++it) \ + { \ + if (*it == #FAILURE_VALUE) \ + { \ + return #FAILURE_VALUE; \ + } \ + else if (*it != #SUCCESS_VALUE) \ + { \ + reportError(context, content->GetOriginalExpression(), \ + "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ + return std::string(); \ + } \ + } \ + return #SUCCESS_VALUE; \ + } \ +} OPNAME; + +BOOLEAN_OP_NODE(andNode, AND, 1, 0) +BOOLEAN_OP_NODE(orNode, OR, 0, 1) + +#undef BOOLEAN_OP_NODE + +//---------------------------------------------------------------------------- +static const struct NotNode : public cmGeneratorExpressionNode +{ + NotNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (*parameters.begin() != "0" && *parameters.begin() != "1") + { + reportError(context, content->GetOriginalExpression(), + "$ parameter must resolve to exactly one '0' or '1' value."); + return std::string(); + } + return *parameters.begin() == "0" ? "1" : "0"; + } +} notNode; + +//---------------------------------------------------------------------------- +static const struct BoolNode : public cmGeneratorExpressionNode +{ + BoolNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; + } +} boolNode; + +//---------------------------------------------------------------------------- +static const struct StrEqualNode : public cmGeneratorExpressionNode +{ + StrEqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return *parameters.begin() == parameters[1] ? "1" : "0"; + } +} strEqualNode; + +//---------------------------------------------------------------------------- +static const struct EqualNode : public cmGeneratorExpressionNode +{ + EqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + char *pEnd; + + int base = 0; + bool flipSign = false; + + const char *lhs = parameters[0].c_str(); + if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) + { + base = 2; + lhs += 2; + } + if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) + { + base = 2; + lhs += 3; + flipSign = true; + } + if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) + { + base = 2; + lhs += 3; + } + + long lnum = strtol(lhs, &pEnd, base); + if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) + { + reportError(context, content->GetOriginalExpression(), + "$ parameter " + parameters[0] + " is not a valid integer."); + return std::string(); + } + + if (flipSign) + { + lnum = -lnum; + } + + base = 0; + flipSign = false; + + const char *rhs = parameters[1].c_str(); + if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) + { + base = 2; + rhs += 2; + } + if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) + { + base = 2; + rhs += 3; + flipSign = true; + } + if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) + { + base = 2; + rhs += 3; + } + + long rnum = strtol(rhs, &pEnd, base); + if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) + { + reportError(context, content->GetOriginalExpression(), + "$ parameter " + parameters[1] + " is not a valid integer."); + return std::string(); + } + + if (flipSign) + { + rnum = -rnum; + } + + return lnum == rnum ? "1" : "0"; + } +} equalNode; + +//---------------------------------------------------------------------------- +static const struct LowerCaseNode : public cmGeneratorExpressionNode +{ + LowerCaseNode() {} + + bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::LowerCase(parameters.front()); + } +} lowerCaseNode; + +//---------------------------------------------------------------------------- +static const struct UpperCaseNode : public cmGeneratorExpressionNode +{ + UpperCaseNode() {} + + bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::UpperCase(parameters.front()); + } +} upperCaseNode; + +//---------------------------------------------------------------------------- +static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode +{ + MakeCIdentifierNode() {} + + bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::MakeCidentifier(parameters.front()); + } +} makeCIdentifierNode; + +//---------------------------------------------------------------------------- +static const struct Angle_RNode : public cmGeneratorExpressionNode +{ + Angle_RNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ">"; + } +} angle_rNode; + +//---------------------------------------------------------------------------- +static const struct CommaNode : public cmGeneratorExpressionNode +{ + CommaNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ","; + } +} commaNode; + +//---------------------------------------------------------------------------- +static const struct SemicolonNode : public cmGeneratorExpressionNode +{ + SemicolonNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ";"; + } +} semicolonNode; + +//---------------------------------------------------------------------------- +struct CompilerIdNode : public cmGeneratorExpressionNode +{ + CompilerIdNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string EvaluateWithLanguage(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *, + const std::string &lang) const + { + const char *compilerId = + context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); + if (parameters.empty()) + { + return compilerId ? compilerId : ""; + } + static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); + if (!compilerIdValidator.find(*parameters.begin())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + if (!compilerId) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (strcmp(parameters.begin()->c_str(), compilerId) == 0) + { + return "1"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) + { + switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) + { + case cmPolicies::WARN: + { + std::ostringstream e; + e << context->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0044); + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::AUTHOR_WARNING, + e.str(), context->Backtrace); + } + case cmPolicies::OLD: + return "1"; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } + return "0"; + } +}; + +//---------------------------------------------------------------------------- +static const struct CCompilerIdNode : public CompilerIdNode +{ + CCompilerIdNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "C"); + } +} cCompilerIdNode; + +//---------------------------------------------------------------------------- +static const struct CXXCompilerIdNode : public CompilerIdNode +{ + CXXCompilerIdNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "CXX"); + } +} cxxCompilerIdNode; + +//---------------------------------------------------------------------------- +struct CompilerVersionNode : public cmGeneratorExpressionNode +{ + CompilerVersionNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string EvaluateWithLanguage(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *, + const std::string &lang) const + { + const char *compilerVersion = context->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_VERSION"); + if (parameters.empty()) + { + return compilerVersion ? compilerVersion : ""; + } + + static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); + if (!compilerIdValidator.find(*parameters.begin())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + if (!compilerVersion) + { + return parameters.front().empty() ? "1" : "0"; + } + + return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + parameters.begin()->c_str(), + compilerVersion) ? "1" : "0"; + } +}; + +//---------------------------------------------------------------------------- +static const struct CCompilerVersionNode : public CompilerVersionNode +{ + CCompilerVersionNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "C"); + } +} cCompilerVersionNode; + +//---------------------------------------------------------------------------- +static const struct CxxCompilerVersionNode : public CompilerVersionNode +{ + CxxCompilerVersionNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "CXX"); + } +} cxxCompilerVersionNode; + + +//---------------------------------------------------------------------------- +struct PlatformIdNode : public cmGeneratorExpressionNode +{ + PlatformIdNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + const char *platformId = + context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); + if (parameters.empty()) + { + return platformId ? platformId : ""; + } + + if (!platformId) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (strcmp(parameters.begin()->c_str(), platformId) == 0) + { + return "1"; + } + return "0"; + } +} platformIdNode; + +//---------------------------------------------------------------------------- +static const struct VersionGreaterNode : public cmGeneratorExpressionNode +{ + VersionGreaterNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, + parameters.front().c_str(), + parameters[1].c_str()) ? "1" : "0"; + } +} versionGreaterNode; + +//---------------------------------------------------------------------------- +static const struct VersionLessNode : public cmGeneratorExpressionNode +{ + VersionLessNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + parameters.front().c_str(), + parameters[1].c_str()) ? "1" : "0"; + } +} versionLessNode; + +//---------------------------------------------------------------------------- +static const struct VersionEqualNode : public cmGeneratorExpressionNode +{ + VersionEqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + parameters.front().c_str(), + parameters[1].c_str()) ? "1" : "0"; + } +} versionEqualNode; + +//---------------------------------------------------------------------------- +static const struct LinkOnlyNode : public cmGeneratorExpressionNode +{ + LinkOnlyNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if(!dagChecker->GetTransitivePropertiesOnly()) + { + return parameters.front(); + } + return ""; + } +} linkOnlyNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationNode : public cmGeneratorExpressionNode +{ + ConfigurationNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + context->HadContextSensitiveCondition = true; + return context->Config; + } +} configurationNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationTestNode : public cmGeneratorExpressionNode +{ + ConfigurationTestNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (parameters.empty()) + { + return configurationNode.Evaluate(parameters, context, content, 0); + } + static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); + if (!configValidator.find(*parameters.begin())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + context->HadContextSensitiveCondition = true; + if (context->Config.empty()) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), + context->Config.c_str()) == 0) + { + return "1"; + } + + if (context->CurrentTarget + && context->CurrentTarget->IsImported()) + { + const char* loc = 0; + const char* imp = 0; + std::string suffix; + if (context->CurrentTarget->GetMappedConfig(context->Config, + &loc, + &imp, + suffix)) + { + // This imported target has an appropriate location + // for this (possibly mapped) config. + // Check if there is a proper config mapping for the tested config. + std::vector mappedConfigs; + std::string mapProp = "MAP_IMPORTED_CONFIG_"; + mapProp += cmSystemTools::UpperCase(context->Config); + if(const char* mapValue = + context->CurrentTarget->GetProperty(mapProp)) + { + cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), + mappedConfigs); + return std::find(mappedConfigs.begin(), mappedConfigs.end(), + cmSystemTools::UpperCase(parameters.front())) + != mappedConfigs.end() ? "1" : "0"; + } + } + } + return "0"; + } +} configurationTestNode; + +static const struct JoinNode : public cmGeneratorExpressionNode +{ + JoinNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + std::vector list; + cmSystemTools::ExpandListArgument(parameters.front(), list); + return cmJoin(list, parameters[1]); + } +} joinNode; + +static const struct CompileLanguageNode : public cmGeneratorExpressionNode +{ + CompileLanguageNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if(context->Language.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used to specify include " + "directories compile definitions, compile options and to evaluate " + "components of the file(GENERATE) command."); + return std::string(); + } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + std::string genName = gg->GetName(); + if (genName.find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else if (genName.find("Xcode") != std::string::npos) + { + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } + else + { + if(genName.find("Makefiles") == std::string::npos && + genName.find("Ninja") == std::string::npos && + genName.find("Watcom WMake") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } + if (parameters.empty()) + { + return context->Language; + } + return context->Language == parameters.front() ? "1" : "0"; + } +} languageNode; + +#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ + , "INTERFACE_" #PROPERTY + +//---------------------------------------------------------------------------- +static const char* targetPropertyTransitiveWhitelist[] = { + 0 + CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) +}; + +#undef TRANSITIVE_PROPERTY_NAME + +template +std::string +getLinkedTargetsContent( + std::vector const &libraries, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) +{ + std::string linkedTargetsContent; + std::string sep; + std::string depString; + for (typename std::vector::const_iterator it = libraries.begin(); + it != libraries.end(); ++it) + { + // Broken code can have a target in its own link interface. + // Don't follow such link interface entries so as not to create a + // self-referencing loop. + if (it->Target && it->Target != target) + { + depString += + sep + "$Target->GetName() + "," + interfacePropertyName + ">"; + sep = ";"; + } + } + if(!depString.empty()) + { + linkedTargetsContent = + cmGeneratorExpressionNode::EvaluateDependentExpression(depString, + target->GetMakefile(), context, + headTarget, target, dagChecker); + } + linkedTargetsContent = + cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); + return linkedTargetsContent; +} + +//---------------------------------------------------------------------------- +static const struct TargetPropertyNode : public cmGeneratorExpressionNode +{ + TargetPropertyNode() {} + + // This node handles errors on parameter count itself. + virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagCheckerParent + ) const + { + if (parameters.size() != 1 && parameters.size() != 2) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires one or two parameters"); + return std::string(); + } + static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); + + cmTarget const* target = context->HeadTarget; + std::string propertyName = *parameters.begin(); + + if (parameters.size() == 1) + { + context->HadHeadSensitiveCondition = true; + } + if (!target && parameters.size() == 1) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. " + "It may not be used with add_custom_command or add_custom_target. " + "Specify the target to read a property from using the " + "$ signature instead."); + return std::string(); + } + + if (parameters.size() == 2) + { + if (parameters.begin()->empty() && parameters[1].empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "target name and property name."); + return std::string(); + } + if (parameters.begin()->empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "target name."); + return std::string(); + } + + std::string targetName = parameters.front(); + propertyName = parameters[1]; + if (!cmGeneratorExpression::IsValidTargetName(targetName)) + { + if (!propertyNameValidator.find(propertyName.c_str())) + { + ::reportError(context, content->GetOriginalExpression(), + "Target name and property name not supported."); + return std::string(); + } + ::reportError(context, content->GetOriginalExpression(), + "Target name not supported."); + return std::string(); + } + if(propertyName == "ALIASED_TARGET") + { + if(context->Makefile->IsAlias(targetName)) + { + if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) + { + return tgt->GetName(); + } + } + return ""; + } + target = context->Makefile->FindTargetToUse(targetName); + + if (!target) + { + std::ostringstream e; + e << "Target \"" + << targetName + << "\" not found."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + context->AllTargets.insert(target); + } + + if (target == context->HeadTarget) + { + // Keep track of the properties seen while processing. + // The evaluation of the LINK_LIBRARIES generator expressions + // will check this to ensure that properties have one consistent + // value for all evaluations. + context->SeenTargetProperties.insert(propertyName); + } + if (propertyName == "SOURCES") + { + context->SourceSensitiveTargets.insert(target); + } + + if (propertyName.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty property " + "name."); + return std::string(); + } + + if (!propertyNameValidator.find(propertyName)) + { + ::reportError(context, content->GetOriginalExpression(), + "Property name not supported."); + return std::string(); + } + + assert(target); + + if (propertyName == "LINKER_LANGUAGE") + { + if (target->LinkLanguagePropagatesToDependents() && + dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() + || dagCheckerParent->EvaluatingSources())) + { + reportError(context, content->GetOriginalExpression(), + "LINKER_LANGUAGE target property can not be used while evaluating " + "link libraries for a static library"); + return std::string(); + } + return target->GetLinkerLanguage(context->Config); + } + + cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, + target->GetName(), + propertyName, + content, + dagCheckerParent); + + switch (dagChecker.Check()) + { + case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: + dagChecker.ReportError(context, content->GetOriginalExpression()); + return std::string(); + case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: + // No error. We just skip cyclic references. + return std::string(); + case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: + for (size_t i = 1; + i < cmArraySize(targetPropertyTransitiveWhitelist); + ++i) + { + if (targetPropertyTransitiveWhitelist[i] == propertyName) + { + // No error. We're not going to find anything new here. + return std::string(); + } + } + case cmGeneratorExpressionDAGChecker::DAG: + break; + } + + const char *prop = target->GetProperty(propertyName); + + if (dagCheckerParent) + { + if (dagCheckerParent->EvaluatingLinkLibraries()) + { +#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ + (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || + if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) + false) + { + reportError(context, content->GetOriginalExpression(), + "$ expression in link libraries " + "evaluation depends on target property which is transitive " + "over the link libraries, creating a recursion."); + return std::string(); + } +#undef TRANSITIVE_PROPERTY_COMPARE + + if(!prop) + { + return std::string(); + } + } + else + { +#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ + dagCheckerParent->METHOD () || + + assert( + CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( + ASSERT_TRANSITIVE_PROPERTY_METHOD) + false); +#undef ASSERT_TRANSITIVE_PROPERTY_METHOD + } + } + + std::string linkedTargetsContent; + + std::string interfacePropertyName; + bool isInterfaceProperty = false; + +#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ + if (propertyName == #prop) \ + { \ + interfacePropertyName = "INTERFACE_" #prop; \ + } \ + else if (propertyName == "INTERFACE_" #prop) \ + { \ + interfacePropertyName = "INTERFACE_" #prop; \ + isInterfaceProperty = true; \ + } \ + else + + CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) + // Note that the above macro terminates with an else + /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), + "COMPILE_DEFINITIONS_")) + { + cmPolicies::PolicyStatus polSt = + context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); + if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) + { + interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; + } + } +#undef POPULATE_INTERFACE_PROPERTY_NAME + cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty + ? context->HeadTarget : target; + + if(isInterfaceProperty) + { + if(cmTarget::LinkInterfaceLibraries const* iface = + target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) + { + linkedTargetsContent = + getLinkedTargetsContent(iface->Libraries, target, + headTarget, + context, &dagChecker, + interfacePropertyName); + } + } + else if(!interfacePropertyName.empty()) + { + if(cmTarget::LinkImplementationLibraries const* impl = + target->GetLinkImplementationLibraries(context->Config)) + { + linkedTargetsContent = + getLinkedTargetsContent(impl->Libraries, target, + target, + context, &dagChecker, + interfacePropertyName); + } + } + + if (!prop) + { + if (target->IsImported() + || target->GetType() == cmTarget::INTERFACE_LIBRARY) + { + return linkedTargetsContent; + } + if (target->IsLinkInterfaceDependentBoolProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + return target->GetLinkInterfaceDependentBoolProperty( + propertyName, + context->Config) ? "1" : "0"; + } + if (target->IsLinkInterfaceDependentStringProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentStringProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMinProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMaxProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + + return linkedTargetsContent; + } + + if (!target->IsImported() + && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) + { + if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMinProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMaxProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + } + if(!interfacePropertyName.empty()) + { + std::string result = this->EvaluateDependentExpression(prop, + context->Makefile, context, + headTarget, target, &dagChecker); + if (!linkedTargetsContent.empty()) + { + result += (result.empty() ? "" : ";") + linkedTargetsContent; + } + return result; + } + return prop; + } +} targetPropertyNode; + +//---------------------------------------------------------------------------- +static const struct TargetNameNode : public cmGeneratorExpressionNode +{ + TargetNameNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + virtual bool RequiresLiteralInput() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return parameters.front(); + } + + virtual int NumExpectedParameters() const { return 1; } + +} targetNameNode; + +//---------------------------------------------------------------------------- +static const struct TargetObjectsNode : public cmGeneratorExpressionNode +{ + TargetObjectsNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (!context->EvaluateForBuildsystem) + { + std::ostringstream e; + e << "The evaluation of the TARGET_OBJECTS generator expression " + "is only suitable for consumption by CMake. It is not suitable " + "for writing out elsewhere."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + + std::string tgtName = parameters.front(); + cmGeneratorTarget* gt = + context->Makefile->FindGeneratorTargetToUse(tgtName); + if (!gt) + { + std::ostringstream e; + e << "Objects of target \"" << tgtName + << "\" referenced but no such target exists."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + if (gt->GetType() != cmTarget::OBJECT_LIBRARY) + { + std::ostringstream e; + e << "Objects of target \"" << tgtName + << "\" referenced but is not an OBJECT library."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + + std::vector objectSources; + gt->GetObjectSources(objectSources, context->Config); + std::map mapping; + + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + mapping[*it]; + } + + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); + + std::string obj_dir = gt->ObjectDirectory; + std::string result; + const char* sep = ""; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + // Find the object file name corresponding to this source file. + std::map::const_iterator + map_it = mapping.find(*it); + // It must exist because we populated the mapping just above. + assert(!map_it->second.empty()); + result += sep; + std::string objFile = obj_dir + map_it->second; + cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); + sf->SetObjectLibrary(tgtName); + sf->SetProperty("EXTERNAL_OBJECT", "1"); + result += objFile; + sep = ";"; + } + return result; + } +} targetObjectsNode; + +//---------------------------------------------------------------------------- +static const struct CompileFeaturesNode : public cmGeneratorExpressionNode +{ + CompileFeaturesNode() {} + + virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + cmTarget const* target = context->HeadTarget; + if (!target) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + context->HadHeadSensitiveCondition = true; + + typedef std::map > LangMap; + static LangMap availableFeatures; + + LangMap testedFeatures; + + for (std::vector::const_iterator it = parameters.begin(); + it != parameters.end(); ++it) + { + std::string error; + std::string lang; + if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, + *it, lang, &error)) + { + reportError(context, content->GetOriginalExpression(), error); + return std::string(); + } + testedFeatures[lang].push_back(*it); + + if (availableFeatures.find(lang) == availableFeatures.end()) + { + const char* featuresKnown + = context->Makefile->CompileFeaturesAvailable(lang, &error); + if (!featuresKnown) + { + reportError(context, content->GetOriginalExpression(), error); + return std::string(); + } + cmSystemTools::ExpandListArgument(featuresKnown, + availableFeatures[lang]); + } + } + + bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); + + std::string result; + + for (LangMap::const_iterator lit = testedFeatures.begin(); + lit != testedFeatures.end(); ++lit) + { + std::vector const& langAvailable + = availableFeatures[lit->first]; + const char* standardDefault = context->Makefile + ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); + for (std::vector::const_iterator it = lit->second.begin(); + it != lit->second.end(); ++it) + { + if (std::find(langAvailable.begin(), langAvailable.end(), *it) + == langAvailable.end()) + { + return "0"; + } + if (standardDefault && !*standardDefault) + { + // This compiler has no notion of language standard levels. + // All features known for the language are always available. + continue; + } + if (!context->Makefile->HaveStandardAvailable(target, + lit->first, *it)) + { + if (evalLL) + { + const char* l = target->GetProperty(lit->first + "_STANDARD"); + if (!l) + { + l = standardDefault; + } + assert(l); + context->MaxLanguageStandard[target][lit->first] = l; + } + else + { + return "0"; + } + } + } + } + return "1"; + } +} compileFeaturesNode; + +//---------------------------------------------------------------------------- +static const char* targetPolicyWhitelist[] = { + 0 +#define TARGET_POLICY_STRING(POLICY) \ + , #POLICY + + CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) + +#undef TARGET_POLICY_STRING +}; + +cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, + const char *policy) +{ +#define RETURN_POLICY(POLICY) \ + if (strcmp(policy, #POLICY) == 0) \ + { \ + return tgt->GetPolicyStatus ## POLICY (); \ + } \ + + CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) + +#undef RETURN_POLICY + + assert(0 && "Unreachable code. Not a valid policy"); + return cmPolicies::WARN; +} + +cmPolicies::PolicyID policyForString(const char *policy_id) +{ +#define RETURN_POLICY_ID(POLICY_ID) \ + if (strcmp(policy_id, #POLICY_ID) == 0) \ + { \ + return cmPolicies:: POLICY_ID; \ + } \ + + CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) + +#undef RETURN_POLICY_ID + + assert(0 && "Unreachable code. Not a valid policy"); + return cmPolicies::CMP0002; +} + +//---------------------------------------------------------------------------- +static const struct TargetPolicyNode : public cmGeneratorExpressionNode +{ + TargetPolicyNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context , + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + + context->HadContextSensitiveCondition = true; + context->HadHeadSensitiveCondition = true; + + for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) + { + const char *policy = targetPolicyWhitelist[i]; + if (parameters.front() == policy) + { + cmMakefile *mf = context->HeadTarget->GetMakefile(); + switch(statusForTarget(context->HeadTarget, policy)) + { + case cmPolicies::WARN: + mf->IssueMessage(cmake::AUTHOR_WARNING, + mf->GetPolicies()-> + GetPolicyWarning(policyForString(policy))); + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::OLD: + return "0"; + case cmPolicies::NEW: + return "1"; + } + } + } + reportError(context, content->GetOriginalExpression(), + "$ may only be used with a limited number of " + "policies. Currently it may be used with the following policies:\n" + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +#define TARGET_POLICY_LIST_ITEM(POLICY) \ + " * " STRINGIFY(POLICY) "\n" + + CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) + +#undef TARGET_POLICY_LIST_ITEM + ); + return std::string(); + } + +} targetPolicyNode; + +//---------------------------------------------------------------------------- +static const struct InstallPrefixNode : public cmGeneratorExpressionNode +{ + InstallPrefixNode() {} + + virtual bool GeneratesContent() const { return true; } + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + reportError(context, content->GetOriginalExpression(), + "INSTALL_PREFIX is a marker for install(EXPORT) only. It " + "should never be evaluated."); + return std::string(); + } + +} installPrefixNode; + +//---------------------------------------------------------------------------- +class ArtifactNameTag; +class ArtifactLinkerTag; +class ArtifactSonameTag; +class ArtifactPdbTag; + +class ArtifactPathTag; +class ArtifactDirTag; +class ArtifactNameTag; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The target soname file (.so.1). + if(target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is not allowed " + "for DLL target platforms."); + return std::string(); + } + if(target->GetType() != cmTarget::SHARED_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is allowed only for " + "SHARED libraries."); + return std::string(); + } + std::string result = target->GetDirectory(context->Config); + result += "/"; + result += target->GetSOName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if(!context->Makefile->IsOn(pdbSupportVar)) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is not supported by the target linker."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The file used to link to the target (.so, .lib, .a). + if(!target->IsLinkable()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + return target->GetFullPath(context->Config, + target->HasImportLibrary()); + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + return target->GetFullPath(context->Config, false, true); + } +}; + + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenameName(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenamePath(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return result; } +}; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifact : public cmGeneratorExpressionNode +{ + TargetFilesystemArtifact() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + // Lookup the referenced target. + std::string name = *parameters.begin(); + + if (!cmGeneratorExpression::IsValidTargetName(name)) + { + ::reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + cmTarget* target = context->Makefile->FindTargetToUse(name); + if(!target) + { + ::reportError(context, content->GetOriginalExpression(), + "No target \"" + name + "\""); + return std::string(); + } + if(target->GetType() >= cmTarget::OBJECT_LIBRARY && + target->GetType() != cmTarget::UNKNOWN_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "Target \"" + name + "\" is not an executable or library."); + return std::string(); + } + if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) + || (dagChecker->EvaluatingSources() + && name == dagChecker->TopTarget()))) + { + ::reportError(context, content->GetOriginalExpression(), + "Expressions which require the linker language may not " + "be used while evaluating link libraries"); + return std::string(); + } + context->DependTargets.insert(target); + context->AllTargets.insert(target); + + std::string result = + TargetFilesystemArtifactResultCreator::Create( + target, + context, + content); + if (context->HadError) + { + return std::string(); + } + return + TargetFilesystemArtifactResultGetter::Get(result); + } +}; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactNodeGroup +{ + TargetFilesystemArtifactNodeGroup() + { + } + + TargetFilesystemArtifact File; + TargetFilesystemArtifact FileName; + TargetFilesystemArtifact FileDir; +}; + +//---------------------------------------------------------------------------- +static const +TargetFilesystemArtifactNodeGroup targetNodeGroup; + +static const +TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; + +static const +TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; + +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + +//---------------------------------------------------------------------------- +const cmGeneratorExpressionNode* +cmGeneratorExpressionNode::GetNode(const std::string &identifier) +{ + typedef std::map NodeMap; + static NodeMap nodeMap; + if (nodeMap.empty()) + { + nodeMap["0"] = &zeroNode; + nodeMap["1"] = &oneNode; + nodeMap["AND"] = &andNode; + nodeMap["OR"] = &orNode; + nodeMap["NOT"] = ¬Node; + nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; + nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; + nodeMap["VERSION_GREATER"] = &versionGreaterNode; + nodeMap["VERSION_LESS"] = &versionLessNode; + nodeMap["VERSION_EQUAL"] = &versionEqualNode; + nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; + nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; + nodeMap["PLATFORM_ID"] = &platformIdNode; + nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; + nodeMap["CONFIGURATION"] = &configurationNode; + nodeMap["CONFIG"] = &configurationTestNode; + nodeMap["TARGET_FILE"] = &targetNodeGroup.File; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; + nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; + nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; + nodeMap["STREQUAL"] = &strEqualNode; + nodeMap["EQUAL"] = &equalNode; + nodeMap["LOWER_CASE"] = &lowerCaseNode; + nodeMap["UPPER_CASE"] = &upperCaseNode; + nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; + nodeMap["BOOL"] = &boolNode; + nodeMap["ANGLE-R"] = &angle_rNode; + nodeMap["COMMA"] = &commaNode; + nodeMap["SEMICOLON"] = &semicolonNode; + nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; + nodeMap["TARGET_NAME"] = &targetNameNode; + nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; + nodeMap["TARGET_POLICY"] = &targetPolicyNode; + nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; + nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; + nodeMap["INSTALL_PREFIX"] = &installPrefixNode; + nodeMap["JOIN"] = &joinNode; + nodeMap["LINK_ONLY"] = &linkOnlyNode; + nodeMap["COMPILE_LANGUAGE"] = &languageNode; + } + NodeMap::const_iterator i = nodeMap.find(identifier); + if (i == nodeMap.end()) + { + return 0; + } + return i->second; +} + +//---------------------------------------------------------------------------- +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) +{ + context->HadError = true; + if (context->Quiet) + { + return; + } + + std::ostringstream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + context->Backtrace); +} diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h new file mode 100644 index 000000000..847a00a21 --- /dev/null +++ b/Source/cmGeneratorExpressionNode.h @@ -0,0 +1,70 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + 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. +============================================================================*/ +#ifndef cmGeneratorExpressionNode_h +#define cmGeneratorExpressionNode_h + +#include "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" +#include "cmGeneratorExpressionDAGChecker.h" +#include "cmGeneratorExpression.h" +#include "cmLocalGenerator.h" +#include "cmSourceFile.h" + +#include + +#include +#include + +#include "cmListFileCache.h" + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + enum { + DynamicParameters = 0, + OneOrMoreParameters = -1, + OneOrZeroParameters = -2 + }; + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool RequiresLiteralInput() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker + ) const = 0; + + static std::string EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker); + + static const cmGeneratorExpressionNode* GetNode( + const std::string &identifier); +}; + +//---------------------------------------------------------------------------- +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result); + +#endif diff --git a/bootstrap b/bootstrap index 320552aeb..6bc87ed53 100755 --- a/bootstrap +++ b/bootstrap @@ -270,6 +270,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ + cmGeneratorExpressionNode \ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ From 082b6a9d78c6198dc7a9891615930c40a5c3b967 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 4 Mar 2015 23:53:22 +0100 Subject: [PATCH 0289/1029] Genex: Split cmGeneratorExpressionContext into own file. --- Source/CMakeLists.txt | 2 ++ Source/cmGeneratorExpressionContext.cxx | 18 ++++++++++ Source/cmGeneratorExpressionContext.h | 48 +++++++++++++++++++++++++ Source/cmGeneratorExpressionEvaluator.h | 29 +-------------- bootstrap | 1 + 5 files changed, 70 insertions(+), 28 deletions(-) create mode 100644 Source/cmGeneratorExpressionContext.cxx create mode 100644 Source/cmGeneratorExpressionContext.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d0d48494..482bd39d6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -238,6 +238,8 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionContext.cxx + cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h cmGeneratorExpressionEvaluator.cxx diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx new file mode 100644 index 000000000..4ed8ff2de --- /dev/null +++ b/Source/cmGeneratorExpressionContext.cxx @@ -0,0 +1,18 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionContext.h" + +cmGeneratorExpressionContext::cmGeneratorExpressionContext(); + : Backtrace(NULL) +{ +} diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h new file mode 100644 index 000000000..ce6f376aa --- /dev/null +++ b/Source/cmGeneratorExpressionContext.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + 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. +============================================================================*/ +#ifndef cmGeneratorExpressionContext_h +#define cmGeneratorExpressionContext_h + +#include "cmListFileCache.h" + +#include +#include +#include + +class cmTarget; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmGeneratorExpressionContext(); + + cmListFileBacktrace Backtrace; + std::set DependTargets; + std::set AllTargets; + std::set SeenTargetProperties; + std::set SourceSensitiveTargets; + std::map > + MaxLanguageStandard; + cmMakefile *Makefile; + std::string Config; + std::string Language; + cmTarget const* HeadTarget; // The target whose property is being evaluated. + cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears + // directly or indirectly in the property. + bool Quiet; + bool HadError; + bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; + bool EvaluateForBuildsystem; +}; + +#endif diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index b1fec0b37..7c1bd8c6f 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -16,37 +16,10 @@ #include #include "cmListFileCache.h" +#include "cmGeneratorExpressionContext.h" class cmTarget; -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionContext -{ - cmGeneratorExpressionContext() - : Backtrace(NULL) - { - } - - cmListFileBacktrace Backtrace; - std::set DependTargets; - std::set AllTargets; - std::set SeenTargetProperties; - std::set SourceSensitiveTargets; - std::map > - MaxLanguageStandard; - cmMakefile *Makefile; - std::string Config; - std::string Language; - cmTarget const* HeadTarget; // The target whose property is being evaluated. - cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears - // directly or indirectly in the property. - bool Quiet; - bool HadError; - bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; - bool EvaluateForBuildsystem; -}; - struct cmGeneratorExpressionDAGChecker; struct cmGeneratorExpressionNode; diff --git a/bootstrap b/bootstrap index 6bc87ed53..423980292 100755 --- a/bootstrap +++ b/bootstrap @@ -267,6 +267,7 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionContext \ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ From ec428fafcf9f50c54b163dd16f68063cc387f779 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 22 Feb 2015 21:41:06 +0100 Subject: [PATCH 0290/1029] Genex: Extend cmGeneratorExpressionContext constructor. Initialize the members in the appropriate place. --- Source/cmGeneratorExpression.cxx | 17 ++++------------- Source/cmGeneratorExpressionContext.cxx | 20 ++++++++++++++++++-- Source/cmGeneratorExpressionContext.h | 8 +++++++- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a4990dc09..2d795cbb6 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,19 +72,10 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - cmGeneratorExpressionContext context; - context.Makefile = mf; - context.Config = config; - context.Quiet = quiet; - context.HadError = false; - context.HadContextSensitiveCondition = false; - context.HadHeadSensitiveCondition = false; - context.SourceSensitiveTargets.clear(); - context.HeadTarget = headTarget; - context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; - context.CurrentTarget = currentTarget ? currentTarget : headTarget; - context.Backtrace = this->Backtrace; - context.Language = language; + cmGeneratorExpressionContext context(mf, config, quiet, headTarget, + currentTarget ? currentTarget : headTarget, + this->EvaluateForBuildsystem, + this->Backtrace, language); return this->EvaluateWithContext(context, dagChecker); } diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index 4ed8ff2de..947015e9b 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -12,7 +12,23 @@ #include "cmGeneratorExpressionContext.h" -cmGeneratorExpressionContext::cmGeneratorExpressionContext(); - : Backtrace(NULL) +cmGeneratorExpressionContext::cmGeneratorExpressionContext( + cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language) + : Backtrace(backtrace), + Makefile(mf), + Config(config), + Language(language), + HeadTarget(headTarget), + CurrentTarget(currentTarget), + Quiet(quiet), + HadError(false), + HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), + EvaluateForBuildsystem(evaluateForBuildsystem) { } diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index ce6f376aa..ed8350971 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -23,7 +23,13 @@ class cmTarget; //---------------------------------------------------------------------------- struct cmGeneratorExpressionContext { - cmGeneratorExpressionContext(); + cmGeneratorExpressionContext(cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language); + cmListFileBacktrace Backtrace; std::set DependTargets; From 7916d7bac602e71be359e12600b19d823327bdf8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 8 Mar 2015 13:51:20 +0100 Subject: [PATCH 0291/1029] Include cmAlgorithms where it is used. --- Source/CTest/cmCTestBuildHandler.cxx | 1 + Source/CursesDialog/cmCursesMainForm.cxx | 1 + Source/cmCTest.cxx | 1 + Source/cmComputeLinkDepends.cxx | 1 + Source/cmComputeLinkInformation.cxx | 1 + Source/cmCoreTryCompile.cxx | 1 + Source/cmDependsC.cxx | 1 + Source/cmDocumentation.cxx | 1 + Source/cmExportFileGenerator.cxx | 1 + Source/cmExportInstallFileGenerator.cxx | 1 + Source/cmFileCommand.cxx | 1 + Source/cmFindBase.cxx | 2 ++ Source/cmFindPackageCommand.cxx | 1 + Source/cmGeneratorExpression.cxx | 1 + Source/cmGeneratorExpressionDAGChecker.cxx | 1 + Source/cmGeneratorExpressionEvaluator.cxx | 1 + Source/cmGeneratorTarget.cxx | 1 + Source/cmGetCMakePropertyCommand.cxx | 1 + Source/cmGlobalGenerator.cxx | 1 + Source/cmGlobalUnixMakefileGenerator3.cxx | 1 + Source/cmGlobalVisualStudio10Generator.cxx | 1 + Source/cmGlobalVisualStudio11Generator.cxx | 1 + Source/cmGlobalVisualStudio12Generator.cxx | 1 + Source/cmGlobalVisualStudio14Generator.cxx | 1 + Source/cmListCommand.cxx | 1 + Source/cmLocalGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 1 + Source/cmMacroCommand.cxx | 1 + Source/cmMakeDepend.cxx | 1 + Source/cmMakefile.cxx | 1 + Source/cmNinjaNormalTargetGenerator.cxx | 1 + Source/cmOrderDirectories.cxx | 1 + Source/cmOutputRequiredFilesCommand.cxx | 1 + Source/cmPolicies.cxx | 1 + Source/cmQtAutoGenerators.cxx | 1 + Source/cmSearchPath.cxx | 1 + Source/cmSourceFileLocation.cxx | 1 + Source/cmTarget.cxx | 1 + Source/cmTargetCompileDefinitionsCommand.cxx | 2 ++ Source/cmTargetCompileFeaturesCommand.cxx | 2 ++ Source/cmTargetCompileOptionsCommand.cxx | 2 ++ Source/cmake.cxx | 1 + Source/cmakemain.cxx | 1 + Source/cmcmd.cxx | 1 + 44 files changed, 48 insertions(+) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index fe27e2b3c..29e07ef4c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -20,6 +20,7 @@ #include "cmGeneratedFileStream.h" #include "cmXMLSafe.h" #include "cmFileTimeComparison.h" +#include "cmAlgorithms.h" //#include #include diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index dcd0b6cd4..d60062e5b 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -22,6 +22,7 @@ #include "cmCursesDummyWidget.h" #include "cmCursesCacheEntryComposite.h" #include "cmCursesLongMessageForm.h" +#include "cmAlgorithms.h" inline int ctrl(int z) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d396032..1d0df6920 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -26,6 +26,7 @@ #include "cmVersionMacros.h" #include "cmCTestCommand.h" #include "cmCTestStartCommand.h" +#include "cmAlgorithms.h" #include "cmCTestBuildHandler.h" #include "cmCTestBuildAndTestHandler.h" diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index be28b2f54..6005d5fe5 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 479da75f7..b0e0f36c3 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -19,6 +19,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e9390e430..59efa52d9 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -14,6 +14,7 @@ #include "cmCacheManager.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" #include diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 6dde3494e..63d8fa6b3 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include #include // isspace diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index f4e3a75f7..8c17536a8 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmVersion.h" #include "cmRST.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 71728be26..b4fad9888 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -22,6 +22,7 @@ #include "cmTargetExport.h" #include "cmVersion.h" #include "cmComputeLinkInformation.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ba1dde29f..6d639c9ac 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -19,6 +19,7 @@ #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmTargetExport.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmExportInstallFileGenerator diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0290c923c..ec22ea0a5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -16,6 +16,7 @@ #include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" +#include "cmAlgorithms.h" #include "cmTimestamp.h" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index ffc641cf9..f63df616d 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmFindBase.h" +#include "cmAlgorithms.h" + cmFindBase::cmFindBase() { this->AlreadyInCache = false; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 26bd4b98e..87f903718 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -14,6 +14,7 @@ #include #include #include +#include "cmAlgorithms.h" #ifdef CMAKE_BUILD_WITH_CMAKE #include "cmVariableWatch.h" diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 0a270162a..b72c269f0 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -14,6 +14,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "assert.h" +#include "cmAlgorithms.h" #include "cmGeneratorExpressionEvaluator.h" #include "cmGeneratorExpressionLexer.h" diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c8b9949c0..ff8790c93 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -13,6 +13,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 756d93206..cd0e9829a 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -18,6 +18,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b7b2effc4..e0af47a2f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -20,6 +20,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index fd1859692..85aa31fbf 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmake.h" +#include "cmAlgorithms.h" // cmGetCMakePropertyCommand bool cmGetCMakePropertyCommand diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36395aa67..0b247c2c1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -32,6 +32,7 @@ #include "cmGeneratorExpressionEvaluationFile.h" #include "cmExportBuildFileGenerator.h" #include "cmCPackPropertiesGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 570156434..7648813a3 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -18,6 +18,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmGeneratorTarget.h" +#include "cmAlgorithms.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7df207332..18d40e1da 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -17,6 +17,7 @@ #include "cmVisualStudioSlnData.h" #include "cmVisualStudioSlnParser.h" #include "cmake.h" +#include "cmAlgorithms.h" static const char vs10generatorName[] = "Visual Studio 10 2010"; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 301320036..ed828b64c 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs11generatorName[] = "Visual Studio 11 2012"; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2bc9379ac..c2e6f47a8 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio12Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs12generatorName[] = "Visual Studio 12 2013"; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index fe702c06c..b551c6518 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio14Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs14generatorName[] = "Visual Studio 14 2015"; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 17617aae8..d18269d33 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -12,6 +12,7 @@ #include "cmListCommand.h" #include #include +#include "cmAlgorithms.h" #include // required for atoi #include diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 37cc2c662..e1998e420 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -25,6 +25,7 @@ #include "cmCustomCommandGenerator.h" #include "cmVersion.h" #include "cmake.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # define CM_LG_ENCODE_OBJECT_NAMES diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 555007059..8938e67d8 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -20,6 +20,7 @@ #include "cmVersion.h" #include "cmFileTimeComparison.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 12c8576fd..b7cbae6e3 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -12,6 +12,7 @@ #include "cmMacroCommand.h" #include "cmake.h" +#include "cmAlgorithms.h" // define the class for macro commands class cmMacroHelperCommand : public cmCommand diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 31bbb738b..a6d4e58aa 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -12,6 +12,7 @@ #include "cmMakeDepend.h" #include "cmSystemTools.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1e1..0fd06d798 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -30,6 +30,7 @@ #include "cmInstallGenerator.h" #include "cmTestGenerator.h" #include "cmDefinitions.h" +#include "cmAlgorithms.h" #include "cmake.h" #include // required for atoi diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index c352c1a59..155a30e44 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmOSXBundleGenerator.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 23f852606..a61243703 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 5016493bd..df531e7b5 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmOutputRequiredFilesCommand.h" #include "cmMakeDepend.h" +#include "cmAlgorithms.h" #include class cmLBDepend : public cmMakeDepend diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a4810125..c680523b0 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -4,6 +4,7 @@ #include "cmSourceFile.h" #include "cmVersion.h" #include "cmVersionMacros.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 844d70870..42c18f7da 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #if defined(_WIN32) && !defined(__CYGWIN__) # include "cmLocalVisualStudioGenerator.h" diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 1e777ab7a..045c82e5f 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -12,6 +12,7 @@ #include "cmSearchPath.h" #include "cmFindCommon.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmSearchPath::cmSearchPath(cmFindCommon* findCmd) diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index b81951dac..9d67c1e64 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include "assert.h" diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7a6ad8b4f..b70f60d6a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -19,6 +19,7 @@ #include "cmListFileCache.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index dc19720cb..394a16627 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileDefinitionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileDefinitionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index 6ebc31e1e..823afa1bd 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileFeaturesCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileFeaturesCommand::InitialPass( std::vector const& args, cmExecutionStatus &) diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 8c6fc0622..a85153dd5 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileOptionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileOptionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 80e90a8cb..11196e422 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmTest.h" #include "cmDocumentationFormatter.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmGraphVizWriter.h" diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e0bd55bb2..ac73ad079 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -24,6 +24,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" #include #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7d67bd82a..9f2ea4636 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmQtAutoGenerators.h" #include "cmVersion.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. From 4448f175c8d8ee2bfce920a5e7b7e57aa923a19d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 8 Mar 2015 13:37:44 +0100 Subject: [PATCH 0292/1029] cmInstalledFile: Move Property implementation out of line. Don't require re-building the world when changing cmAlgorithms.h. --- Source/cmInstalledFile.cxx | 11 +++++++++++ Source/cmInstalledFile.h | 12 ++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 4b53752b4..8c52b488c 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -12,6 +12,7 @@ #include "cmInstalledFile.h" #include "cmSystemTools.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmInstalledFile::cmInstalledFile(): @@ -29,6 +30,16 @@ cmInstalledFile::~cmInstalledFile() } } +cmInstalledFile::Property::Property() +{ + +} + +cmInstalledFile::Property::~Property() +{ + cmDeleteAll(this->ValueExpressions); +} + //---------------------------------------------------------------------------- void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index cdb0866b4..3af90a7db 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -13,7 +13,6 @@ #define cmInstalledFile_h #include "cmGeneratorExpression.h" -#include "cmAlgorithms.h" /** \class cmInstalledFile * \brief Represents a file intended for installation. @@ -32,15 +31,8 @@ public: struct Property { - Property() - { - - } - - ~Property() - { - cmDeleteAll(this->ValueExpressions); - } + Property(); + ~Property(); ExpressionVectorType ValueExpressions; }; From 95dd238f5cde3aef28f09a2367ac7467d064ea10 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 8 Mar 2015 14:04:54 +0100 Subject: [PATCH 0293/1029] cmRemoveDuplicates: Fix iterator -> const_iterator. --- Source/cmAlgorithms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9d7e7889..f032de7ac 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -269,7 +269,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) unique.reserve(r.size()); std::vector indices; size_t count = 0; - const typename Range::iterator end = r.end(); + const typename Range::const_iterator end = r.end(); for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { From 7cbafa8c65751d2eda7a17753c384da1fc91f695 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 1 Mar 2015 21:53:04 +0100 Subject: [PATCH 0294/1029] cmRemoveDuplicates: Store unique iterators instead of values. There is no need to copy all of the values in the container in order to determine uniqueness. Iterators can be stored instead and can be used with standard algorithms with custom comparison methods. This also means that we use less space in case the value_type size is greater than sizeof(iterator). That is common for std::string which may require up to 32 bytes (libstdc++ 5.0 and MSVC at least). With libstdc++ 4.9 and older, std::string is 8 bytes, so we likely don't gain anything here. Inspired-by: Daniel Pfeifer --- Source/cmAlgorithms.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f032de7ac..1b7029beb 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,6 +176,12 @@ private: Range const& m_range; }; +struct IterLess +{ + template + bool operator()(It const& a, It const& b) const { return *a < *b; } +}; + } template @@ -264,8 +270,8 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef std::vector UniqueVector; - UniqueVector unique; + typedef typename Range::const_iterator T; + std::vector unique; unique.reserve(r.size()); std::vector indices; size_t count = 0; @@ -273,11 +279,12 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { - const typename UniqueVector::iterator low = - std::lower_bound(unique.begin(), unique.end(), *it); - if (low == unique.end() || *low != *it) + const typename std::vector::iterator low = + std::lower_bound(unique.begin(), unique.end(), it, + ContainerAlgorithms::IterLess()); + if (low == unique.end() || **low != *it) { - unique.insert(low, *it); + unique.insert(low, it); } else { From eec7091d76fc3db6535eec3f78fd2585b9c0c38a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 1 Mar 2015 21:57:16 +0100 Subject: [PATCH 0295/1029] cmRemoveDuplicates: Type-parameterize all uniq-operations --- Source/cmAlgorithms.h | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 1b7029beb..5504fee71 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,12 +176,6 @@ private: Range const& m_range; }; -struct IterLess -{ - template - bool operator()(It const& a, It const& b) const { return *a < *b; } -}; - } template @@ -267,10 +261,27 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) ContainerAlgorithms::BinarySearcher(m)); } +namespace ContainerAlgorithms { + +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef typename Range::const_iterator value_type; + + static bool lessThan(value_type a, value_type b) { return *a < *b; } + static value_type uniqueValue(const_iterator a) { return a; } + template + static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } +}; + +} + template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef typename Range::const_iterator T; + typedef typename ContainerAlgorithms::RemoveDuplicatesAPI API; + typedef typename API::value_type T; std::vector unique; unique.reserve(r.size()); std::vector indices; @@ -280,11 +291,11 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) it != end; ++it, ++count) { const typename std::vector::iterator low = - std::lower_bound(unique.begin(), unique.end(), it, - ContainerAlgorithms::IterLess()); - if (low == unique.end() || **low != *it) + std::lower_bound(unique.begin(), unique.end(), + API::uniqueValue(it), API::lessThan); + if (low == unique.end() || API::valueCompare(low, it)) { - unique.insert(low, it); + unique.insert(low, API::uniqueValue(it)); } else { From 8701a3f468a4fb684442a8a9c5d4c8d15c72eb7b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 8 Mar 2015 09:43:11 +0100 Subject: [PATCH 0296/1029] cmRemoveDuplicates: Partially specialize the API for pointer types. If de-duplicating a container of pointers, there is no need to store iterators to them, as that is just more 'pointer chasing'. Store the pointers themselves and use API which compares the pointers in the specialization. --- Source/cmAlgorithms.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 5504fee71..0cf770140 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -263,7 +263,7 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) namespace ContainerAlgorithms { -template +template struct RemoveDuplicatesAPI { typedef typename Range::const_iterator const_iterator; @@ -275,6 +275,18 @@ struct RemoveDuplicatesAPI static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } }; +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef T* value_type; + + static bool lessThan(value_type a, value_type b) { return a < b; } + static value_type uniqueValue(const_iterator a) { return *a; } + template + static bool valueCompare(It it, const_iterator it2) { return *it != *it2; } +}; + } template From 80e8e7e9561afbc0e621fedab99b96177061ed93 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 11 Mar 2015 00:01:04 -0400 Subject: [PATCH 0297/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8fcdac997..32e4efcfb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150310) +set(CMake_VERSION_PATCH 20150311) #set(CMake_VERSION_RC 1) From 9a427f86199913d6674d09a66d97d761c38c77c7 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 10 Mar 2015 14:16:53 -0400 Subject: [PATCH 0298/1029] KWSys 2015-03-10 (4a698414) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 4a698414 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 4890f30c..4a698414 Brad King (1): 4a698414 hashtable: Give prime number table functions internal linkage Change-Id: I9f06cdf8c8b5fbe7e1f07afbcc77457f5ee6445f --- hashtable.hxx.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hashtable.hxx.in b/hashtable.hxx.in index b93e9be6b..7e7dc4259 100644 --- a/hashtable.hxx.in +++ b/hashtable.hxx.in @@ -408,7 +408,7 @@ enum { _stl_num_primes = 31 }; // create a function with a static local to that function that returns // the static -inline const unsigned long* get_stl_prime_list() { +static inline const unsigned long* get_stl_prime_list() { static const unsigned long _stl_prime_list[_stl_num_primes] = { @@ -423,7 +423,7 @@ static const unsigned long _stl_prime_list[_stl_num_primes] = return &_stl_prime_list[0]; } -inline size_t _stl_next_prime(size_t __n) +static inline size_t _stl_next_prime(size_t __n) { const unsigned long* __first = get_stl_prime_list(); const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes; From 36d4cdad0ed4fbd232142a0247209c68b9c9eee3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 12 Mar 2015 00:01:03 -0400 Subject: [PATCH 0299/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 32e4efcfb..ca664785e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150311) +set(CMake_VERSION_PATCH 20150312) #set(CMake_VERSION_RC 1) From 1bda8f1fdbfdeef82766e5db542b1946d5e2167d Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 12 Mar 2015 20:44:27 +0100 Subject: [PATCH 0300/1029] CPackWIX: Customize CMake installer theme. --- CMakeCPackOptions.cmake.in | 8 ++++++++ Utilities/Release/cpack_wix_ui_banner.jpg | Bin 0 -> 2607 bytes Utilities/Release/cpack_wix_ui_dialog.jpg | Bin 0 -> 13369 bytes 3 files changed, 8 insertions(+) create mode 100644 Utilities/Release/cpack_wix_ui_banner.jpg create mode 100644 Utilities/Release/cpack_wix_ui_dialog.jpg diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index cc8f5e986..5600b3561 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -109,4 +109,12 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") ) set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") + + set(CPACK_WIX_UI_BANNER + "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_banner.jpg" + ) + + set(CPACK_WIX_UI_DIALOG + "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_dialog.jpg" + ) endif() diff --git a/Utilities/Release/cpack_wix_ui_banner.jpg b/Utilities/Release/cpack_wix_ui_banner.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8d950a6ba169816d4399cddd1c750f2c96910a9f GIT binary patch literal 2607 zcmb7GdpuO#8s2;M+%hgRV`ws@LCB?yD23c_qnI)Iq*5czNh+G6l2nqCTw;d$NE!E3 z?upMOlu~XfI^$OP21N>^6kVK6C#UoK%^&Byd;PK2Uhi7#ectC?&)&1b+1CJ`Ztr9d zfFKAs!VfUp1K0o%0x{QML&6P(MWK*LloSSo#!5>`OXH+)I2lMT}_W?)8M)i>>_ip-+bIQ&S6M8@CRVBSqT1ktUUKOAbucGVYuy(0h=D7m{AEtg} zGCA8V^CpCzd$>YskjTJ?mTyGPP3f5h;4t+G00@C-2!r~Sqq!&n6q-P!Sy37B@@h6r zHn*ST9VV!oj~A{D3-D7_kk$xA>N&wpl&3zz*>VJ;)V$->q)`08Fv z(`t&r-5Q^8a82IS9e6A}rv+E@dICc)dG6PBLfxr0*gJCAO|#Mn<>=VDmh!`VuFz>P za0C*8#$tW}hsgqvC<2kHMzdltreGHr##J`Z^I0Byqr+Q5sU0O3iLsss1M+qODqZlSd&rzAYpFSx}no9A3KWk#cA~f}y*A z!_1ghVTIlGqkkIR&8rFjHvWh*Fx7dI$2VZ-x@+D+2HLo)MjI)s2x80)htnyWyt^Vg zUCeHxzSqmIHbcCu)}y$^e$UpF?c{-3$+XqBDo;jcj`?gnq?gvj-Rci6ac^y=^mbKj zD7q~|*|$uTlC59(iH(%U$o0j5Zg!-5=lRqXiL5rI@}U!*JF|K++&si`NWUl3Bd_E5 zlbv;nOPHTK>!euUdQ!@h*QEsVnB2~pxeL1-4_`%CtYP*0cUoZ8q*~D!-b`*-QM>@p zZtwqfV=bsJ_e5y$z1U{C0nO8<&cd&=z+N_k+Pl6Ws0pX4r5TkMC-?C&Dp3GwW0 z|MVg-F)dPDO!s{hS@7&*(^vj_RiCMJ!TNue3LY?T2{~XNUA^yat;Jle%|k(;VKM!$ zT4TaU!s6T6g1VxgwKgX>`00DoJ;dsZM+faLaqImVP>M%AklN`yl(Wk}sO_4`!0naU zI~poG1XgP@XZF#QeO(fvYGq($*}DAOZ#_M|ELc1b)6JL^H(mQTJB*bPwqyL&r`P&I zD=vA<;9DO?*e%rO2*}2D9i9a{}_M;EFdf-fE5fSOu+r68!(Em>Zh;t8@sY)J7m6# z3^{4nmI{2@hwHH>;D8Jc^E$La+;HK{m_fsqTF+SBep=*im#fkvt>xL<_!k6$ic=?a zr#>iJZd_T?y*F0b_L!yZmVyf=$y6Kd<&?cg=vN3-^i4tm(p z46HU&A)WhYzc^|OIip@L_^ADepXf z$ecA!tJ`(n#lod+4BD-hvy8*iEaS!9P@oY;gWYBJ;xWR;V2nKr&@oICJg-mI8r~N~ rMXzZxGr!;PJ$(R=TzyzMJ*d~_$CZ0Ea*YC&I6a-HDu*%nYuoiNNb$RH literal 0 HcmV?d00001 diff --git a/Utilities/Release/cpack_wix_ui_dialog.jpg b/Utilities/Release/cpack_wix_ui_dialog.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bb6fa5ba78b05731e2fe9cd663f66358280c3b89 GIT binary patch literal 13369 zcmb7~b9kN2*6{a^ZQE*W8;z63YMjQljmEYc+qN1sjcqn*oQ4hF-RHdLe5ZN;`ex5{ z?S0Q)>o>S(&8)%e((4ugMMhFu5O0q;Q{!0ReN3;+%W_9ub@1SmqnKte)5K*B*o zL%|@xAt1oR!NVgWp`jomp(4S`8<6vRnpkZKQ{DA<$K{^nSu#k|j z7>MwQ82{hlwI6^A1LOvtf&)J1BV@YZoI&6e!8A{qY!;4eF+7U6%Z)ELrU&46bDk}0&cf3_K zk}Pe;vQfjFOOMr8fcOZ>-wb5#_MDFn%xTzUhAjM!kFS8H6C+QySwY%c#)hAliO1bG zxRGkh5j73CDhPGQjXB@dGLH`JuJit;KxY$5u>iu0#i{tJb=EeuS{$jXyg&UUV9GwZ zBo=vk1vnY25Ovg*cB6&jE|-rH?nK@Vh`Gi84FT{U9P>mvfo(-pD$e@60`!sR^uh?Q zh)W!F@AP|r<+9bydoN;DMXIi%ZQ!m{f6Y~yUtT{I==A>^13vk&FfF*Z4c*qbWw|SU z*+y^Jwtr--J0fJ%jq`N&SYPxWieIABDc`JuVLMx~?dbFjsd}RKZwN9EZ;VkXm1%3v z@0rInyXvmb2k&y(&lv1`Bs*Pf6A!$R#d@`(LIpTS2)n*We6YB|+<#)da4dXc;#bSL1osz4U-EGyLkHs9=l2m&N^FQpYjpa&`Zu`$MkCwQu^= z)60;C_~Fk6Z}0V&nKvllA+^f*0(Grk$HH%$>YHmO@*l4NgohXbyxYp=#hy8p;*%50 zmyi^$kBn*RM^E_8_qP0tVr?p}4<5hQO5YTVe;3qerulQFe%>*qU;E7Nz5=*LqHOlF zE3ccf({A;`+RioRA6qDUZipm(tincp&a*(>abs&_p2OA6P0^0z4Ufptg}=vmz^}{u zF6FS>u5Xp$FuSs{$u#X&C)(!zR>y4IFuM)EYm=$#20t^~tm{??Eu`_eMA6Fe#?|%> z3w+YHFzuvs-Gl$TkaW@nl_8H9{pn$HWkZaXq+>%!e1vpvQ?FM}H_}~h-3niaa?RU5 z1UwW{o)9OAhYg@fn*h?}2x-{T<{L#;4Q@oN+6j4`H)+4g5jrbdiUl{okt&=jk7 zgH6LR#4u7~mx|iadsFOW$?X3q=qWNn>=-gb?3lyFjWBZQo2%m_edIxKTn9De)T27j z8wKDYlkx-@U8WOQ0Y+RB{kAP3K3Li$B^Qzv!d=I=Uwl!Z>Ef?I>8j!#o*nyY|gj~iNF0w9%MjguqKd82~N;~8Uw4v;}jK$8nE7;-b5^)a+%9Vwn(rET%?ett1{BM zTWNnQ&%b}%rbLlJmd`<^jHCTq{bIs+-lfwiLGZG$twpkL3l&I0;d6e+mhR%Z$vtEP1aZbWdul&P_1`%f`3T z{3k!#@Dk+=$XPyw!0e_HmbKDk3HSu0$LM74KkDlYylsELbxYmuRF)j;=fSxon$I%d zTn#MGl%f=Jv{USN&;EDS!S)vt+~zszqTF0ywu8*CJ8#%?y=X{Pi;8^bu5ufSY*qk=ovrMh?$=4FUiJiVAcOE5r z54T)MqL2CLBkkIfeP-EY1k8J3x0B`d30K!bzhv|k`rXHs@NX)r?nVTu5mqVVGX4CF z8L0>nWnd**&n$U&`7A4$A=t6OXAHBNss0S(Knfb1toF_T(xi5C-Y5A>FJ<+h%3VvOAuykxJIW<~gt@>f8KmZ~SaOj(M1eBknM>)mXjr8cve5)9WPZ+}v8J8BmPvh4BlM$i&)EbIkgC(8Q`v!Z$UGbtjP4scTI z#u6v9YrjCZh6klk{iDuqlKU2dOb%1)+PVNY2dA;r4eFA(aT9O1haUKMrXlFD!_sZh z(@OdOZOU0IRSUQi#mMw(s9L#g}FRt6| z1hYgZmUf4cn6eP6Qn35oINj)Q#=AIE2fQtobYCDUS78dr0zj{>L~bxOYErq6*P4fa zi7Xa|enZKONmOK7?lQVt>78jLy!h?XrKPUm-iYkjGY8wS{pyp>yKRZvnlJ}Tl!)0YQTj00or=5={vTlSBlalReb zsIp2OxdSvSyHQ~N_CEs@Xz3;dydP>DwpE{`~o)VeD2BwWK!WJDT0UH2lU$3gJfYP?S;cM5xtTR;4M?Mv3UM~ROxIP(-) zx)_aP&NsZOV9F*v42?Pb)I%b~R4#-4#O8hHht%NP_z97W6^?yx=luK`u=R3;7#Dn;dL?cNZ z8K35Cev^9%M`J2S%{}K1AOT}O(YnRrFfUCVNG&Qvcp*^_9#nY+kp1@Cq%n+S9URRr z_qY3Abl6zwm_~@5eUOu}mdia%8y!Fwr2IUx0%5hl3IhZ1{}W+IC(;f`ri_tR`K6QL zN`Dny_SAHNp6FTbK7{`G_PlZXB$o94rZr)Uxm{93L~iX%PR3rCqe3`xQqLI|oRGZ_ zxqaas^b8l;pPvqecTik(LiPsCCSJSv`9x2)Upg*3(9VZXWqa_;1fOh^eqXk$oDTrq z!u({mgauQPWyM;|+y%(;a35v{C~o}Iv_&AAs|iFPo2zv$vA|Z^n3y}qE2%wFuBmFX z#@Wv+sX_h13KG<#iz*?Du`*oe2f|5G=Er?W0#`LC53tki{#zJrmVRad-XdjIRuf*1 zf&H{9c(yrL-(Tkv0&OMR9rkG!exg>#@@T`fbJQJCk2c|2;n5FdaxAES904E{Bxu9t zKPCr&0GXT;BpNyv2`LnY$OjcxF+(y6=4s`C_ zmB3);EsxrKiFx;mv^m(?PU{118wbo}4O?ng7w2UaEPir{c{Mk@AO?@rppWS+miO^| z4Q_>245c(;NMV_9D3$YSUW%YRIZfIua>(kdV=>4ki`4#6g!`tJ(UC0>>OH<)BbO5q zwwfY^I#>0RUkPh$vC21;OfzuvPs^Qi&!= zF)Jhr8s&8^^RM!XFa8I|eyC$I59CS7S5mYUdoijSqXgwO2|QXK@ApHzc2m^OV{|mS zc^p8G*XJ?%f`7h(Pu%cMQpwbk>$z0T&uT55Kz&P(x%2oClSB0#Z+o4JTHpNQ=kki- z+V=A5UCob{|u1bQrgX%*a4kuohf_2xRm_qn}i#jp)U3JMBa%Z0} z=H{@WRyA`LdwTW}vjSL1I0V zF6h}gNw9l*^g(B+$d8oUt$#l(3U9~@is<}(W?EgjOFO7)bm2CQWh3g2O2He2NL4rc zGJ5iKqE1R+A>clDlg*PI`661qQ&vo~h*V%7Sd**)R-s>DNFoH|B9pc!1ve6l6{+m1 zJkEfQM)EOQHN0-Q=%QSzhJX=!!I;b8PE{&>cHOCg4xw&nR#KYI+a%{ZH zEjRK<&pB>Teg$+CmM2D@>U^Hm+GK@3ekmuq!J1xl#;D+-3Q}fXMBoe#ERY8v+Am7w z3m3@e{HtlGeqt01Mo@(aRK6sg3N=!u=m3M);{6B@Xo`bsCt|aSzlva@)4o69F>0NY zW9KpqB|JhiKjvdVW(z&jxcV%86Fj!x_C5h$X{yf7FJcoG06|I?oKF_~#WrKrxV}cr zJW^s|*_vA^@5?^EgcL6CP?q6)bw_z9XT*zu4g?wDG37aqfe%>MCJ%e=**qhwGw8HO zR99JDZDdV$`cKz^O<6^RE@hWCsCGNZoyrO_&A794?@!u{S|=BA6mZJ4@fh0^sRH;O-}W`P?(M@FpN%T32r~4tpz!9gm$KLLMhQn3!^2%`P1awFzBD;|p{b;V+UtUDW@Dxs5m^Tr0)vXRt z0y+pSp(x#4k$&K`RTf!|h|_Aw}#Kzk|}ToMrn^MJgKznnY{uoww*!*{ib4j2l*## zPNAV$XwK0Nz)Mg8Zb`P4-APz;J6pr8-tw@48I%<(FwBB7xOCwwE`R+(MtgKkSoBbApWLVFc7{(j+ zNZL*Xs-(1a9@sNb%TD{dO_t?5&J5PpfHmuNA-tv|RnjcJ+K!=7w_OToj z;Ng#LM$&HZD!D5U_k`n-V@h3VZ?>&NH8*!u=f47w^v^xXijTq?FoR^J(r)m-8l*G- zXx4&cBBWWN|876=py*KkDUIxN9&1-I8M(%jBy!L%;MT}hSH?bq#^4Z+O8F&XnlIqx zw;XseoV0ykpy6-jn;wj_6q)8W4OKDBFrPe;7dCQjWcu?@HdQk%D7dcf;V~6N&TWZN zSVqyhex=S|xPM#R=i{%)kMf~)>$P}ct}%N{Q*?uWnDYtNO8eYUC&Q=nqLBmifmc(I zZN6OpRn~2a==G=>UGz}0HW=ngimJqB<#tar+pdMFHrCm%8>(adaK6O$1H<`hAAVEl ziIa(7-K)2C`NhPLBQDogFNefN4!YBxE&5%~r&gWwSvpt+6=cgT81WEy_O5vmFC2+> zupE`JE1U7g69uh<90gt7b@*n?n+>lCiLbwgy92ywu?fgaxMvR=2274DG$ZEW>CX^&KTqKr@aD> zdF~OX$ouD>t3$6Mcg99yQkCSOSaxlkbS|r}NEZ9>?JkxaHu%WW)#>#$`ME!69oXd# z$Qf}%APh0);6@apj1#ZC0!V74WGA~M8~ZkUE3mQ7e zpr`9G_S9~!b;F}hg;}`oUZWH zku`BT$U01l8tziMFE=BirKVO_c(eBt(cNT%1s|mDHj6decQ!42ozC=4J(FBbQ@>A# z<(GA;7xi83U>G{g-ab<1$=ywi57M7A>$&UWP4ka*e@LBW+&oQcE@`d0yI~QlD{YLq zaWq2G-7wg1w$1+Dm+t00uB%ZdW!H}M%?ICWD7Nck`zs)g6a%6(&_j&I?nWk|(Kb zXNnL;xR`_bqL&Uk?-?9 zmIIcd6p%MM{#fT?=Q>Hjdx4f`7ky6$EPzDeqJm4zK9P+ z3d(QPSzb4fP()0}jaPe2O|a&h$6S)OHX?=*z;&aeZ@B`iV||9VgRu6jfa$xbd=&6~c{Gpc3TO?MuqFScRoXjS8lU4QW*d5BHH~Q~GV!)qe6iRzTx!jekA1+0L^nXXB@T4Am-bs1b|4yVx zkc;O5M+?7*XZ=fMiGbP0nirQB~dwQnd1!CJkc{y}?hC=`Xg z+U&C>NfB?-=`1A5m+?~G!o{PlL~H$SoZrCXLJ~+xdX7}yKq!{OYjk!LR7c;W1AU8T zDuNQx-jrOtUgl8arqbjMJh3B1T0WB2@C}55+ayr8<=Eg2L>lWIL-p^@@V9XJz;sgb z%6#!R@OagA*$FwFw{MOj86NR{v-a&N&)3*?cF0}>$%HMAx(iD!y z?LshnZ_}ZVC=+h?mj8yorvL{zb+o8|oI22n#~-KepM4IHQ-?yzLL#DMIIZjuACOYBFJJJ0Y`0 zt*tUK_!B@IKZ0A->qAU)DMea)^R~mU-6f{u3zcJJoNXOu@}x9J*QO&hrp!qMeE0)o!5^v!>kvMj-&+uL?Un`xGai9|N zP{q#r&n({sE|js-JCBF!Ou+7eX3p)f`{x2j`2`3VTsj)8RUNO67SHbMd)oEqX;=T8 zFN|UB`8TwCZDqXXcaEk8tFy3bSB*l8M=WTogR26Qm7o2j5$T8DIA8cPle*CY?p;5!JK&BEzaWwzeaj6v*G z*5lY(#b!h(WyQt!bb1BgXHB}T**iP`Ol3mo)NSR*7L@EVmQICc9+<7x1tqk$IlX7K z0(bX}Fda{2)a42)c1GK-fOJ0Hc0A|8(w&2K=bF5y`Sla@Uz>$Vo0I0`;9>NX($OLl zHYmmMp!w3XP}s%SRky8mJQXn}_aD3cvljbvo9y3q3jqGF-6|W#I|S5i=l5Mq|F7Nt z*_K2Jn2~rtjfbZ#C0pu_XE@Z}E)rB$eF3^C1UA}Uj&t^--sH%CcE~}RD!m{(01ofr zk*1z1I|l(>GK36eVivXNzNDsD5v>2t=r{U34jW4+CP~xrdWcjodka=Y2JI5cZP($l zbtl@px?|(LT$>yYbyA~PTQ-OUIyOsptc{ZfD5(mB$q!up6dux+M3h7266y#2gutF3 z%^#t{$+LA|FsWCw5WbNn=)=_z7@3zor*CO~JgNU`ZhrGYzg?iB(4KUENUor&1sejV zKra9V+UHh>30zD}$|Lzx=BI$7Wh%*3P=6cFrY^DzusIt{s4o=LrMUV{ZVX7Zeg2vD z#ST&@eHM5aDNT-X0^`m2`=nVdi*-q^r+QbGp?;Zh#T4G|7YG2VP!Bey*~SGulPg7X zGNEmn9$(M3Lx!?M*s7!`YIhu{&b3$Hql~d2SkeEK0Yejk(0I1uo>GUhJ$7Aa_LlT} znQfO!&rSr*37>gD%OkRjH8Q_$l(CClfT34i<9NMzdd^Ib9=0F2T=8JYVdKK_M5x~{ z9VS*DS19D^-3fRPP50?$rQ&n-&|MO-Oc)R88m{_f?BUh!uFWG4oD$9*QBhH)+TnIn zcUSsL!3rYQ&K^TLLro{ZmTb#@@GKeu2D?F`$ioxdNudm?{cW(0`s`h z+W654&gJcCg*!F2oY0^-kKLdxOsWg#E{5lGWgxo=ukMcv{>!%6j3L6L=(PmHMc`p{ zyF5;#NZi+{OO8PgUmlAD%Q>>C(kVRM%L+*gh!0X|q{p`0J=+jCUwC!Pr`DWNL?A#B zHE&gyCvqd&oYj_vJ!vcK=^|H3XK*5MFOi10#UmL#>1Bv3ZxZo zB0=w3J~cd#rypznxi_4oH=Hc%!vd?fbF7?Novus`^2jUTzjjH$K({^rGog~Qh!~i9$1bymK&(Y&3v)`5>Ault;7jc9S_9AyX)l0 z2zL)}q;b&gDf7~|uGeqOfH!H3vu(0QB&($BqnoGnJd%3_d|9v_)^u|TGV)@f#j%>8 zlRMyGp;fqym3kyC8O)tBiCR=<;uTL$OxaGugm#Db@LLpF`88e&rKSX~2(zfmvX`VqvEmGBffqkxmch%a0Fz6J#!6-{WsKEI&#K^@IkLMESQ}yX>SeJJ}0K z;VP0{3=1c88D?Bb1Mh;!ACeXw<&+j*PBEwN!X5Kk!VTG-d2QU@v%5vQCZU%eAFpIV z2#XGAstI#xvQi+uZ{0Zs21MIzC`Au&)bkq=w{&ML zYP$v$o{a41)d>^AG|jIywG^8{$ZEorn~NB63RkK$`$hDbJl^N=8Ajr}j5oxdM7q#9 zFS1)G024`^mC@GCo7}X%^O#1IC)UU7)2B6hhDMz64iUyJXvXx)+p3jd5bz=2oyG7(jprE@df4jGjPtgC{dO~QdyL@HykrDtYcCpbz7 z_@t7*0`O#AkFZ!V%&CaY1kiqP67E)M>}V9f^A-_K7Bng}%F)DVz3(VxFmH2DVq}Od zwfKr2u#n;v6X80kG}c~O;vv`a6}pS-J1?LdY|O|qZ*kJ`Bo31pS_~b_ywSzibeX&v zZxL;JK*=p@khi6jVG%-?a90Wp0eq)p>pba;#lR$$d}t3lOsZ*-ux&Yn2}!MyawHf{ zty|VQ1sMQ6PAeF!Bft_q8=92EmNim}(YaSAb}V@q94)#yI1h>5!1S_2$TzB6S&6%<6sNvpNZnWzo5PjW62%m|DfSR_m;F zr067I7#NIIUl_pVi7(6w{cluG(al!#OCoxt*9h{LTW4cjNUWZ-DClU*o!AvwvMLQC zRnOJdpPoKhVY7aXB98_ps{-Z?(?Yl$p^erEp>`72qLYoq-89USS1BaaH$p0987@$k zwL}k;pBeSrKkC48tqRSLGk+MLRr&1jE2Au55?Z5yIJ^=2eHBDoSa=ETFgZiZyoSi7 z*`7Xb$c%PP3Z!bFHcOb{C&N3q99azwH7zY#3zFIon^;^jM-Do0(4t$uYi&nG%*R-w zLlPTylGeW#QQ>Zk#RCF|?=UCyBp-}EwjV;2gWaUl7p|3Pq&nv6+<^ba-M2LMteL+w z%e!ah9R&4Z)@lHkfioh0k*K+9w`e)Mfomn7B+TMM;#gSW^o$akx+Ky;VyH7T5G(yIg$#jprt2KpXNm1ykx~|aiOoqBLfR=Pi`O;(KW_p)2fe( zQ7hoDaZndW&{vlJ(SXq(Fv$Nua6VbB)j_AmnPf%x<3>% zC@pLD8SS)c&otapfs+LW+frJ&eHYUzTbGG+%Ue(q3uhSN9igeO&r@~9yiA_SOeg_e z)Q413*7#)pC67pMe2$+drmloL8O~mBEWXW7#PXc5Th|#Yp_k7p0Q-j_iW>FeFvW9~ z{Ci3d^i{NWtZL&a^LJGi6Kq8l=QRH8*j$b2b6-(;ByWDukDI{us`<{?$K8+c9w>)v z-v^Iwx}S9GCY%XxPf+DCOpL8R?wSo6-AWKEEtnFj7aDrv5Aq3PvwSzvISEW9#<2n) zo?VkUZvE_lZs4KDI7c)}Sko6?n^b+lMz7mW348F)hemIyumV2b?KerDx8a7qNc~99 zg=a{YikaEHa<`F$g~SdJb&)3(-4Fd}P(ABc{zXWDTkq^Horr98lmRA-G-FCE7K4c? zc?Z4jqBbfYO8s*&dD^r(S+d6hO^0r^8D0lUh2+@XH$P(hJt%=4w)Yl2^b^5L9pq^$ z!O=K1P&9L8k+m8J7WBR_$GtUu^tvwg@D0CX94i_+Qcv%v$6YTQb$(be=6)J%4`d&t z`9{r#;m8?jPGkV7c}!+zxaNfE5z`j$tQGO@v77y-38V6eC?x+29;B=@YSEHR%-4mA z8_=puraUd6gJFe?e~?pxSXwSw`0;)&Jd{(Q$V|QEB)JrvI~A^B@JoIm)GX;aj=EmK zS9LZayGz<6aZHBd)>#BLeB|hAN{4q50j(q$431;w>5Z~!y{N;qsd&nC&0zzB?CwTN z6PlR$Oc8q{Q?R$xM9{;tgC!A)DBa`Nv^y$;j0Z7eYuXD><65JG!bp4t6He*MD>qYU zd(lc!{9Jwoc+kUD_sN*^L`9|?u7OiiBf4Wi$-s8B$fZ_>j#^3w@L;zJ-(X5RY-bVv zz@B;>?va7D;zefitgT*=_(BWIY3itq!f6W0uj$t z-*j`iF_jUwEKt(&9>R9*HinzNEc)rUI5^tiE*87Eg=kZ5iBAO28sa x;wWM~eF{IIW^UxAXx;%s+H8wdt3Ip{6897q8b1I literal 0 HcmV?d00001 From 07696442124e63f6498109480e4adabf4fd00a8c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 13 Mar 2015 00:01:03 -0400 Subject: [PATCH 0301/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ca664785e..4880660a8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150312) +set(CMake_VERSION_PATCH 20150313) #set(CMake_VERSION_RC 1) From 262656b2d64e605579f1e8cc6ee32edcb64aa1c2 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 14 Mar 2015 00:01:05 -0400 Subject: [PATCH 0302/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4880660a8..67f8d1d84 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150313) +set(CMake_VERSION_PATCH 20150314) #set(CMake_VERSION_RC 1) From 607131bf8c806b6227e56089eab9252537bd31d8 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 15 Mar 2015 00:01:03 -0400 Subject: [PATCH 0303/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 67f8d1d84..d1bca5f33 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150314) +set(CMake_VERSION_PATCH 20150315) #set(CMake_VERSION_RC 1) From 4552bc886d1bd8966f6ef2f7790835dfdb2e6d8b Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 15 Mar 2015 20:37:16 +0100 Subject: [PATCH 0304/1029] CPack/RPM relocation paths test fixup Patch fixes bug in test reported with id 15442 - older versions of rpm print out package info a bit differently so we should ignore white spaces --- Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index c7ec7094f..079b81965 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -163,31 +163,33 @@ if(CPackGen MATCHES "RPM") ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + set(whitespaces "[\\t\\n\\r ]*") + if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_applications_PACKAGE_ARCHITECTURE}") set(spec_regex "*libraries*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_libraries_PACKAGE_ARCHITECTURE}") set(spec_regex "*headers*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/include\n/usr/foo/bar/include/mylib.h$") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_headers_PACKAGE_ARCHITECTURE}") set(spec_regex "*applications*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_Unspecified_PACKAGE_ARCHITECTURE}") set(spec_regex "*Unspecified*") set(check_content_list "^/usr/foo/bar From 140a53a810ea7449c26e6e572918df3bb20e86d1 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 15 Mar 2015 21:08:19 +0100 Subject: [PATCH 0305/1029] CPack/RPM architecture test fixup Fixed architecture test that was missing architecture in regular expressions - bug was detected on older rpm versions where the check failed. Extended architecture test that takes into account older versions of rpm. This patch is related to 15442. --- .../RunCPackVerifyResult.cmake | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 079b81965..9261d1162 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -158,6 +158,12 @@ if(CPackGen MATCHES "RPM") ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${RPM_EXECUTABLE} -pqa ${check_file} + RESULT_VARIABLE check_package_architecture_result + OUTPUT_VARIABLE check_package_architecture + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file} OUTPUT_VARIABLE check_package_content ERROR_QUIET @@ -169,28 +175,28 @@ if(CPackGen MATCHES "RPM") set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_applications_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_libraries_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "noarch") set(spec_regex "*headers*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/include\n/usr/foo/bar/include/mylib.h$") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_headers_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_Unspecified_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*Unspecified*") set(check_content_list "^/usr/foo/bar /usr/foo/bar/bin @@ -230,9 +236,22 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") endif() - string(REGEX MATCH ${check_file_match_expected_architecture} check_file_match_architecture ${check_file_content}) - if (NOT check_file_match_architecture) + ####################### + # test package architecture + ####################### + string(REGEX MATCH "Architecture${whitespaces}:" check_info_contains_arch ${check_file_content}) + if(check_info_contains_arch) # test for rpm versions that contain architecture in package info (e.g. 4.11.x) + string(REGEX MATCH "Architecture${whitespaces}:${whitespaces}${check_file_match_expected_architecture}" check_file_match_architecture ${check_file_content}) + if(NOT check_file_match_architecture) message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") + endif() + elseif(NOT check_package_architecture_result) # test result only on platforms that support -pqa rpm query + # test for rpm versions that do not contain architecture in package info (e.g. 4.8.x) + string(REGEX MATCH ".*${check_file_match_expected_architecture}" check_file_match_architecture "${check_package_architecture}") + if(NOT check_file_match_architecture) + message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_package_architecture}'; generated spec file: '${spec_file_content}'") + endif() + # else rpm version too old (e.g. 4.4.x) - skip test endif() ####################### From 0ac7d871fae9589bbdf22518360818f9b1423bd8 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 16 Mar 2015 00:01:03 -0400 Subject: [PATCH 0306/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d1bca5f33..bbb2fedb4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150315) +set(CMake_VERSION_PATCH 20150316) #set(CMake_VERSION_RC 1) From 4fb9abc5629ee5c046292adc77b2583ffc15c230 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 17 Mar 2015 00:01:03 -0400 Subject: [PATCH 0307/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bbb2fedb4..35ae8b932 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150316) +set(CMake_VERSION_PATCH 20150317) #set(CMake_VERSION_RC 1) From 49c8dcf7bb8ae9e7584286e552769a61bf23e61b Mon Sep 17 00:00:00 2001 From: Raffi Enficiaud Date: Thu, 12 Feb 2015 17:13:31 +0100 Subject: [PATCH 0308/1029] FindMatlab: Rewrite module and provide a usage API Implement a brand new FindMatlab module: - Add support for versions and components. - Find Matlab and its version in a more precise and multiplatform way. - Add API to create a new mex extension with documentation. - Add API to add matlab unit tests (with or without the unit test framework). - Find as much as possible based on a single Matlab_ROOT_DIR cache entry and allow the user to change it to re-find everything. --- Help/release/dev/FindMatlab-rewrite.rst | 7 + Modules/FindMatlab.cmake | 1522 ++++++++++++++++- Modules/MatlabTestsRedirect.cmake | 92 + Tests/CMakeLists.txt | 6 + Tests/FindMatlab/basic_checks/CMakeLists.txt | 57 + Tests/FindMatlab/cmake_matlab_unit_tests1.m | 33 + Tests/FindMatlab/cmake_matlab_unit_tests2.m | 6 + Tests/FindMatlab/cmake_matlab_unit_tests3.m | 5 + .../cmake_matlab_unit_tests_timeout.m | 16 + Tests/FindMatlab/help_text1.m.txt | 2 + Tests/FindMatlab/matlab_wrapper1.cpp | 26 + .../FindMatlab/versions_checks/CMakeLists.txt | 52 + Tests/RunCMake/CMakeLists.txt | 5 + Tests/RunCMake/FindMatlab/CMakeLists.txt | 3 + .../FindMatlab/MatlabTest1-result.txt | 1 + .../FindMatlab/MatlabTest1-stderr.txt | 2 + Tests/RunCMake/FindMatlab/MatlabTest1.cmake | 22 + Tests/RunCMake/FindMatlab/RunCMakeTest.cmake | 3 + .../FindMatlab/cmake_matlab_unit_tests2.m | 6 + Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp | 26 + 20 files changed, 1798 insertions(+), 94 deletions(-) create mode 100644 Help/release/dev/FindMatlab-rewrite.rst create mode 100644 Modules/MatlabTestsRedirect.cmake create mode 100644 Tests/FindMatlab/basic_checks/CMakeLists.txt create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests1.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests2.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests3.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m create mode 100644 Tests/FindMatlab/help_text1.m.txt create mode 100644 Tests/FindMatlab/matlab_wrapper1.cpp create mode 100644 Tests/FindMatlab/versions_checks/CMakeLists.txt create mode 100644 Tests/RunCMake/FindMatlab/CMakeLists.txt create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1-result.txt create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1.cmake create mode 100644 Tests/RunCMake/FindMatlab/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m create mode 100644 Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp diff --git a/Help/release/dev/FindMatlab-rewrite.rst b/Help/release/dev/FindMatlab-rewrite.rst new file mode 100644 index 000000000..07727b816 --- /dev/null +++ b/Help/release/dev/FindMatlab-rewrite.rst @@ -0,0 +1,7 @@ +FindMatlab-rewrite +------------------ + +* The :module:`FindMatlab` module was completely rewritten. It learned + about versions and components and to find Matlab in a more precise and + multiplatform way. The module now offers APIs to create mex extensions, + documentation, and unit tests. diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 73b3a5b7f..d08423b36 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -2,20 +2,208 @@ # FindMatlab # ---------- # -# this module looks for Matlab +# Finds Matlab installations and provides Matlab tools and libraries to cmake. # -# Defines: +# This package first intention is to find the libraries associated with Matlab +# in order to be able to build Matlab extensions (mex files). It can also be +# used: # -# :: +# * run specific commands in Matlab +# * declare Matlab unit test +# * retrieve various information from Matlab (mex extensions, versions and +# release queries, ...) # -# MATLAB_INCLUDE_DIR: include path for mex.h, engine.h -# MATLAB_LIBRARIES: required libraries: libmex, etc -# MATLAB_MEX_LIBRARY: path to libmex.lib -# MATLAB_MX_LIBRARY: path to libmx.lib -# MATLAB_ENG_LIBRARY: path to libeng.lib +# The module supports the following components: +# +# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of +# Matlab +# * ``MAIN_PROGRAM`` the Matlab binary program. +# +# .. note:: +# +# The version given to the :command:`find_package` directive is the Matlab +# **version**, which should not be confused with the Matlab *release* name +# (eg. `R2014`). +# The :command:`matlab_get_version_from_release_name` and +# :command:`matlab_get_release_name_from_version` allow a mapping +# from the release name to the version. +# +# The variable :variable:`Matlab_ROOT_DIR` may be specified in order to give +# the path of the desired Matlab version. Otherwise, the behaviour is platform +# specific: +# +# * Windows: The installed versions of Matlab are retrieved from the +# Windows registry +# * OS X: The installed versions of Matlab are given by the MATLAB +# paths in ``/Application``. If no such application is found, it falls back +# to the one that might be accessible from the PATH. +# * Unix: The desired Matlab should be accessible from the PATH. +# +# Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set. +# When a Matlab binary is found automatically and the ``MATLAB_VERSION`` +# is not given, the version is queried from Matlab directly. +# On Windows, it can make a window running Matlab appear. +# +# The mapping of the release names and the version of Matlab is performed by +# defining pairs (name, version). The variable +# :variable:`MATLAB_ADDITIONAL_VERSIONS` may be provided before the call to +# the :command:`find_package` in order to handle additional versions. +# +# A Matlab scripts can be added to the set of tests using the +# :command:`matlab_add_unit_test`. By default, the Matlab unit test framework +# will be used (>= 2013a) to run this script, but regular ``.m`` files +# returning an exit code can be used as well (0 indicating a success). +# +# Module Input Variables +# ---------------------- +# +# Users or projects may set the following variables to configure the module +# behaviour: +# +# :variable:`Matlab_ROOT_DIR` +# the root of the Matlab installation. +# :variable:`MATLAB_FIND_DEBUG` +# outputs debug information +# :variable:`MATLAB_ADDITIONAL_VERSIONS` +# additional versions of Matlab for the automatic retrieval of the installed +# versions. +# +# Variables defined by the module +# ------------------------------- +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# ``Matlab_FOUND`` +# ``TRUE`` if the Matlab installation is found, ``FALSE`` +# otherwise. All variable below are defined if Matlab is found. +# ``Matlab_ROOT_DIR`` +# the final root of the Matlab installation determined by the FindMatlab +# module. +# ``Matlab_MAIN_PROGRAM`` +# the Matlab binary program. Available only if the component ``MAIN_PROGRAM`` +# is given in the :command:`find_package` directive. +# ``Matlab_INCLUDE_DIRS`` +# the path of the Matlab libraries headers +# ``Matlab_MEX_LIBRARY`` +# library for mex, always available. +# ``Matlab_MX_LIBRARY`` +# mx library of Matlab (arrays). Available only if the component +# ``MX_LIBRARY`` has been requested. +# ``Matlab_ENG_LIBRARY`` +# Matlab engine library. Available only if the component ``ENG_LIBRARY`` +# is requested. +# ``Matlab_LIBRARIES`` +# the whole set of libraries of Matlab +# ``Matlab_MEX_COMPILER`` +# the mex compiler of Matlab. Currently not used. +# Available only if the component ``MEX_COMPILER`` is asked +# +# Cached variables +# ^^^^^^^^^^^^^^^^ +# +# ``Matlab_MEX_EXTENSION`` +# the extension of the mex files for the current platform (given by Matlab). +# ``Matlab_ROOT_DIR`` +# the location of the root of the Matlab installation found. If this value +# is changed by the user, the result variables are recomputed. +# +# Provided macros +# --------------- +# +# :command:`matlab_get_version_from_release_name` +# returns the version from the release name +# :command:`matlab_get_release_name_from_version` +# returns the release name from the Matlab version +# +# Provided functions +# ------------------ +# +# :command:`matlab_add_mex` +# adds a target compiling a MEX file. +# :command:`matlab_add_unit_test` +# adds a Matlab unit test file as a test to the project. +# :command:`matlab_extract_all_installed_versions_from_registry` +# parses the registry for all Matlab versions. Available on Windows only. +# The part of the registry parsed is dependent on the host processor +# :command:`matlab_get_all_valid_matlab_roots_from_registry` +# returns all the possible Matlab paths, according to a previously +# given list. Only the existing/accessible paths are kept. This is mainly +# useful for the searching all possible Matlab installation. +# :command:`matlab_get_mex_suffix` +# returns the suffix to be used for the mex files +# (platform/architecture dependant) +# :command:`matlab_get_version_from_matlab_run` +# returns the version of Matlab, given the full directory of the Matlab program. +# +# +# Known issues +# ------------ +# +# **Symbol clash in a MEX target** +# By default, every symbols inside a MEX +# file defined with the command :command:`matlab_add_mex` have hidden +# visibility, except for the entry point. This is the default behaviour of +# the MEX compiler, which lowers the risk of symbol collision between the +# libraries shipped with Matlab, and the libraries to which the MEX file is +# linking to. This is also the default on Windows platforms. +# +# However, this is not sufficient in certain case, where for instance your +# MEX file is linking against libraries that are already loaded by Matlab, +# even if those libraries have different SONAMES. +# A possible solution is to hide the symbols of the libraries to which the +# MEX target is linking to. This can be achieved in GNU GCC compilers with +# the linker option ``-Wl,--exclude-libs,ALL``. +# +# **Tests using GPU resources** +# in case your MEX file is using the GPU and +# in order to be able to run unit tests on this MEX file, the GPU resources +# should be properly released by Matlab. A possible solution is to make +# Matlab aware of the use of the GPU resources in the session, which can be +# performed by a command such as ``D = gpuDevice()`` at the beginning of +# the test script (or via a fixture). +# +# +# Reference +# -------------- +# +# .. variable:: Matlab_ROOT_DIR +# +# The root folder of the Matlab installation. If set before the call to +# :command:`find_package`, the module will look for the components in that +# path. If not set, then an automatic search of Matlab +# will be performed. If set, it should point to a valid version of Matlab. +# +# .. variable:: MATLAB_FIND_DEBUG +# +# If set, the lookup of Matlab and the intermediate configuration steps are +# outputted to the console. +# +# .. variable:: MATLAB_ADDITIONAL_VERSIONS +# +# If set, specifies additional versions of Matlab that may be looked for. +# The variable should be a list of strings, organised by pairs of release +# name and versions, such as follows:: +# +# set(MATLAB_ADDITIONAL_VERSIONS +# "release_name1=corresponding_version1" +# "release_name2=corresponding_version2" +# ... +# ) +# +# Example:: +# +# set(MATLAB_ADDITIONAL_VERSIONS +# "R2013b=8.2" +# "R2013a=8.1" +# "R2012b=8.0") +# +# The order of entries in this list matters when several versions of +# Matlab are installed. The priority is set according to the ordering in +# this list. #============================================================================= -# Copyright 2005-2009 Kitware, Inc. +# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -27,101 +215,1247 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -set(MATLAB_FOUND 0) -if(WIN32) - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60") +set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") + +include(FindPackageHandleStandardArgs) +include(CheckCXXCompilerFlag) + + +# The currently supported versions. Other version can be added by the user by +# providing MATLAB_ADDITIONAL_VERSIONS +if(NOT MATLAB_ADDITIONAL_VERSIONS) + set(MATLAB_ADDITIONAL_VERSIONS) +endif() + +set(MATLAB_VERSIONS_MAPPING + "R2014a=8.3" + "R2013b=8.2" + "R2013a=8.1" + "R2012b=8.0" + "R2012a=7.14" + + "R2011b=7.13" + "R2011a=7.12" + "R2010b=7.11" + + ${MATLAB_ADDITIONAL_VERSIONS} + ) + + +# temporary folder for all Matlab runs +set(_matlab_temporary_folder ${CMAKE_BINARY_DIR}/Matlab) + +if(NOT EXISTS "${_matlab_temporary_folder}") + file(MAKE_DIRECTORY "${_matlab_temporary_folder}") +endif() + +#.rst: +# .. command:: matlab_get_version_from_release_name +# +# Returns the version of Matlab (17.58) from a release name (R2017k) +macro (matlab_get_version_from_release_name release_name version_name) + + string(REGEX MATCHALL "${release_name}=([0-9]+\\.?[0-9]*)" _matched ${MATLAB_VERSIONS_MAPPING}) + + set(${version_name} "") + if(NOT _matched STREQUAL "") + set(${version_name} ${CMAKE_MATCH_1}) else() - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") - # Assume people are generally using 7.1, - # if using 7.0 need to link to: ../extern/lib/win32/microsoft/msvc70 - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71") - else() - if(${CMAKE_GENERATOR} MATCHES "Borland") - # Same here, there are also: bcc50 and bcc51 directories - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") - else() - if(MATLAB_FIND_REQUIRED) - message(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") - endif() + message(WARNING "The release name ${release_name} is not registered") + endif() + unset(_matched) + +endmacro() + + + + + +#.rst: +# .. command:: matlab_get_release_name_from_version +# +# Returns the release name (R2017k) from the version of Matlab (17.58) +macro (matlab_get_release_name_from_version version release_name) + + set(${release_name} "") + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=${version}" _matched ${_var}) + if(NOT _matched STREQUAL "") + set(${release_name} ${CMAKE_MATCH_1}) + break() + endif() + endforeach(_var) + + unset(_var) + unset(_matched) + if(${release_name} STREQUAL "") + message(WARNING "The version ${version} is not registered") + endif() + +endmacro() + + + + + +# extracts all the supported release names (R2017k...) of Matlab +# internal use +macro(matlab_get_supported_releases list_releases) + set(${list_releases}) + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var}) + if(NOT _matched STREQUAL "") + list(APPEND ${list_releases} ${CMAKE_MATCH_1}) + endif() + unset(_matched) + unset(CMAKE_MATCH_1) + endforeach(_var) + unset(_var) +endmacro() + + + +# extracts all the supported versions of Matlab +# internal use +macro(matlab_get_supported_versions list_versions) + set(${list_versions}) + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var}) + if(NOT _matched STREQUAL "") + list(APPEND ${list_versions} ${CMAKE_MATCH_2}) + endif() + unset(_matched) + unset(CMAKE_MATCH_1) + endforeach(_var) + unset(_var) +endmacro() + + +#.rst: +# .. command:: matlab_extract_all_installed_versions_from_registry +# +# This function parses the registry and founds the Matlab versions that are +# installed. The found versions are returned in `matlab_versions`. +# Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for +# The returned list contains all versions under +# ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` or an empty list in case an error +# occurred (or nothing found). +# +# .. note:: +# +# Only the versions are provided. No check is made over the existence of the +# installation referenced in the registry, +# +function(matlab_extract_all_installed_versions_from_registry win64 matlab_versions) + + if(NOT CMAKE_HOST_WIN32) + message(FATAL_ERROR "This macro can only be called by a windows host (call to reg.exe") + endif() + + + if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64") + set(APPEND_REG "/reg:64") + else() + set(APPEND_REG "/reg:32") + endif() + + # /reg:64 should be added on 64 bits capable OSs in order to enable the + # redirection of 64 bits applications + execute_process( + COMMAND reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\MATLAB /f * /k ${APPEND_REG} + RESULT_VARIABLE resultMatlab + OUTPUT_VARIABLE varMatlab + ERROR_VARIABLE errMatlab + INPUT_FILE NUL + ) + + + set(matlabs_from_registry) + if(${resultMatlab} EQUAL 0) + + string( + REGEX MATCHALL "MATLAB\\\\([0-9]+(\\.[0-9]+)?)" + matlab_versions_regex ${varMatlab}) + + foreach(match IN LISTS matlab_versions_regex) + string( + REGEX MATCH "MATLAB\\\\(([0-9]+)(\\.([0-9]+))?)" + current_match ${match}) + + set(_matlab_current_version ${CMAKE_MATCH_1}) + set(current_matlab_version_major ${CMAKE_MATCH_2}) + set(current_matlab_version_minor ${CMAKE_MATCH_4}) + if(NOT current_matlab_version_minor) + set(current_matlab_version_minor "0") endif() + + list(APPEND matlabs_from_registry ${_matlab_current_version}) + unset(_matlab_current_version) + endforeach(match) + + endif() + + if(matlabs_from_registry) + list(REMOVE_DUPLICATES matlabs_from_registry) + list(SORT matlabs_from_registry) + list(REVERSE matlabs_from_registry) + endif() + + set(${matlab_versions} ${matlabs_from_registry} PARENT_SCOPE) + +endfunction() + + + +# (internal) +macro(extract_matlab_versions_from_registry_brute_force matlab_versions) + # get the supported versions + set(matlab_supported_versions) + matlab_get_supported_versions(matlab_supported_versions) + + + # this is a manual population of the versions we want to look for + # this can be done as is, but preferably with the call to + # matlab_get_supported_versions and variable + + # populating the versions we want to look for + # set(matlab_supported_versions) + + # # Matlab 7 + # set(matlab_major 7) + # foreach(current_matlab_minor RANGE 4 20) + # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") + # endforeach(current_matlab_minor) + + # # Matlab 8 + # set(matlab_major 8) + # foreach(current_matlab_minor RANGE 0 5) + # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") + # endforeach(current_matlab_minor) + + # # taking into account the possible additional versions provided by the user + # if(DEFINED MATLAB_ADDITIONAL_VERSIONS) + # list(APPEND matlab_supported_versions MATLAB_ADDITIONAL_VERSIONS) + # endif() + + + # we order from more recent to older + if(matlab_supported_versions) + list(REMOVE_DUPLICATES matlab_supported_versions) + list(SORT matlab_supported_versions) + list(REVERSE matlab_supported_versions) + endif() + + + set(${matlab_versions} ${matlab_supported_versions}) + + +endmacro() + + + + +#.rst: +# .. command:: matlab_get_all_valid_matlab_roots_from_registry +# +# Populates the Matlab root with valid versions of Matlab. +# The returned matlab_roots is organized in pairs +# ``(version_number,matlab_root_path)``. +# +# :: +# +# matlab_get_all_valid_matlab_roots_from_registry( +# matlab_versions +# matlab_roots) +# +# ``matlab_versions`` +# the versions of each of the Matlab installations +# ``matlab_roots`` +# the location of each of the Matlab installations +function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots) + + # The matlab_versions comes either from + # extract_matlab_versions_from_registry_brute_force or + # matlab_extract_all_installed_versions_from_registry. + + + set(_matlab_roots_list ) + foreach(_matlab_current_version ${matlab_versions}) + get_filename_component( + current_MATLAB_ROOT + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]" + ABSOLUTE) + + if(EXISTS ${current_MATLAB_ROOT}) + list(APPEND _matlab_roots_list ${_matlab_current_version} ${current_MATLAB_ROOT}) + endif() + + endforeach(_matlab_current_version) + unset(_matlab_current_version) + set(${matlab_roots} ${_matlab_roots_list} PARENT_SCOPE) + unset(_matlab_roots_list) +endfunction() + +#.rst: +# .. command:: matlab_get_mex_suffix +# +# Returns the extension of the mex files (the suffixes). +# This function should not be called before the appropriate Matlab root has +# been found. +# +# :: +# +# matlab_get_mex_suffix( +# matlab_root +# mex_suffix) +# +# ``matlab_root`` +# the root of the Matlab installation +# ``mex_suffix`` +# the variable name in which the suffix will be returned. +function(matlab_get_mex_suffix matlab_root mex_suffix) + + # todo setup the extension properly. Currently I do not know if this is + # sufficient for all win32 distributions. + # there is also CMAKE_EXECUTABLE_SUFFIX that could be tweaked + set(mexext_suffix "") + if(WIN32) + list(APPEND mexext_suffix ".bat") + endif() + + # we first try without suffix, since cmake does not understand a list with + # one empty string element + find_program( + Matlab_MEXEXTENSIONS_PROG + NAMES mexext + PATHS ${matlab_root}/bin + DOC "Matlab MEX extension provider" + NO_DEFAULT_PATH + ) + + foreach(current_mexext_suffix IN LISTS mexext_suffix) + if(NOT DEFINED Matlab_MEXEXTENSIONS_PROG OR NOT Matlab_MEXEXTENSIONS_PROG) + # this call should populate the cache automatically + find_program( + Matlab_MEXEXTENSIONS_PROG + "mexext${current_mexext_suffix}" + PATHS ${matlab_root}/bin + DOC "Matlab MEX extension provider" + NO_DEFAULT_PATH + ) + endif() + endforeach(current_mexext_suffix) + + + # the program has been found? + if((NOT Matlab_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${Matlab_MEXEXTENSIONS_PROG})) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot found mexext program. Matlab root is ${matlab_root}") + endif() + unset(Matlab_MEXEXTENSIONS_PROG CACHE) + return() + endif() + + set(_matlab_mex_extension) + + set(devnull) + if(UNIX) + set(devnull INPUT_FILE /dev/null) + elseif(WIN32) + set(devnull INPUT_FILE NUL) + endif() + + execute_process( + COMMAND ${Matlab_MEXEXTENSIONS_PROG} + OUTPUT_VARIABLE _matlab_mex_extension + ERROR_VARIABLE _matlab_mex_extension_error + ${devnull}) + string(STRIP ${_matlab_mex_extension} _matlab_mex_extension) + + unset(Matlab_MEXEXTENSIONS_PROG CACHE) + set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE) +endfunction() + + + + +#.rst: +# .. command:: matlab_get_version_from_matlab_run +# +# This function runs Matlab program specified on arguments and extracts its +# version. +# +# :: +# +# matlab_get_version_from_matlab_run( +# matlab_binary_path +# matlab_list_versions) +# +# ``matlab_binary_path`` +# the location of the `matlab` binary executable +# ``matlab_list_versions`` +# the version extracted from Matlab +function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions) + + set(${matlab_list_versions} "" PARENT_SCOPE) + + + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Determining the version of Matlab from ${matlab_binary_program}") + endif() + + if(EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Removing previous ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp file") + endif() + file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + endif() + + + # the log file is needed since on windows the command executes in a new + # window and it is not possible to get back the answer of Matlab + # the -wait command is needed on windows, otherwise the call returns + # immediately after the program launches itself. + if(WIN32) + set(_matlab_additional_commands "-wait") + endif() + + set(devnull) + if(UNIX) + set(devnull INPUT_FILE /dev/null) + elseif(WIN32) + set(devnull INPUT_FILE NUL) + endif() + + # timeout set to 30 seconds, in case it does not start + # note as said before OUTPUT_VARIABLE cannot be used in a platform + # independent manner however, not setting it would flush the output of Matlab + # in the current console (unix variant) + execute_process( + COMMAND "${matlab_binary_program}" -nosplash -nojvm ${_matlab_additional_commands} -logfile "matlabVersionLog.cmaketmp" -nodesktop -nodisplay -r "version, exit" + OUTPUT_VARIABLE _matlab_version_from_cmd_dummy + RESULT_VARIABLE _matlab_result_version_call + ERROR_VARIABLE _matlab_result_version_call_error + TIMEOUT 30 + WORKING_DIRECTORY "${_matlab_temporary_folder}" + ${devnull} + ) + + + if(${_matlab_result_version_call}) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab. Matlab call returned with error ${_matlab_result_version_call}.") + endif() + return() + elseif(NOT EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab. The log file does not exist.") + endif() + return() + endif() + + # if successful, read back the log + file(READ "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp" _matlab_version_from_cmd) + file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + + set(index -1) + string(FIND ${_matlab_version_from_cmd} "ans" index) + if(index EQUAL -1) + + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot find the version of Matlab returned by the run.") + endif() + + else() + set(matlab_list_of_all_versions_tmp) + + string(SUBSTRING ${_matlab_version_from_cmd} ${index} -1 substring_ans) + string( + REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*([0-9]+(\\.[0-9]+)?)" + matlab_versions_regex + ${substring_ans}) + foreach(match IN LISTS matlab_versions_regex) + string( + REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*(([0-9]+)(\\.([0-9]+))?)" + current_match ${match}) + + list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1}) + endforeach() + if(matlab_list_of_all_versions_tmp) + list(REMOVE_DUPLICATES matlab_list_of_all_versions_tmp) + endif() + set(${matlab_list_versions} ${matlab_list_of_all_versions_tmp} PARENT_SCOPE) + + endif() + +endfunction() + + +#.rst: +# .. command:: matlab_add_unit_test +# +# Adds a Matlab unit test to the test set of cmake/ctest. +# This command requires the component ``MAIN_PROGRAM``. +# The unit test uses the Matlab unittest framework (default, available +# starting Matlab 2013b+) except if the option ``NO_UNITTEST_FRAMEWORK`` +# is given. +# +# The function expects one Matlab test script file to be given. +# In the case ``NO_UNITTEST_FRAMEWORK`` is given, the unittest script file +# should contain the script to be run, plus an exit command with the exit +# value. This exit value will be passed to the ctest framework (0 success, +# non 0 failure). Additional arguments accepted by :command:`add_test` can be +# passed through ``TEST_ARGS`` (eg. ``CONFIGURATION ...``). +# +# :: +# +# matlab_add_unit_test( +# NAME +# UNITTEST_FILE matlab_file_containing_unittest.m +# [UNITTEST_PRECOMMAND matlab_command_to_run] +# [TIMEOUT timeout] +# [ADDITIONAL_PATH path1 [path2 ...]] +# [MATLAB_ADDITIONAL_STARTUP_OPTIONS option1 [option2 ...]] +# [TEST_ARGS arg1 [arg2 ...]] +# [NO_UNITTEST_FRAMEWORK] +# ) +# +# The function arguments are: +# +# ``NAME`` +# name of the unittest in ctest. +# ``UNITTEST_FILE`` +# the matlab unittest file. Its path will be automatically +# added to the Matlab path. +# ``UNITTEST_PRECOMMAND`` +# Matlab script command to be ran before the file +# containing the test (eg. GPU device initialisation based on CMake +# variables). +# ``TIMEOUT`` +# the test timeout in seconds. Defaults to 180 seconds as the +# Matlab unit test may hang. +# ``ADDITIONAL_PATH`` +# a list of paths to add to the Matlab path prior to +# running the unit test. +# ``MATLAB_ADDITIONAL_STARTUP_OPTIONS`` +# a list of additional option in order +# to run Matlab from the command line. +# ``TEST_ARGS`` +# Additional options provided to the add_test command. These +# options are added to the default options (eg. "CONFIGURATIONS Release") +# ``NO_UNITTEST_FRAMEWORK`` +# when set, indicates that the test should not +# use the unittest framework of Matlab (available for versions >= R2013a). +# +function(matlab_add_unit_test) + + if(NOT Matlab_MAIN_PROGRAM) + message(FATAL_ERROR "[MATLAB] This functionality needs the MAIN_PROGRAM component (not default)") + endif() + + set(options NO_UNITTEST_FRAMEWORK) + set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT) + set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS) + + set(prefix _matlab_unittest_prefix) + cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT ${prefix}_NAME) + message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty") + endif() + + add_test(NAME ${${prefix}_NAME} + COMMAND ${CMAKE_COMMAND} + -Dtest_name=${${prefix}_NAME} + -Dadditional_paths=${${prefix}_ADDITIONAL_PATH} + -Dtest_timeout=${${prefix}_TIMEOUT} + -Doutput_directory=${_matlab_temporary_folder} + -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM} + -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK} + -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS} + -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE} + -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND} + -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake + ${${prefix}_TEST_ARGS} + ${${prefix}_UNPARSED_ARGUMENTS} + ) +endfunction() + + +#.rst: +# .. command:: matlab_add_mex +# +# Adds a Matlab MEX target. +# This commands compiles the given sources with the current tool-chain in +# order to produce a MEX file. The final name of the produced output may be +# specified, as well as additional link libraries, and a documentation entry +# for the MEX file. Remaining arguments of the call are passed to the +# :command:`add_library` command. +# +# :: +# +# matlab_add_mex( +# NAME +# SRC src1 [src2 ...] +# [OUTPUT_NAME output_name] +# [DOCUMENTATION file.txt] +# [LINK_TO target1 target2 ...] +# [...] +# ) +# +# ``NAME`` +# name of the target. +# ``SRC`` +# list of tje source files. +# ``LINK_TO`` +# a list of additional link dependencies. The target links to ``libmex`` +# by default. If ``Matlab_MX_LIBRARY`` is defined, it also +# links to ``libmx``. +# ``OUTPUT_NAME`` +# if given, overrides the default name. The default name is +# the name of the target without any prefix and +# with ``Matlab_MEX_EXTENSION`` suffix. +# ``DOCUMENTATION`` +# if given, the file ``file.txt`` will be considered as +# being the documentation file for the MEX file. This file is copied into +# the same folder without any processing, with the same name as the final +# mex file, and with extension `.m`. In that case, typing ``help `` +# in Matlab prints the documentation contained in this file. +# +# The documentation file is not processed and should be in the following +# format: +# +# :: +# +# % This is the documentation +# function ret = mex_target_output_name(input1) +# +function(matlab_add_mex ) + + if(NOT WIN32) + # we do not need all this on Windows + # pthread options + check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + # we should use try_compile instead, the link flags are discarded from + # this compiler_flag function. + #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY) + + endif() + + set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME) + set(multiValueArgs LINK_TO SRC) + + set(prefix _matlab_addmex_prefix) + cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT ${prefix}_NAME) + message(FATAL_ERROR "[MATLAB] The MEX target name cannot be empty") + endif() + + if(NOT ${prefix}_OUTPUT_NAME) + set(${prefix}_OUTPUT_NAME ${${prefix}_NAME}) + endif() + + add_library(${${prefix}_NAME} + SHARED + ${${prefix}_SRC} + ${${prefix}_DOCUMENTATION} + ${${prefix}_UNPARSED_ARGUMENTS}) + target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS}) + + if(DEFINED Matlab_MX_LIBRARY) + target_link_libraries(${${prefix}_NAME} ${Matlab_MX_LIBRARY}) + endif() + + target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${${prefix}_LINK_TO}) + set_target_properties(${${prefix}_NAME} + PROPERTIES + PREFIX "" + OUTPUT_NAME ${${prefix}_OUTPUT_NAME} + SUFFIX ".${Matlab_MEX_EXTENSION}") + + + # documentation + if(NOT ${${prefix}_DOCUMENTATION} STREQUAL "") + get_target_property(output_name ${${prefix}_NAME} OUTPUT_NAME) + add_custom_command( + TARGET ${${prefix}_NAME} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${${prefix}_DOCUMENTATION} $/${output_name}.m + COMMENT "Copy ${${prefix}_NAME} documentation file into the output folder" + ) + endif() # documentation + + # entry point in the mex file + taking care of visibility and symbol clashes. + if(WIN32) + set_target_properties(${${prefix}_NAME} + PROPERTIES + DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") + else() + + if(HAS_MINUS_PTHREAD AND NOT APPLE) + # Apparently, compiling with -pthread generated the proper link flags + # and some defines at compilation + target_compile_options(${${prefix}_NAME} PRIVATE "-pthread") + endif() + + + # if we do not do that, the symbols linked from eg. boost remain weak and + # then clash with the ones defined in the matlab process. So by default + # the symbols are hidden. + # This also means that for shared libraries (like MEX), the entry point + # should be explicitly declared with default visibility, otherwise Matlab + # cannot find the entry point. + # Note that this is particularly meaningful if the MEX wrapper itself + # contains symbols that are clashing with Matlab (that are compiled in the + # MEX file). In order to propagate the visibility options to the libraries + # to which the MEX file is linked against, the -Wl,--exclude-libs,ALL + # option should also be specified. + + set_target_properties(${${prefix}_NAME} + PROPERTIES + CXX_VISIBILITY_PRESET "hidden" + C_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN "hidden" + ) + + # get_target_property( + # _previous_link_flags + # ${${prefix}_NAME} + # LINK_FLAGS) + # if(NOT _previous_link_flags) + # set(_previous_link_flags) + # endif() + + # if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # set_target_properties(${${prefix}_NAME} + # PROPERTIES + # LINK_FLAGS "${_previous_link_flags} -Wl,--exclude-libs,ALL" + # # -Wl,--version-script=${_FindMatlab_SELF_DIR}/MatlabLinuxVisibility.map" + # ) + # elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # # in this case, all other symbols become hidden. + # set_target_properties(${${prefix}_NAME} + # PROPERTIES + # LINK_FLAGS "${_previous_link_flags} -Wl,-exported_symbol,_mexFunction" + # #-Wl,-exported_symbols_list,${_FindMatlab_SELF_DIR}/MatlabOSXVisilibity.map" + # ) + # endif() + + + + set_target_properties(${${prefix}_NAME} + PROPERTIES + DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))" + ) + + + endif() + +endfunction() + + +# (internal) +# Used to get the version of matlab, using caching. This basically transforms the +# output of the root list, with possible unknown version, to a version +# +function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_final_version) + + # if the version is not trivial, we query matlab for that + # we keep track of the location of matlab that induced this version + #if(NOT DEFINED Matlab_PROG_VERSION_STRING_AUTO_DETECT) + # set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version") + #endif() + + if(NOT ${matlab_known_version} STREQUAL "NOTFOUND") + # the version is known, we just return it + set(${matlab_final_version} ${matlab_known_version} PARENT_SCOPE) + set(Matlab_VERSION_STRING_INTERNAL ${matlab_known_version} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + return() + endif() + + # + set(_matlab_current_program ${Matlab_MAIN_PROGRAM}) + + # do we already have a matlab program? + if(NOT _matlab_current_program) + + set(_find_matlab_options) + if(matlab_root AND EXISTS ${matlab_root}) + set(_find_matlab_options PATHS ${matlab_root} ${matlab_root}/bin NO_DEFAULT_PATH) + endif() + + find_program( + _matlab_current_program + matlab + ${_find_matlab_options} + DOC "Matlab main program" + ) + endif() + + if(NOT _matlab_current_program OR NOT EXISTS ${_matlab_current_program}) + # if not found, clear the dependent variables + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot find the main matlab program under ${matlab_root}") + endif() + set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + set(Matlab_VERSION_STRING_INTERNAL "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + unset(_matlab_current_program) + unset(_matlab_current_program CACHE) + return() + endif() + + # full real path for path comparison + get_filename_component(_matlab_main_real_path_tmp "${_matlab_current_program}" REALPATH) + unset(_matlab_current_program) + unset(_matlab_current_program CACHE) + + # is it the same as the previous one? + if(_matlab_main_real_path_tmp STREQUAL Matlab_PROG_VERSION_STRING_AUTO_DETECT) + set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) + return() + endif() + + # update the location of the program + set(Matlab_PROG_VERSION_STRING_AUTO_DETECT ${_matlab_main_real_path_tmp} CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + + set(matlab_list_of_all_versions) + matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions) + + list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + + # set the version into the cache + set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + + # warning, just in case several versions found (should not happen) + list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) + if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})") + endif() + + # return the updated value + set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) + +endfunction() + + + + + + + +# ################################### +# Exploring the possible Matlab_ROOTS + +# this variable will get all Matlab installations found in the current system. +set(_matlab_possible_roots) + + + +if(Matlab_ROOT_DIR) + # if the user specifies a possible root, we keep this one + + if(NOT EXISTS ${Matlab_ROOT_DIR}) + # if Matlab_ROOT_DIR specified but erroneous + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] the specified path for Matlab_ROOT_DIR does not exist (${Matlab_ROOT_DIR})") + endif() + else() + # NOTFOUND indicates the code below to search for the version automatically + if(NOT DEFINED Matlab_VERSION_STRING_INTERNAL) + list(APPEND _matlab_possible_roots "NOTFOUND" ${Matlab_ROOT_DIR}) # empty version + else() + list(APPEND _matlab_possible_roots ${Matlab_VERSION_STRING_INTERNAL} ${Matlab_ROOT_DIR}) # cached version endif() endif() - find_library(MATLAB_MEX_LIBRARY - libmex - ${MATLAB_ROOT} - ) - find_library(MATLAB_MX_LIBRARY - libmx - ${MATLAB_ROOT} - ) - find_library(MATLAB_ENG_LIBRARY - libeng - ${MATLAB_ROOT} - ) - find_path(MATLAB_INCLUDE_DIR - "mex.h" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include" - ) + else() - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Regular x86 - set(MATLAB_ROOT - /usr/local/matlab-7sp1/bin/glnx86/ - /opt/matlab-7sp1/bin/glnx86/ - $ENV{HOME}/matlab-7sp1/bin/glnx86/ - $ENV{HOME}/redhat-matlab/bin/glnx86/ - ) - else() - # AMD64: - set(MATLAB_ROOT - /usr/local/matlab-7sp1/bin/glnxa64/ - /opt/matlab-7sp1/bin/glnxa64/ - $ENV{HOME}/matlab7_64/bin/glnxa64/ - $ENV{HOME}/matlab-7sp1/bin/glnxa64/ - $ENV{HOME}/redhat-matlab/bin/glnxa64/ - ) + + # if the user does not specify the possible installation root, we look for + # one installation using the appropriate heuristics + + if(WIN32) + + # On WIN32, we look for Matlab installation in the registry + # if unsuccessful, we look for all known revision and filter the existing + # ones. + + # testing if we are able to extract the needed information from the registry + set(_matlab_versions_from_registry) + matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry) + + # the returned list is empty, doing the search on all known versions + if(NOT _matlab_versions_from_registry) + + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions") + endif() + + extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry) + endif() + + # filtering the results with the registry keys + matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots) + unset(_matlab_versions_from_registry) + + elseif(APPLE) + + # on mac, we look for the /Application paths + # this corresponds to the behaviour on Windows. On Linux, we do not have + # any other guess. + matlab_get_supported_releases(_matlab_releases) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab supported versions ${_matlab_releases}. If more version should be supported " + "the variable MATLAB_ADDITIONAL_VERSIONS can be set according to the documentation") + endif() + + foreach(_matlab_current_release IN LISTS _matlab_releases) + set(_matlab_full_string "/Applications/MATLAB_${_matlab_current_release}.app") + if(EXISTS ${_matlab_full_string}) + set(_matlab_current_version) + matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_full_string}") + endif() + list(APPEND _matlab_possible_roots ${_matlab_current_version} ${_matlab_full_string}) + unset(_matlab_current_version) + endif() + + unset(_matlab_full_string) + endforeach(_matlab_current_release) + + unset(_matlab_current_release) + unset(_matlab_releases) + endif() - find_library(MATLAB_MEX_LIBRARY - mex - ${MATLAB_ROOT} - ) - find_library(MATLAB_MX_LIBRARY + +endif() + + + +list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots) +if(_numbers_of_matlab_roots EQUAL 0) + # if we have not found anything, we fall back on the PATH + + + # At this point, we have no other choice than trying to find it from PATH. + # If set by the user, this wont change + find_program( + _matlab_main_tmp + NAMES matlab) + + + if(_matlab_main_tmp) + # we then populate the list of roots, with empty version + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}") + endif() + + # resolve symlinks + get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH) + + # get the directory (the command below has to be run twice) + # this will be the matlab root + get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) + get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) # Matlab should be in bin + + list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location}) + + unset(_matlab_current_location) + + endif() + unset(_matlab_main_tmp CACHE) + +endif() + + + + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab root folders are ${_matlab_possible_roots}") +endif() + + + + + +# take the first possible Matlab root +list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots) +set(Matlab_VERSION_STRING "NOTFOUND") +if(_numbers_of_matlab_roots GREATER 0) + list(GET _matlab_possible_roots 0 Matlab_VERSION_STRING) + list(GET _matlab_possible_roots 1 Matlab_ROOT_DIR) + + # adding a warning in case of ambiguity + if(_numbers_of_matlab_roots GREATER 2 AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})." + " If this is not the desired behaviour, provide the -DMatlab_ROOT_DIR=... on the command line") + endif() +endif() + + +# check if the root changed against the previous defined one, if so +# clear all the cached variables +if(DEFINED Matlab_ROOT_DIR_LAST_CACHED) + + if(NOT Matlab_ROOT_DIR_LAST_CACHED STREQUAL Matlab_ROOT_DIR) + set(_Matlab_cached_vars + Matlab_INCLUDE_DIRS + Matlab_MEX_LIBRARY + Matlab_MEX_COMPILER + Matlab_MAIN_PROGRAM + Matlab_MX_LIBRARY + Matlab_ENG_LIBRARY + Matlab_MEX_EXTENSION + + # internal + Matlab_MEXEXTENSIONS_PROG + Matlab_ROOT_DIR_LAST_CACHED + #Matlab_PROG_VERSION_STRING_AUTO_DETECT + Matlab_VERSION_STRING_INTERNAL + ) + foreach(_var IN LISTS _Matlab_cached_vars) + if(DEFINED ${_var}) + unset(${_var} CACHE) + endif() + endforeach() + endif() +endif() + +set(Matlab_ROOT_DIR_LAST_CACHED ${Matlab_ROOT_DIR} CACHE INTERNAL "last Matlab root dir location") +set(Matlab_ROOT_DIR ${Matlab_ROOT_DIR} CACHE PATH "Matlab installation root path" FORCE) + +# Fix the version, in case this one is NOTFOUND +_Matlab_get_version_from_root( + "${Matlab_ROOT_DIR}" + ${Matlab_VERSION_STRING} + Matlab_VERSION_STRING +) + + + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Current version is ${Matlab_VERSION_STRING} located ${Matlab_ROOT_DIR}") +endif() + + + +if(Matlab_ROOT_DIR) + file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR) +endif() + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(_matlab_64Build FALSE) +else() + set(_matlab_64Build TRUE) +endif() + +if(APPLE) + set(_matlab_bin_prefix "mac") # i should be for intel + set(_matlab_bin_suffix_32bits "i") + set(_matlab_bin_suffix_64bits "i64") +elseif(UNIX) + set(_matlab_bin_prefix "gln") + set(_matlab_bin_suffix_32bits "x86") + set(_matlab_bin_suffix_64bits "xa64") +else() + set(_matlab_bin_prefix "win") + set(_matlab_bin_suffix_32bits "32") + set(_matlab_bin_suffix_64bits "64") +endif() + + + +set(MATLAB_INCLUDE_DIR_TO_LOOK ${Matlab_ROOT_DIR}/extern/include) +if(_matlab_64Build) + set(_matlab_current_suffix ${_matlab_bin_suffix_64bits}) +else() + set(_matlab_current_suffix ${_matlab_bin_suffix_32bits}) +endif() + +set(Matlab_BINARIES_DIR + ${Matlab_ROOT_DIR}/bin/${_matlab_bin_prefix}${_matlab_current_suffix}) +set(Matlab_EXTERN_LIBRARY_DIR + ${Matlab_ROOT_DIR}/extern/lib/${_matlab_bin_prefix}${_matlab_current_suffix}) + +if(WIN32) + set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/microsoft) + set(_matlab_lib_prefix_for_search "lib") +else() + set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR}) + set(_matlab_lib_prefix_for_search "lib") +endif() + +unset(_matlab_64Build) + + +if(NOT DEFINED Matlab_MEX_EXTENSION) + set(_matlab_mex_extension "") + matlab_get_mex_suffix("${Matlab_ROOT_DIR}" _matlab_mex_extension) + + # This variable goes to the cache. + set(Matlab_MEX_EXTENSION ${_matlab_mex_extension} CACHE STRING "Extensions for the mex targets (automatically given by Matlab)") + unset(_matlab_mex_extension) +endif() + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] [DEBUG]_matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}") +endif() + + + +# internal +# This small stub around find_library is to prevent any pollution of CMAKE_FIND_LIBRARY_PREFIXES in the global scope. +# This is the function to be used below instead of the find_library directives. +function(_Matlab_find_library _matlab_library_prefix) + set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} ${_matlab_library_prefix}) + find_library(${ARGN}) +endfunction() + + +set(_matlab_required_variables) + + +# the MEX library/header are required +find_path( + Matlab_INCLUDE_DIRS + mex.h + PATHS ${MATLAB_INCLUDE_DIR_TO_LOOK} + NO_DEFAULT_PATH + ) +list(APPEND _matlab_required_variables Matlab_INCLUDE_DIRS) + +_Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MEX_LIBRARY + mex + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH +) + + +list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY) + +# the MEX extension is required +list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION) + +# the matlab root is required +list(APPEND _matlab_required_variables Matlab_ROOT_DIR) + + +# component Mex Compiler +list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler) +if(_matlab_find_mex_compiler GREATER -1) + find_program( + Matlab_MEX_COMPILER + "mex" + PATHS ${Matlab_BINARIES_DIR} + DOC "Matlab MEX compiler" + NO_DEFAULT_PATH + ) + + if(Matlab_MEX_COMPILER) + set(Matlab_MEX_COMPILER_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mex_compiler) + +# component Matlab program +list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program) +if(_matlab_find_matlab_program GREATER -1) + + find_program( + Matlab_MAIN_PROGRAM + matlab + PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin + DOC "Matlab main program" + NO_DEFAULT_PATH + ) + + if(Matlab_MAIN_PROGRAM) + set(Matlab_MAIN_PROGRAM_FOUND TRUE) + endif() + +endif() +unset(_matlab_find_matlab_program) + +# Component MX library +list(FIND Matlab_FIND_COMPONENTS MX_LIBRARY _matlab_find_mx) +if(_matlab_find_mx GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MX_LIBRARY mx - ${MATLAB_ROOT} - ) - find_library(MATLAB_ENG_LIBRARY + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + + if(Matlab_MX_LIBRARY) + set(Matlab_MX_LIBRARY_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mx) + + +# Component ENG library +list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng) +if(_matlab_find_eng GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_ENG_LIBRARY eng - ${MATLAB_ROOT} - ) - find_path(MATLAB_INCLUDE_DIR - "mex.h" - "/usr/local/matlab-7sp1/extern/include/" - "/opt/matlab-7sp1/extern/include/" - "$ENV{HOME}/matlab-7sp1/extern/include/" - "$ENV{HOME}/redhat-matlab/extern/include/" - ) - + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + if(Matlab_ENG_LIBRARY) + set(Matlab_ENG_LIBRARY_FOUND TRUE) + endif() endif() +unset(_matlab_find_eng) -# This is common to UNIX and Win32: -set(MATLAB_LIBRARIES - ${MATLAB_MEX_LIBRARY} - ${MATLAB_MX_LIBRARY} - ${MATLAB_ENG_LIBRARY} -) -if(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES) - set(MATLAB_FOUND 1) + + + +unset(_matlab_lib_dir_for_search) + + +set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY}) + + +find_package_handle_standard_args( + Matlab + FOUND_VAR Matlab_FOUND + REQUIRED_VARS ${_matlab_required_variables} + VERSION_VAR Matlab_VERSION_STRING + HANDLE_COMPONENTS) + +unset(_matlab_required_variables) +unset(_matlab_bin_prefix) +unset(_matlab_bin_suffix_32bits) +unset(_matlab_bin_suffix_64bits) +unset(_matlab_current_suffix) +unset(_matlab_lib_dir_for_search) +unset(_matlab_lib_prefix_for_search) + +if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES) + mark_as_advanced( + #Matlab_LIBRARIES + Matlab_MEX_LIBRARY + Matlab_MX_LIBRARY + Matlab_ENG_LIBRARY + Matlab_INCLUDE_DIRS + Matlab_FOUND + #Matlab_ROOT_DIR + #Matlab_VERSION_STRING + Matlab_MAIN_PROGRAM + #Matlab_MEX_EXTENSION + Matlab_MEXEXTENSIONS_PROG + Matlab_MEX_EXTENSION + #Matlab_BINARIES_DIR + ) endif() - -mark_as_advanced( - MATLAB_LIBRARIES - MATLAB_MEX_LIBRARY - MATLAB_MX_LIBRARY - MATLAB_ENG_LIBRARY - MATLAB_INCLUDE_DIR - MATLAB_FOUND - MATLAB_ROOT -) diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake new file mode 100644 index 000000000..ebccbf662 --- /dev/null +++ b/Modules/MatlabTestsRedirect.cmake @@ -0,0 +1,92 @@ +# This is an undocumented internal helper for the FindMatlab +# module ``matlab_add_unit_test`` command. + +#============================================================================= +# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +# Usage: cmake +# -Dtest_timeout=180 +# -Dworking_directory="." +# -Doutput_directory= +# -Dadditional_paths="" +# -Dno_unittest_framework="" +# -DMatlab_PROGRAM=matlab_exe_location +# -DMatlab_ADDITIONNAL_STARTUP_OPTIONS="" +# -Dtest_name=name_of_the_test +# -Dcmd_to_run_before_test="" +# -Dunittest_file_to_run +# -P FindMatlab_TestsRedirect.cmake + +set(Matlab_UNIT_TESTS_CMD -nosplash -nojvm -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS}) +if(WIN32) + set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) +endif() + +if(NOT test_timeout) + set(test_timeout 180) +endif() + +if(NOT cmd_to_run_before_test) + set(cmd_to_run_before_test) +endif() + +get_filename_component(unittest_file_directory "${unittest_file_to_run}" DIRECTORY) +get_filename_component(unittest_file_to_run_name "${unittest_file_to_run}" NAME_WE) + +set(concat_string '${unittest_file_directory}') +foreach(s IN LISTS additional_paths) + if(NOT "${s}" STREQUAL "") + set(concat_string "${concat_string}, '${s}'") + endif() +endforeach() + +set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))") +if(no_unittest_framework) + set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)") +endif() + +set(Matlab_SCRIPT_TO_RUN + "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}" + ) + +set(Matlab_LOG_FILE "${output_directory}/${test_name}.log") + +set(devnull) +if(UNIX) + set(devnull INPUT_FILE /dev/null) +elseif(WIN32) + set(devnull INPUT_FILE NUL) +endif() + +execute_process( + COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}" + RESULT_VARIABLE res + TIMEOUT ${test_timeout} + OUTPUT_QUIET # we do not want the output twice + WORKING_DIRECTORY "${output_directory}" + ${devnull} + ) + +if(NOT EXISTS ${Matlab_LOG_FILE}) + message( FATAL_ERROR "[MATLAB] ERROR: cannot find the log file ${Matlab_LOG_FILE}") +endif() + +# print the output in any case. +file(READ ${Matlab_LOG_FILE} matlab_log_content) +message("Matlab test ${name_of_the_test} output:\n${matlab_log_content}") # if we put FATAL_ERROR here, the file is indented. + + +if(NOT (res EQUAL 0)) + message( FATAL_ERROR "[MATLAB] TEST FAILED" ) +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 703c54823..414f6254a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1256,6 +1256,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindJsonCpp) endif() + # Matlab module + if(CMake_TEST_FindMatlab) + ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $) + ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $) + endif() + find_package(GTK2 QUIET) if(GTK2_FOUND) add_subdirectory(FindGTK2) diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt new file mode 100644 index 000000000..acf71ea97 --- /dev/null +++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt @@ -0,0 +1,57 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(basic_checks) + +set(MATLAB_FIND_DEBUG TRUE) + +# the success of the following command is dependent on the current configuration: +# - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab +# - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY MAIN_PROGRAM) + + + +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp + DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt + ) + + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 30 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m + ADDITIONAL_PATH $ + ) + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-2 + TIMEOUT 15 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests_timeout.m + ADDITIONAL_PATH $ + ) +set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE) + + +# testing the test without the unittest framework of Matlab +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-3 + TIMEOUT 30 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $ + ) + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-4 + TIMEOUT 30 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests3.m + ADDITIONAL_PATH $ + ) +set_tests_properties(${PROJECT_NAME}_matlabtest-4 PROPERTIES WILL_FAIL TRUE) diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests1.m b/Tests/FindMatlab/cmake_matlab_unit_tests1.m new file mode 100644 index 000000000..2371c3a64 --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests1.m @@ -0,0 +1,33 @@ + +classdef cmake_matlab_unit_tests1 < matlab.unittest.TestCase + % some simple unit test for CMake Matlab wrapper + properties + end + + methods (Test) + function testDummyCall(testCase) + % very simple call test + cmake_matlab_mex1(rand(3,3)); + end + + function testDummyCall2(testCase) + % very simple call test 2 + ret = cmake_matlab_mex1(rand(3,3)); + testCase.verifyEqual(size(ret), size(rand(3,3))); + + testCase.verifyEqual(size(cmake_matlab_mex1(rand(4,3))), [4,3] ); + end + + function testFailTest(testCase) + testCase.verifyError(@() cmake_matlab_mex1(10), 'cmake_matlab:configuration'); + testCase.verifyError(@() cmake_matlab_mex1([10]), 'cmake_matlab:configuration'); + end + + function testHelpContent(testCase) + % testing the help feature + testCase.verifySubstring(evalc('help cmake_matlab_mex1'), 'Dummy matlab extension in cmake'); + end + + + end +end diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests2.m b/Tests/FindMatlab/cmake_matlab_unit_tests2.m new file mode 100644 index 000000000..7a8a342de --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests2.m @@ -0,0 +1,6 @@ + +ret = cmake_matlab_mex1(rand(3,3)); + +if(size(ret) ~= size(rand(3,3))) + error('Dimension mismatch!'); +end diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests3.m b/Tests/FindMatlab/cmake_matlab_unit_tests3.m new file mode 100644 index 000000000..2639325be --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests3.m @@ -0,0 +1,5 @@ + +cmake_matlab_mex1(10); + +% should not reach this point +exit(0); diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m new file mode 100644 index 000000000..11d5e9ebe --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m @@ -0,0 +1,16 @@ + +classdef cmake_matlab_unit_tests_timeout < matlab.unittest.TestCase + % timeout tests + + properties + end + + methods (Test) + function testCallHangsShouldBeTimedOut(testCase) + cmake_matlab_mex1(rand(3,3)); + disp('Will now wait.'); + disp('Testing the cmake Matlab package timeout - do not kill'); + pause(20); % supposed to be killed after 15s + end + end +end diff --git a/Tests/FindMatlab/help_text1.m.txt b/Tests/FindMatlab/help_text1.m.txt new file mode 100644 index 000000000..a924355d7 --- /dev/null +++ b/Tests/FindMatlab/help_text1.m.txt @@ -0,0 +1,2 @@ +% Dummy matlab extension in cmake +function ret = cmake_matlab_mex1(X) diff --git a/Tests/FindMatlab/matlab_wrapper1.cpp b/Tests/FindMatlab/matlab_wrapper1.cpp new file mode 100644 index 000000000..4149bb954 --- /dev/null +++ b/Tests/FindMatlab/matlab_wrapper1.cpp @@ -0,0 +1,26 @@ + +// simple workaround to some compiler specific problems +// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +#include + +#include "mex.h" + +// this test should return a matrix of 10 x 10 and should check some of the arguments + +void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +{ + if(nrhs != 1) + { + mexErrMsgTxt("Incorrect arguments"); + } + + size_t dim1 = mxGetM(prhs[0]); + size_t dim2 = mxGetN(prhs[0]); + + if(dim1 == 1 || dim2 == 1) + { + mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); + } + + plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL); +} diff --git a/Tests/FindMatlab/versions_checks/CMakeLists.txt b/Tests/FindMatlab/versions_checks/CMakeLists.txt new file mode 100644 index 000000000..5d20685c2 --- /dev/null +++ b/Tests/FindMatlab/versions_checks/CMakeLists.txt @@ -0,0 +1,52 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(versions_checks) + +set(MATLAB_FIND_DEBUG TRUE) +set(MATLAB_ADDITIONAL_VERSIONS + "dummy=14.9") + +# the success of the following command is dependent on the current configuration +# in this case, we are only interested in the version macros +find_package(Matlab) + + + +if(NOT COMMAND matlab_get_version_from_release_name) + message(FATAL_ERROR "The macro matlab_get_version_from_release_name should be defined") +endif() + +if(NOT COMMAND matlab_get_release_name_from_version) + message(FATAL_ERROR "The macro matlab_get_release_name_from_version should be defined") +endif() + + +# matlab_get_release_name_from_version +matlab_get_release_name_from_version("7.13" release_name) +if(NOT release_name STREQUAL "R2011b") + message(FATAL_ERROR "version 7.13 does not give release R2011b : '${release_name}' != R2011b") +endif() + +matlab_get_release_name_from_version("14.9" release_name) +if(NOT release_name STREQUAL "dummy") + message(FATAL_ERROR "version 14.9 does not give release dummy : '${release_name}' != dummy") +endif() + +matlab_get_release_name_from_version("14.10" release_name) +if(NOT release_name STREQUAL "") + message(FATAL_ERROR "version 14.10 does not give empty release: '${release_name}' != ''") +endif() + + +# matlab_get_version_from_release_name +matlab_get_version_from_release_name("R2011a" version) +if(NOT version STREQUAL "7.12") + message(FATAL_ERROR "Release R2011a does not give version 7.12 : '${version}' != 7.12") +endif() + +matlab_get_version_from_release_name("dummy" version) +#message(FATAL_ERROR "versionversion = ${version}") +if(NOT version STREQUAL "14.9") + message(FATAL_ERROR "Release dummy does not give version 14.9 : '${version}' != 14.9") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 1bcc3f34e..7cbc9fea7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -211,3 +211,8 @@ if(RPMBUILD_EXECUTABLE) endif() add_RunCMake_test(COMPILE_LANGUAGE-genex) + +# Matlab module related tests +if(CMake_TEST_FindMatlab) + add_RunCMake_test(FindMatlab) +endif() diff --git a/Tests/RunCMake/FindMatlab/CMakeLists.txt b/Tests/RunCMake/FindMatlab/CMakeLists.txt new file mode 100644 index 000000000..1b9a95788 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/CMakeLists.txt @@ -0,0 +1,3 @@ + +cmake_minimum_required(VERSION 2.8.12) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt b/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt b/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt new file mode 100644 index 000000000..95a787fa1 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*FindMatlab.cmake:[0-9]+ \(message\): + \[MATLAB\] This functionality needs the MAIN_PROGRAM component \(not default\) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake new file mode 100644 index 000000000..1cbc1c202 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake @@ -0,0 +1,22 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(test_should_fail) + +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY) + +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/matlab_wrapper1.cpp + ) + +# this command should raise a FATAL_ERROR, component MAIN_PROGRAM is missing +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 1 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $ + ) diff --git a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake new file mode 100644 index 000000000..33dbb772c --- /dev/null +++ b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake @@ -0,0 +1,3 @@ + +include(RunCMake) +run_cmake(MatlabTest1) diff --git a/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m b/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m new file mode 100644 index 000000000..7a8a342de --- /dev/null +++ b/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m @@ -0,0 +1,6 @@ + +ret = cmake_matlab_mex1(rand(3,3)); + +if(size(ret) ~= size(rand(3,3))) + error('Dimension mismatch!'); +end diff --git a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp new file mode 100644 index 000000000..4149bb954 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp @@ -0,0 +1,26 @@ + +// simple workaround to some compiler specific problems +// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +#include + +#include "mex.h" + +// this test should return a matrix of 10 x 10 and should check some of the arguments + +void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +{ + if(nrhs != 1) + { + mexErrMsgTxt("Incorrect arguments"); + } + + size_t dim1 = mxGetM(prhs[0]); + size_t dim2 = mxGetN(prhs[0]); + + if(dim1 == 1 || dim2 == 1) + { + mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); + } + + plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL); +} From 874fdd914a646d25096c34b97caafe43e2a77748 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Sun, 15 Mar 2015 13:00:31 -0400 Subject: [PATCH 0309/1029] CTest: Output test-specific env vars in verbose mode (#15446) Any environment vars that were configured for a test via the ENVIRONMENT property will now be output when the test is run with verbose logging enabled. --- Source/CTest/cmCTestRunTest.cxx | 15 ++++++++++++++ Tests/CMakeLists.txt | 11 ++++++++++ Tests/CTestTestVerboseOutput/CMakeLists.txt | 11 ++++++++++ .../CTestTestVerboseOutput/CTestConfig.cmake | 7 +++++++ Tests/CTestTestVerboseOutput/nop.c | 4 ++++ Tests/CTestTestVerboseOutput/test.cmake.in | 20 +++++++++++++++++++ 6 files changed, 68 insertions(+) create mode 100644 Tests/CTestTestVerboseOutput/CMakeLists.txt create mode 100644 Tests/CTestTestVerboseOutput/CTestConfig.cmake create mode 100644 Tests/CTestTestVerboseOutput/nop.c create mode 100644 Tests/CTestTestVerboseOutput/test.cmake.in diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd74..01a7884a1 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -536,11 +536,26 @@ void cmCTestRunTest::ComputeArguments() } this->TestResult.FullCommandLine = testCommand; + // Print the test command in verbose mode cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << this->Index << ": " << (this->TestHandler->MemCheck?"MemCheck":"Test") << " command: " << testCommand << std::endl); + + // Print any test-specific env vars in verbose mode + if (this->TestProperties->Environment.size()) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " + << "Environment variables: " << std::endl); + } + for(std::vector::const_iterator e = + this->TestProperties->Environment.begin(); + e != this->TestProperties->Environment.end(); ++e) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << *e + << std::endl); + } } //---------------------------------------------------------------------- diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 703c54823..c75565170 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2561,6 +2561,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestVerboseOutput/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" @ONLY ESCAPE_QUOTES) + add_test(CTestTestVerboseOutput ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" -VV + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/testOutput.log" + -C "\${CTestTest_CONFIG}" + ) + set_property(TEST CTestTestVerboseOutput PROPERTY PASS_REGULAR_EXPRESSION + "Environment variables:.*foo=bar.*this=that" + ) + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" diff --git a/Tests/CTestTestVerboseOutput/CMakeLists.txt b/Tests/CTestTestVerboseOutput/CMakeLists.txt new file mode 100644 index 000000000..4cdd29c68 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 2.6) +project(CTestTestVerboseOutput) +include(CTest) + +add_executable(nop nop.c) + +add_test(NAME TestWithProperties COMMAND nop) +set_property(TEST TestWithProperties PROPERTY ENVIRONMENT + "foo=bar" + "this=that" +) diff --git a/Tests/CTestTestVerboseOutput/CTestConfig.cmake b/Tests/CTestTestVerboseOutput/CTestConfig.cmake new file mode 100644 index 000000000..4f96c79a9 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "CTestTestVerboseOutput") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestVerboseOutput/nop.c b/Tests/CTestTestVerboseOutput/nop.c new file mode 100644 index 000000000..f8b643afb --- /dev/null +++ b/Tests/CTestTestVerboseOutput/nop.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/CTestTestVerboseOutput/test.cmake.in b/Tests/CTestTestVerboseOutput/test.cmake.in new file mode 100644 index 000000000..7f4954841 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/test.cmake.in @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.4) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-VerboseOutput") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestVerboseOutput") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestVerboseOutput") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}") +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}") +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}") From ffc1b9451070d9da5860533da8c19c75583e5661 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 16 Mar 2015 22:10:18 +0100 Subject: [PATCH 0310/1029] CPack/RPM improved component override test Component specific attributes test passed even when attribute was able to leak to the next component as library package is the last that is generated. This patch fixes the test as header package is generated in the middle so leakage causes the test to fail. --- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 8 ++++---- .../RunCPackVerifyResult.cmake | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index e4780d3ac..109bb1caa 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -22,12 +22,12 @@ if(CPACK_GENERATOR MATCHES "RPM") # test cross-built rpm set(CPACK_RPM_applications_PACKAGE_ARCHITECTURE "armv7hf") - # test package summary override + # test package summary override - headers rpm is generated in the middle set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") - # test package description override - set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + # test package description override - headers rpm is generated in the middle + set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 9261d1162..6762b45a2 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -132,12 +132,12 @@ if(CPackGen MATCHES "RPM") endif() set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") - set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") + set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "An extremely useful application that makes use of MyLib") - set(CPACK_COMPONENT_HEADERS_DESCRIPTION - "C/C\\+\\+ header files for use with MyLib") + set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Static libraries used to build programs with MyLib") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -172,15 +172,15 @@ if(CPackGen MATCHES "RPM") set(whitespaces "[\\t\\n\\r ]*") if(check_file_libraries_match) - set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") - set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) - set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") - set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") + set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(check_file_match_expected_architecture "noarch") set(spec_regex "*headers*") From be089724e943da786c35fddceb8d9b0e7a9fb2f5 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 16 Mar 2015 22:17:17 +0100 Subject: [PATCH 0311/1029] CPack/RPM prevent component attributes leakage Fixes mantis bug report with id 15169. Some component specific attributes were leaking to next component. Leakage handling was implemented in different locations but there were still attributes that leaked. Patch encapsulates generator into function so all current leaks are fixed and no future leaks can occur. --- Modules/CPackRPM.cmake | 1355 ++++++++++++++++++++-------------------- 1 file changed, 662 insertions(+), 693 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index fce8236b2..539a0aa66 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -494,709 +494,687 @@ if(NOT UNIX) message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.") endif() -# rpmbuild is the basic command for building RPM package -# it may be a simple (symbolic) link to rpm command. -find_program(RPMBUILD_EXECUTABLE rpmbuild) +function(cpack_rpm_generate_package) + # rpmbuild is the basic command for building RPM package + # it may be a simple (symbolic) link to rpm command. + find_program(RPMBUILD_EXECUTABLE rpmbuild) -# Check version of the rpmbuild tool this would be easier to -# track bugs with users and CPackRPM debug mode. -# We may use RPM version in order to check for available version dependent features -if(RPMBUILD_EXECUTABLE) - execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version - OUTPUT_VARIABLE _TMP_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "^.* " "" - RPMBUILD_EXECUTABLE_VERSION - ${_TMP_VERSION}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") - endif() -endif() - -if(NOT RPMBUILD_EXECUTABLE) - message(FATAL_ERROR "RPM package requires rpmbuild executable") -endif() - -# Display lsb_release output if DEBUG mode enable -# This will help to diagnose problem with CPackRPM -# because we will know on which kind of Linux we are -if(CPACK_RPM_PACKAGE_DEBUG) - find_program(LSB_RELEASE_EXECUTABLE lsb_release) - if(LSB_RELEASE_EXECUTABLE) - execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a - OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT + # Check version of the rpmbuild tool this would be easier to + # track bugs with users and CPackRPM debug mode. + # We may use RPM version in order to check for available version dependent features + if(RPMBUILD_EXECUTABLE) + execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version + OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "\n" ", " - LSB_RELEASE_OUTPUT - ${_TMP_LSB_RELEASE_OUTPUT}) - else () - set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") - endif() - message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") -endif() - -# We may use RPM version in the future in order -# to shut down warning about space in buildtree -# some recent RPM version should support space in different places. -# not checked [yet]. -if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") - message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") -endif() - -# If rpmbuild is found -# we try to discover alien since we may be on non RPM distro like Debian. -# In this case we may try to to use more advanced features -# like generating RPM directly from DEB using alien. -# FIXME feature not finished (yet) -find_program(ALIEN_EXECUTABLE alien) -if(ALIEN_EXECUTABLE) - message(STATUS "alien found, we may be on a Debian based distro.") -endif() - -# Are we packaging components ? -if(CPACK_RPM_PACKAGE_COMPONENT) - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") - string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) -else() - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") -endif() - -set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") - -# -# Use user-defined RPM specific variables value -# or generate reasonable default value from -# CPACK_xxx generic values. -# The variables comes from the needed (mandatory or not) -# values found in the RPM specification file aka ".spec" file. -# The variables which may/should be defined are: -# - -# CPACK_RPM_PACKAGE_SUMMARY (mandatory) - -# CPACK_RPM_PACKAGE_SUMMARY_ is used only locally so that it can be unset each time before use otherwise -# component packaging could leak variable content between components -unset(CPACK_RPM_PACKAGE_SUMMARY_) -if(CPACK_RPM_PACKAGE_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY_ ${CPACK_RPM_PACKAGE_SUMMARY}) - unset(CPACK_RPM_PACKAGE_SUMMARY) -endif() - -#Check for component summary first. -#If not set, it will use regular package summary logic. -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY}) - endif() -endif() - -if(NOT CPACK_RPM_PACKAGE_SUMMARY) - if(CPACK_RPM_PACKAGE_SUMMARY_) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_PACKAGE_SUMMARY_}) - elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) - else() - # if neither var is defined lets use the name as summary - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) - endif() -endif() - -# CPACK_RPM_PACKAGE_NAME (mandatory) -if(NOT CPACK_RPM_PACKAGE_NAME) - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) -endif() - -# CPACK_RPM_PACKAGE_VERSION (mandatory) -if(NOT CPACK_RPM_PACKAGE_VERSION) - if(NOT CPACK_PACKAGE_VERSION) - message(FATAL_ERROR "RPM package requires a package version") - endif() - set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) -endif() -# Replace '-' in version with '_' -# '-' character is an Illegal RPM version character -# it is illegal because it is used to separate -# RPM "Version" from RPM "Release" -string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) - -# CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory) -if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) - execute_process(COMMAND uname "-m" - OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE) -else() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") - endif() -endif() - -set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) - -#prefer component architecture -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE) - set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE}) + string(REGEX REPLACE "^.* " "" + RPMBUILD_EXECUTABLE_VERSION + ${_TMP_VERSION}) if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") endif() endif() -endif() -if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") - set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") -else() - set(TMP_RPM_BUILDARCH "") -endif() -# CPACK_RPM_PACKAGE_RELEASE -# The RPM release is the numbering of the RPM package ITSELF -# this is the version of the PACKAGING and NOT the version -# of the CONTENT of the package. -# You may well need to generate a new RPM package release -# without changing the version of the packaged software. -# This is the case when the packaging is buggy (not) the software :=) -# If not set, 1 is a good candidate -if(NOT CPACK_RPM_PACKAGE_RELEASE) - set(CPACK_RPM_PACKAGE_RELEASE 1) -endif() - -# CPACK_RPM_PACKAGE_LICENSE -if(NOT CPACK_RPM_PACKAGE_LICENSE) - set(CPACK_RPM_PACKAGE_LICENSE "unknown") -endif() - -# CPACK_RPM_PACKAGE_GROUP -if(NOT CPACK_RPM_PACKAGE_GROUP) - set(CPACK_RPM_PACKAGE_GROUP "unknown") -endif() - -# CPACK_RPM_PACKAGE_VENDOR -if(NOT CPACK_RPM_PACKAGE_VENDOR) - if(CPACK_PACKAGE_VENDOR) - set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") - else() - set(CPACK_RPM_PACKAGE_VENDOR "unknown") + if(NOT RPMBUILD_EXECUTABLE) + message(FATAL_ERROR "RPM package requires rpmbuild executable") endif() -endif() - -# CPACK_RPM_PACKAGE_SOURCE -# The name of the source tarball in case we generate a source RPM - -# CPACK_RPM_PACKAGE_DESCRIPTION -# The variable content may be either -# - explicitly given by the user or -# - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE -# if it is defined -# - set to a default value -# - -# CPACK_RPM_PACKAGE_DESCRIPTION_ is used only locally so that it can be unset each time before use otherwise -# component packaging could leak variable content between components -unset(CPACK_RPM_PACKAGE_DESCRIPTION_) -if(CPACK_RPM_PACKAGE_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION_ ${CPACK_RPM_PACKAGE_DESCRIPTION}) - unset(CPACK_RPM_PACKAGE_DESCRIPTION) -endif() - -#Check for a component description first. -#If not set, it will use regular package description logic. -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION}) - elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION}) - endif() -endif() - -if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) - if(CPACK_RPM_PACKAGE_DESCRIPTION_) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION_}) - elseif(CPACK_PACKAGE_DESCRIPTION_FILE) - file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) - else () - set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") - endif () -endif () - -# CPACK_RPM_COMPRESSION_TYPE -# -if (CPACK_RPM_COMPRESSION_TYPE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") - endif() -else() - set(CPACK_RPM_COMPRESSION_TYPE_TMP "") -endif() - -if(CPACK_PACKAGE_RELOCATABLE) - set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) -endif() -if(CPACK_RPM_PACKAGE_RELOCATABLE) - unset(TMP_RPM_PREFIXES) + # Display lsb_release output if DEBUG mode enable + # This will help to diagnose problem with CPackRPM + # because we will know on which kind of Linux we are if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Trying to build a relocatable package") - endif() - if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) - message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") - else() - set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files) - cpack_rpm_prepare_relocation_paths() - endif() -endif() - -# Check if additional fields for RPM spec header are given -# There may be some COMPONENT specific variables as well -# If component specific var is not provided we use the global one -# for each component -foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") + find_program(LSB_RELEASE_EXECUTABLE lsb_release) + if(LSB_RELEASE_EXECUTABLE) + execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a + OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "\n" ", " + LSB_RELEASE_OUTPUT + ${_TMP_LSB_RELEASE_OUTPUT}) + else () + set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") endif() - if(CPACK_RPM_PACKAGE_COMPONENT) - if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) - else() - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) - endif() - endif() + message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") + endif() + + # We may use RPM version in the future in order + # to shut down warning about space in buildtree + # some recent RPM version should support space in different places. + # not checked [yet]. + if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") + message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") + endif() + + # If rpmbuild is found + # we try to discover alien since we may be on non RPM distro like Debian. + # In this case we may try to to use more advanced features + # like generating RPM directly from DEB using alien. + # FIXME feature not finished (yet) + find_program(ALIEN_EXECUTABLE alien) + if(ALIEN_EXECUTABLE) + message(STATUS "alien found, we may be on a Debian based distro.") + endif() + + # Are we packaging components ? + if(CPACK_RPM_PACKAGE_COMPONENT) + set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") + string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) + else() + set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") + endif() + + set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") + + # + # Use user-defined RPM specific variables value + # or generate reasonable default value from + # CPACK_xxx generic values. + # The variables comes from the needed (mandatory or not) + # values found in the RPM specification file aka ".spec" file. + # The variables which may/should be defined are: + # + + # CPACK_RPM_PACKAGE_SUMMARY (mandatory) + + #Check for component summary first. + #If not set, it will use regular package summary logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY}) + endif() + endif() + + if(NOT CPACK_RPM_PACKAGE_SUMMARY) + if(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) else() - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) - endif() + # if neither var is defined lets use the name as summary + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) endif() + endif() - # Do not forget to unset previously set header (from previous component) - unset(TMP_RPM_${_RPM_SPEC_HEADER}) - # Treat the RPM Spec keyword iff it has been properly defined - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) - # Transform NAME --> Name e.g. PROVIDES --> Provides - # The Upper-case first letter and lowercase tail is the - # appropriate value required in the final RPM spec file. - string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) - string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) - string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) - set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") - # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. - set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) - list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) - if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) - string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") - set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})") + # CPACK_RPM_PACKAGE_NAME (mandatory) + if(NOT CPACK_RPM_PACKAGE_NAME) + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) + endif() + + # CPACK_RPM_PACKAGE_VERSION (mandatory) + if(NOT CPACK_RPM_PACKAGE_VERSION) + if(NOT CPACK_PACKAGE_VERSION) + message(FATAL_ERROR "RPM package requires a package version") endif() + set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) + endif() + # Replace '-' in version with '_' + # '-' character is an Illegal RPM version character + # it is illegal because it is used to separate + # RPM "Version" from RPM "Release" + string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) + + # CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory) + if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) + execute_process(COMMAND uname "-m" + OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") endif() - set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) endif() -endforeach() -# CPACK_RPM_SPEC_INSTALL_POST -# May be used to define a RPM post intallation script -# for example setting it to "/bin/true" may prevent -# rpmbuild from stripping binaries. -if(CPACK_RPM_SPEC_INSTALL_POST) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") + set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) + + #prefer component architecture + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE) + set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + endif() + endif() + endif() + if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") + set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + else() + set(TMP_RPM_BUILDARCH "") endif() - set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") -endif() -# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM__POST_INSTALL_SCRIPT_FILE) -# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE) -# May be used to embed a post (un)installation script in the spec file. -# The refered script file(s) will be read and directly -# put after the %post or %postun section -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE) - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE}) + # CPACK_RPM_PACKAGE_RELEASE + # The RPM release is the numbering of the RPM package ITSELF + # this is the version of the PACKAGING and NOT the version + # of the CONTENT of the package. + # You may well need to generate a new RPM package release + # without changing the version of the packaged software. + # This is the case when the packaging is buggy (not) the software :=) + # If not set, 1 is a good candidate + if(NOT CPACK_RPM_PACKAGE_RELEASE) + set(CPACK_RPM_PACKAGE_RELEASE 1) + endif() + + # CPACK_RPM_PACKAGE_LICENSE + if(NOT CPACK_RPM_PACKAGE_LICENSE) + set(CPACK_RPM_PACKAGE_LICENSE "unknown") + endif() + + # CPACK_RPM_PACKAGE_GROUP + if(NOT CPACK_RPM_PACKAGE_GROUP) + set(CPACK_RPM_PACKAGE_GROUP "unknown") + endif() + + # CPACK_RPM_PACKAGE_VENDOR + if(NOT CPACK_RPM_PACKAGE_VENDOR) + if(CPACK_PACKAGE_VENDOR) + set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") + else() + set(CPACK_RPM_PACKAGE_VENDOR "unknown") + endif() + endif() + + # CPACK_RPM_PACKAGE_SOURCE + # The name of the source tarball in case we generate a source RPM + + # CPACK_RPM_PACKAGE_DESCRIPTION + # The variable content may be either + # - explicitly given by the user or + # - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE + # if it is defined + # - set to a default value + # + + #Check for a component description first. + #If not set, it will use regular package description logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION}) + elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION}) + endif() + endif() + + if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) + if(CPACK_PACKAGE_DESCRIPTION_FILE) + file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) + else () + set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") + endif () + endif () + + # CPACK_RPM_COMPRESSION_TYPE + # + if (CPACK_RPM_COMPRESSION_TYPE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") + endif() + else() + set(CPACK_RPM_COMPRESSION_TYPE_TMP "") + endif() + + if(CPACK_PACKAGE_RELOCATABLE) + set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) + endif() + if(CPACK_RPM_PACKAGE_RELOCATABLE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Trying to build a relocatable package") + endif() + if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) + message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") + else() + set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files) + cpack_rpm_prepare_relocation_paths() + endif() + endif() + + # Check if additional fields for RPM spec header are given + # There may be some COMPONENT specific variables as well + # If component specific var is not provided we use the global one + # for each component + foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") + endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) + else() + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() + endif() + else() + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() + endif() + + # Treat the RPM Spec keyword iff it has been properly defined + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + # Transform NAME --> Name e.g. PROVIDES --> Provides + # The Upper-case first letter and lowercase tail is the + # appropriate value required in the final RPM spec file. + string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) + string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) + string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") + # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. + set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) + if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) + string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})") + endif() + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + endif() + set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + endif() + endforeach() + + # CPACK_RPM_SPEC_INSTALL_POST + # May be used to define a RPM post intallation script + # for example setting it to "/bin/true" may prevent + # rpmbuild from stripping binaries. + if(CPACK_RPM_SPEC_INSTALL_POST) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") + endif() + set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") + endif() + + # CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM__POST_INSTALL_SCRIPT_FILE) + # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE) + # May be used to embed a post (un)installation script in the spec file. + # The refered script file(s) will be read and directly + # put after the %post or %postun section + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE) + set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) + endif() + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) + set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) + endif() else() set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) - endif() - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE}) - else() set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) endif() -else() - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) -endif() -# Handle post-install file if it has been specified -if(CPACK_RPM_POST_INSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) - file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) + # Handle post-install file if it has been specified + if(CPACK_RPM_POST_INSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) + file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") + endif() else() - message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") + # reset SPEC var value if no post install file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_POSTINSTALL "") endif() -else() - # reset SPEC var value if no post install file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_POSTINSTALL "") -endif() -# Handle post-uninstall file if it has been specified -if(CPACK_RPM_POST_UNINSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) - file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) + # Handle post-uninstall file if it has been specified + if(CPACK_RPM_POST_UNINSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) + file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") + endif() else() - message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") + # reset SPEC var value if no post uninstall file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_POSTUNINSTALL "") endif() -else() - # reset SPEC var value if no post uninstall file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_POSTUNINSTALL "") -endif() -# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_INSTALL_SCRIPT_FILE) -# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE) -# May be used to embed a pre (un)installation script in the spec file. -# The refered script file(s) will be read and directly -# put after the %pre or %preun section -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE}) + # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_INSTALL_SCRIPT_FILE) + # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE) + # May be used to embed a pre (un)installation script in the spec file. + # The refered script file(s) will be read and directly + # put after the %pre or %preun section + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) + set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) + endif() + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) + set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) + endif() else() set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - endif() - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE}) - else() set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) endif() -else() - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) -endif() -# Handle pre-install file if it has been specified -if(CPACK_RPM_PRE_INSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) - file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) - else() - message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") - endif() -else() - # reset SPEC var value if no pre-install file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_PREINSTALL "") -endif() - -# Handle pre-uninstall file if it has been specified -if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) - file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) - else() - message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") - endif() -else() - # reset SPEC var value if no pre-uninstall file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_PREUNINSTALL "") -endif() - -# CPACK_RPM_CHANGELOG_FILE -# May be used to embed a changelog in the spec file. -# The refered file will be read and directly put after the %changelog section -if(CPACK_RPM_CHANGELOG_FILE) - if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) - file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) - else() - message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") - endif() -else() - set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)") -endif() - -# CPACK_RPM_SPEC_MORE_DEFINE -# This is a generated spec rpm file spaceholder -if(CPACK_RPM_SPEC_MORE_DEFINE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") - endif() -endif() - -# Now we may create the RPM build tree structure -set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") -message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") -# Prepare RPM build tree -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) - -#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") -set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") -# it seems rpmbuild can't handle spaces in the path -# neither escaping (as below) nor putting quotes around the path seem to help -#string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") -set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") - -# if we are creating a relocatable package, omit parent directories of -# CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" -# which is passed to the find command that generates the content-list -if(CPACK_RPM_PACKAGE_RELOCATABLE) - # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are - # destinct parent paths of other relocation paths and remove the - # final element (so the install-prefix dir itself is not omitted - # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) - set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) - if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") - set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") - - string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - unset(_TMP_LIST) - # Now generate all of the parent dirs of the relocation path - foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) - list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") - string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") - list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) - if(_DUPLICATE_FOUND EQUAL -1) - set(_OMIT_DIR "-o -path ${_OMIT_DIR}") - separate_arguments(_OMIT_DIR) - list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) - endif() - endforeach() + # Handle pre-install file if it has been specified + if(CPACK_RPM_PRE_INSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) + file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") endif() - endforeach() -endif() - -if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") -endif() - -if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) - if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) - message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") - list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") + else() + # reset SPEC var value if no pre-install file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_PREINSTALL "") + endif() + + # Handle pre-uninstall file if it has been specified + if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) + file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") + endif() + else() + # reset SPEC var value if no pre-uninstall file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_PREUNINSTALL "") + endif() + + # CPACK_RPM_CHANGELOG_FILE + # May be used to embed a changelog in the spec file. + # The refered file will be read and directly put after the %changelog section + if(CPACK_RPM_CHANGELOG_FILE) + if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) + file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) + else() + message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") + endif() + else() + set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)") + endif() + + # CPACK_RPM_SPEC_MORE_DEFINE + # This is a generated spec rpm file spaceholder + if(CPACK_RPM_SPEC_MORE_DEFINE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") + endif() + endif() + + # Now we may create the RPM build tree structure + set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") + message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") + # Prepare RPM build tree + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) + + #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") + set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") + # it seems rpmbuild can't handle spaces in the path + # neither escaping (as below) nor putting quotes around the path seem to help + #string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + + # if we are creating a relocatable package, omit parent directories of + # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" + # which is passed to the find command that generates the content-list + if(CPACK_RPM_PACKAGE_RELOCATABLE) + # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are + # destinct parent paths of other relocation paths and remove the + # final element (so the install-prefix dir itself is not omitted + # from the RPM's content-list) + list(SORT RPM_USED_PACKAGE_PREFIXES) + set(_DISTINCT_PATH "NOT_SET") + foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) + if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") + set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") + + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) + unset(_TMP_LIST) + # Now generate all of the parent dirs of the relocation path + foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) + list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") + string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") + list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) + if(_DUPLICATE_FOUND EQUAL -1) + set(_OMIT_DIR "-o -path ${_OMIT_DIR}") + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + endif() + endforeach() + endif() + endforeach() endif() -endif() -if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") - endif() - foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) - list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") - endforeach() -endif() -if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") -endif() + message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") + endif() -# Use files tree to construct files command (spec file) -# We should not forget to include symlinks (thus -o -type l) -# We should include directory as well (thus -type d) -# but not the main local dir "." (thus -a -not -name ".") -# We must remove the './' due to the local search and escape the -# file name by enclosing it between double quotes (thus the sed) -# Then we must authorize any man pages extension (adding * at the end) -# because rpmbuild may automatically compress those files -execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) - COMMAND sed s:.*/man.*/.*:&*: - COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ - WORKING_DIRECTORY "${WDIR}" - OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) + if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) + message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") + endif() + endif() -# In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_ -# into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL -# otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES -# This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_ABSOLUTE_DESTINATION_FILES) - set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}") - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") endif() + foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) + list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") + endforeach() endif() -else() - if(CPACK_ABSOLUTE_DESTINATION_FILES) - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}") + if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") endif() -endif() -# In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM__USER_FILELIST. -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST}) + # Use files tree to construct files command (spec file) + # We should not forget to include symlinks (thus -o -type l) + # We should include directory as well (thus -type d) + # but not the main local dir "." (thus -a -not -name ".") + # We must remove the './' due to the local search and escape the + # file name by enclosing it between double quotes (thus the sed) + # Then we must authorize any man pages extension (adding * at the end) + # because rpmbuild may automatically compress those files + execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) + COMMAND sed s:.*/man.*/.*:&*: + COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + + # In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_ + # into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL + # otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES + # This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_ABSOLUTE_DESTINATION_FILES) + set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}") + set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") + message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + endif() + endif() + else() + if(CPACK_ABSOLUTE_DESTINATION_FILES) + set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}") + endif() + endif() + + # In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM__USER_FILELIST. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST) + set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") + message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + endif() + else() + set(CPACK_RPM_USER_FILELIST_INTERNAL "") + endif() + else() + if(CPACK_RPM_USER_FILELIST) + set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") + else() + set(CPACK_RPM_USER_FILELIST_INTERNAL "") + endif() + endif() + + # Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL + # Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL + # or CPACK_RPM_INSTALL_FILES, + # hence it must be done before these auto-generated lists are processed. + if(CPACK_RPM_USER_FILELIST_INTERNAL) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + endif() + + # Create CMake list from CPACK_RPM_INSTALL_FILES + string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) + string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST + "${CPACK_RPM_INSTALL_FILES_LIST}") + string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST + "${CPACK_RPM_INSTALL_FILES_LIST}") + + set(CPACK_RPM_USER_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) + string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) + string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") + endif() + if(F_PREFIX) + set(F_PREFIX "${F_PREFIX} ") + endif() + # Rebuild the user list file + set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") + + # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL + list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) + # ABSOLUTE destination files list may not exists at all + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + endif() + + endforeach() + + # Rebuild CPACK_RPM_INSTALL_FILES + set(CPACK_RPM_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endforeach() + else() + set(CPACK_RPM_USER_INSTALL_FILES "") + endif() + + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}") + endif() + # Remove trailing space + string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) + # Transform endline separated - string into CMake List + string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") + # Remove unecessary quotes + string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") + # Remove ABSOLUTE install file from INSTALL FILE LIST + list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}) + # Rebuild INSTALL_FILES + set(CPACK_RPM_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endforeach() + # Build ABSOLUTE_INSTALL_FILES + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") + foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") + endforeach() + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") + message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") endif() else() - set(CPACK_RPM_USER_FILELIST_INTERNAL "") - endif() -else() - if(CPACK_RPM_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") - else() - set(CPACK_RPM_USER_FILELIST_INTERNAL "") - endif() -endif() - -# Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL -# Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL -# or CPACK_RPM_INSTALL_FILES, -# hence it must be done before these auto-generated lists are processed. -if(CPACK_RPM_USER_FILELIST_INTERNAL) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") + # reset vars in order to avoid leakage of value(s) from one component to another + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() - # Create CMake list from CPACK_RPM_INSTALL_FILES + + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild do + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - - set(CPACK_RPM_USER_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) - string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") - endif() - if(F_PREFIX) - set(F_PREFIX "${F_PREFIX} ") - endif() - # Rebuild the user list file - set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") - - # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) - # ABSOLUTE destination files list may not exists at all - if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) - endif() - - endforeach() - - # Rebuild CPACK_RPM_INSTALL_FILES set(CPACK_RPM_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + if(IS_DIRECTORY "${WDIR}/${F}") + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") + else() + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endif() endforeach() -else() - set(CPACK_RPM_USER_INSTALL_FILES "") -endif() + set(CPACK_RPM_INSTALL_FILES_LIST "") -if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + # The name of the final spec file to be used by rpmbuild + set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") + + # Print out some debug information if we were asked for that if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}") + message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") + message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") + message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") + message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") endif() - # Remove trailing space - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - # Transform endline separated - string into CMake List - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove unecessary quotes - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove ABSOLUTE install file from INSTALL FILE LIST - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}) - # Rebuild INSTALL_FILES - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endforeach() - # Build ABSOLUTE_INSTALL_FILES - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") - foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") - endforeach() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") - message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") + + # + # USER generated/provided spec file handling. + # + + # We can have a component specific spec file. + if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE) + set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) endif() -else() - # reset vars in order to avoid leakage of value(s) from one component to another - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") -endif() -# Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir -# This is necessary to avoid duplicate files since rpmbuild do -# recursion on its own when encountering a pathname which is a directory -# which is not flagged as %dir -string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) -string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") -string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") -set(CPACK_RPM_INSTALL_FILES "") -foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - if(IS_DIRECTORY "${WDIR}/${F}") - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") - else() - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endif() -endforeach() -set(CPACK_RPM_INSTALL_FILES_LIST "") - -# The name of the final spec file to be used by rpmbuild -set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") - -# Print out some debug information if we were asked for that -if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") - message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") -endif() - -# -# USER generated/provided spec file handling. -# - -# We can have a component specific spec file. -if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE) - set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) -endif() - -# We should generate a USER spec file template: -# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE -# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE -if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) - file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in + # We should generate a USER spec file template: + # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE + # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE + if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ @@ -1271,63 +1249,54 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %changelog \@CPACK_RPM_SPEC_CHANGELOG\@ ") - # Stop here if we were asked to only generate a template USER spec file - # The generated file may then be used as a template by user who wants - # to customize their own spec file. - if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) - message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") + # Stop here if we were asked to only generate a template USER spec file + # The generated file may then be used as a template by user who wants + # to customize their own spec file. + if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) + message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") + endif() endif() -endif() -# After that we may either use a user provided spec file -# or generate one using appropriate variables value. -if(CPACK_RPM_USER_BINARY_SPECFILE) - # User may have specified SPECFILE just use it - message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") - # The user provided file is processed for @var replacement - configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -else() - # No User specified spec file, will use the generated spec file - message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") - # Note the just created file is processed for @var replacement - configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -endif() - -if(RPMBUILD_EXECUTABLE) - # Now call rpmbuild using the SPECFILE - execute_process( - COMMAND "${RPMBUILD_EXECUTABLE}" -bb - --define "_topdir ${CPACK_RPM_DIRECTORY}" - --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}" - "${CPACK_RPM_BINARY_SPECFILE}" - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) - message("CPackRPM:Debug: You may consult rpmbuild logs in: ") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") - message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + # After that we may either use a user provided spec file + # or generate one using appropriate variables value. + if(CPACK_RPM_USER_BINARY_SPECFILE) + # User may have specified SPECFILE just use it + message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") + # The user provided file is processed for @var replacement + configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) + else() + # No User specified spec file, will use the generated spec file + message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") + # Note the just created file is processed for @var replacement + configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) endif() -else() - if(ALIEN_EXECUTABLE) - message(FATAL_ERROR "RPM packaging through alien not done (yet)") - endif() -endif() -# reset variables from temporary variables -if(CPACK_RPM_PACKAGE_SUMMARY_) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_PACKAGE_SUMMARY_}) -else() - unset(CPACK_RPM_PACKAGE_SUMMARY) -endif() -if(CPACK_RPM_PACKAGE_DESCRIPTION_) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION_}) -else() - unset(CPACK_RPM_PACKAGE_DESCRIPTION) -endif() + if(RPMBUILD_EXECUTABLE) + # Now call rpmbuild using the SPECFILE + execute_process( + COMMAND "${RPMBUILD_EXECUTABLE}" -bb + --define "_topdir ${CPACK_RPM_DIRECTORY}" + --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}" + "${CPACK_RPM_BINARY_SPECFILE}" + WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) + message("CPackRPM:Debug: You may consult rpmbuild logs in: ") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + endif() + else() + if(ALIEN_EXECUTABLE) + message(FATAL_ERROR "RPM packaging through alien not done (yet)") + endif() + endif() +endfunction() + +cpack_rpm_generate_package() From f94727a9c2d2a48ecca2297675a7762cdfae460f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Mar 2015 13:31:44 -0400 Subject: [PATCH 0312/1029] Record compile features for GNU on Windows (#15443) Drop the 'UNIX' condition on GNU compiler features. Suggested-by: David Demelier --- Modules/Compiler/GNU-CXX.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 86a31e46c..2dc02f0c0 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -44,10 +44,10 @@ macro(cmake_record_cxx_compile_features) endmacro() set(_result 0) - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) endif() - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) if (_result EQUAL 0) _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) endif() From f9d09626899a8196a2f46992585ddff21fd2de34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20W=C3=BCger?= Date: Fri, 13 Mar 2015 09:18:19 +0100 Subject: [PATCH 0313/1029] WCDH: Fix cxx_nullptr workaround for pre-C++11 compilers Use just '0' instead of 'static_cast(0)' because the latter will not automatically convert to pointers to other types. --- Modules/WriteCompilerDetectionHeader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index d18f47cae..f4dcb2157 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -586,7 +586,7 @@ function(write_compiler_detection_header # if ${def_name} # define ${def_value} nullptr # else -# define ${def_value} static_cast(0) +# define ${def_value} 0 # endif \n") endif() From ded79a976e2b63bbfd7a63f27ec00bd071410e27 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Tue, 17 Mar 2015 15:51:04 +0300 Subject: [PATCH 0314/1029] KWIML: Teach ABI.h about Xtensa architecture Signed-off-by: Max Filippov --- ABI.h.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ABI.h.in b/ABI.h.in index 21c9139c0..6300ada4e 100644 --- a/ABI.h.in +++ b/ABI.h.in @@ -432,6 +432,12 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG # endif +/* Xtensa */ +#elif defined(__XTENSA_EB__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +#elif defined(__XTENSA_EL__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + /* Unknown CPU */ #elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN) # error "Byte order of target CPU unknown." From 380db3de00bd74f01781ea93e9ba9cebdea000cc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 18 Mar 2015 00:01:04 -0400 Subject: [PATCH 0315/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 35ae8b932..0d92bcf60 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150317) +set(CMake_VERSION_PATCH 20150318) #set(CMake_VERSION_RC 1) From bc67dbede991be9238e8a102bfb026054b48d83d Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 18 Mar 2015 08:55:32 -0400 Subject: [PATCH 0316/1029] KWSys 2015-03-18 (9367a33b) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 9367a33b | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 4a698414..9367a33b Brad King (1): 20f50727 SystemInformation: Add missing 'break' in StacktraceSignalHandler Sean McBride (2): 093eae34 SystemInformation: Fix -Wswitch-enum warnings 9367a33b testHashSTL: Fix warnings by marking private functions static Change-Id: Ia4ba110c901698f08797412da5773abf4c4c5330 --- SystemInformation.cxx | 8 ++++++++ testHashSTL.cxx | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 9c7ceee1d..b0434f49a 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -1234,6 +1234,7 @@ void StacktraceSignalHandler( case ILL_ILLTRP: oss << "illegal trap"; + break; case ILL_PRVOPC: oss << "privileged opcode"; @@ -1823,6 +1824,7 @@ const char * SystemInformationImplementation::GetVendorID() return "Motorola"; case HP: return "Hewlett-Packard"; + case UnknownManufacturer: default: return "Unknown Manufacturer"; } @@ -3064,6 +3066,12 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case NSC: this->ChipID.ProcessorName = "Cx486SLC \\ DLC \\ Cx486S A-Step"; break; + + case Sun: + case IBM: + case Motorola: + case HP: + case UnknownManufacturer: default: this->ChipID.ProcessorName = "Unknown family"; // We cannot identify the processor. return false; diff --git a/testHashSTL.cxx b/testHashSTL.cxx index b861a5b32..ac5cf74f5 100644 --- a/testHashSTL.cxx +++ b/testHashSTL.cxx @@ -34,7 +34,7 @@ template class kwsys::hash_map; template class kwsys::hash_set; -bool test_hash_map() +static bool test_hash_map() { typedef kwsys::hash_map mtype; mtype m; @@ -51,7 +51,7 @@ bool test_hash_map() return sum == 3; } -bool test_hash_set() +static bool test_hash_set() { typedef kwsys::hash_set stype; stype s; From 394514135ee0c970f1f28770db8642515fd31891 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sat, 14 Mar 2015 22:10:04 +0100 Subject: [PATCH 0317/1029] FPHSA: Revise documented command signature For mode 2 the first argument is not the literal NAME but the package name. Signed-off-by: Gregor Jasny --- Modules/FindPackageHandleStandardArgs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 2de1fb373..bcbd17d8a 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -33,7 +33,7 @@ # # :: # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( # [FOUND_VAR ] # [REQUIRED_VARS ...] # [VERSION_VAR ] From 54a5cdbb4c35aa8847d3eb0f7f418fad72563992 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Feb 2015 09:35:50 -0500 Subject: [PATCH 0318/1029] Tests: Compute Xcode version for any generator on OS X Store the version in CMake_TEST_XCODE_VERSION for use by tests that work with any generator on OS X but may depend on the Xcode version providing the tools. --- Tests/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 40bea5117..765fc804c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -172,6 +172,7 @@ if(BUILD_TESTING) ON) mark_as_advanced(CTEST_TEST_CPACK) set(CTEST_TEST_OSX_ARCH 0) + set(CMake_TEST_XCODE_VERSION 0) if(APPLE) execute_process( COMMAND sw_vers -productVersion @@ -185,6 +186,17 @@ if(BUILD_TESTING) else() set(CTEST_TEST_OSX_ARCH 1) endif() + if(XCODE_VERSION) + set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}") + else() + execute_process( + COMMAND xcodebuild -version + OUTPUT_VARIABLE _version ERROR_VARIABLE _version + ) + if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)") + set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}") + endif() + endif() endif() # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value, From 80afe28a1084d02dc3e010c7a0cabf5258237ddc Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Mar 2015 12:51:28 -0400 Subject: [PATCH 0319/1029] Ninja: Do not generate circular phony rules (#15454) The phony rules added by commit v2.8.12~248^2 (Ninja: Custom Command file depends don't need to exist before building, 2013-06-07) are circular, e.g. build side-effect: phony side-effect This is not diagnosed by Ninja as of version 1.5, but the dependency does not make sense. Simply drop it and use phony rules of the form build side-effect: phony instead. Reported-by: Daniel Dunbar --- Source/cmGlobalNinjaGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 69b1a9dc0..ac7a6ebfd 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1069,7 +1069,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) this->WritePhonyBuild(os, "", deps, - deps); + cmNinjaDeps()); } } } From 82a37d3ce5606f578997304cefc6aded15f2535c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Mar 2015 16:15:01 -0400 Subject: [PATCH 0320/1029] cmGlobalNinjaGenerator: Drop unused member --- Source/cmGlobalNinjaGenerator.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index c7bb7825e..3f6af6c20 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -381,8 +381,6 @@ private: typedef std::map TargetAliasMap; TargetAliasMap TargetAliases; - static cmLocalGenerator* LocalGenerator; - static bool UsingMinGW; }; From 486e9f4f49646cf48915781a411edfe9d9ea7618 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 19 Mar 2015 00:01:03 -0400 Subject: [PATCH 0321/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0d92bcf60..7d81aa911 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150318) +set(CMake_VERSION_PATCH 20150319) #set(CMake_VERSION_RC 1) From 13807bcb414c67cf8ee3f8b203fe30b472239072 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 18 Mar 2015 23:40:12 -0700 Subject: [PATCH 0322/1029] BlueGene/Q Platform files - based on the BlueGene/P platform files. - tested by Todd Gamblin (LLNL) and David DeMarle (Kitware) --- Modules/Platform/BlueGeneQ-base.cmake | 177 ++++++++++++++++++ .../Platform/BlueGeneQ-dynamic-GNU-C.cmake | 16 ++ .../Platform/BlueGeneQ-dynamic-GNU-CXX.cmake | 16 ++ .../BlueGeneQ-dynamic-GNU-Fortran.cmake | 16 ++ Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake | 16 ++ .../Platform/BlueGeneQ-dynamic-XL-CXX.cmake | 16 ++ .../BlueGeneQ-dynamic-XL-Fortran.cmake | 16 ++ Modules/Platform/BlueGeneQ-dynamic.cmake | 17 ++ Modules/Platform/BlueGeneQ-static-GNU-C.cmake | 16 ++ .../Platform/BlueGeneQ-static-GNU-CXX.cmake | 16 ++ .../BlueGeneQ-static-GNU-Fortran.cmake | 16 ++ Modules/Platform/BlueGeneQ-static-XL-C.cmake | 16 ++ .../Platform/BlueGeneQ-static-XL-CXX.cmake | 16 ++ .../BlueGeneQ-static-XL-Fortran.cmake | 16 ++ Modules/Platform/BlueGeneQ-static.cmake | 17 ++ 15 files changed, 403 insertions(+) create mode 100644 Modules/Platform/BlueGeneQ-base.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake create mode 100644 Modules/Platform/BlueGeneQ-dynamic.cmake create mode 100644 Modules/Platform/BlueGeneQ-static-GNU-C.cmake create mode 100644 Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake create mode 100644 Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake create mode 100644 Modules/Platform/BlueGeneQ-static-XL-C.cmake create mode 100644 Modules/Platform/BlueGeneQ-static-XL-CXX.cmake create mode 100644 Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake create mode 100644 Modules/Platform/BlueGeneQ-static.cmake diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake new file mode 100644 index 000000000..fa8dc521b --- /dev/null +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -0,0 +1,177 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# +# Blue Gene/Q base platform file. +# +# NOTE: Do not set your platform to "BlueGeneQ-base". This file is +# included by the real platform files. Use one of these two platforms +# instead: +# +# BlueGeneQ-dynamic For dynamically linked executables +# BlueGeneQ-static For statically linked executables +# +# The platform you choose doesn't affect whether or not you can build +# shared or static libraries -- it ONLY changs whether exeuatbles are linked +# statically or dynamically. +# +# This platform file tries its best to adhere to the behavior of the MPI +# compiler wrappers included with the latest BG/P drivers. +# + +# +# This adds directories that find commands should specifically ignore +# for cross compiles. Most of these directories are the includeand +# lib directories for the frontend on BG/P systems. Not ignoring +# these can cause things like FindX11 to find a frontend PPC version +# mistakenly. We use this on BG instead of re-rooting because backend +# libraries are typically strewn about the filesystem, and we can't +# re-root ALL backend libraries to a single place. +# +set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 /include + /usr/lib /usr/lib64 /usr/include + /usr/local/lib /usr/local/lib64 /usr/local/include + /usr/X11/lib /usr/X11/lib64 /usr/X11/include + /usr/lib/X11 /usr/lib64/X11 /usr/include/X11 + /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include + /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include +) + +# +# Indicate that this is a unix-like system +# +set(UNIX 1) + +# +# Library prefixes, suffixes, extra libs. +# +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe + +set(CMAKE_DL_LIBS "dl") + +# +# BG/Q supports dynamic libraries regardless of whether we're building +# static or dynamic *executables*. +# +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") + +# +# For BGQ builds, we're cross compiling, but we don't want to re-root things +# (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on +# the shared filesystems, and this may lie outside the root. Instead, we set the +# system directories so that the various system BG CNK library locations are +# searched first. This is not the clearest thing in the world, given IBM's driver +# layout, but this should cover all the standard ones. +# +macro(__BlueGeneQ_common_setup compiler_id lang) + # Need to use the version of the comm lib compiled with the right compiler. + set(__BlueGeneQ_commlib_dir gcc) + if (${compiler_id} STREQUAL XL) + set(__BlueGeneQ_commlib_dir xl) + endif() + + set(CMAKE_SYSTEM_LIBRARY_PATH + /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers) + /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/lib # PAMI, other lower-level comm libraries + /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory + /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc. + ) + + # Add all the system include paths. + set(CMAKE_SYSTEM_INCLUDE_PATH + /bgsys/drivers/ppcfloor/comm/sys/include + /bgsys/drivers/ppcfloor/ + /bgsys/drivers/ppcfloor/spi/include + /bgsys/drivers/ppcfloor/spi/include/kernel/cnk + /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/include + ) + + # Ensure that the system directories are included with the regular compilers, as users will expect this + # to do the same thing as the MPI compilers, which add these flags. + set(BGQ_SYSTEM_INCLUDES "") + foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) + set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") + endforeach() + set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + + # + # Code below does setup for shared libraries. That this is done + # regardless of whether the platform is static or dynamic -- you can make + # shared libraries even if you intend to make static executables, you just + # can't make a dynamic executable if you use the static platform file. + # + if (${compiler_id} STREQUAL XL) + # Flags for XL compilers if we explicitly detected XL + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink") + else() + # Assume flags for GNU compilers (if the ID is GNU *or* anything else). + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + endif() + + # Both toolchains use the GNU linker on BG/P, so these options are shared. + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG "-Wl,-rpath-link,") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-soname,") + set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-dynamic") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty + +endmacro() + +# +# This macro needs to be called for dynamic library support. Unfortunately on BG, +# We can't support both static and dynamic links in the same platform file. The +# dynamic link platform file needs to call this explicitly to set up dynamic linking. +# +macro(__BlueGeneQ_setup_dynamic compiler_id lang) + __BlueGeneQ_common_setup(${compiler_id} ${lang}) + + if (${compiler_id} STREQUAL XL) + set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc") + else() + set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-dynamic") + endif() + + # For dynamic executables, need to provide special BG/Q arguments. + set(BGQ_${lang}_DEFAULT_EXE_FLAGS + " -o ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -Wl,-relax ${BGQ_${lang}_DYNAMIC_EXE_FLAGS} ${BGQ_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() + +# +# This macro needs to be called for static builds. Right now it just adds -Wl,-relax +# to the link line. +# +macro(__BlueGeneQ_setup_static compiler_id lang) + __BlueGeneQ_common_setup(${compiler_id} ${lang}) + + # For static executables, use default link settings. + set(BGQ_${lang}_DEFAULT_EXE_FLAGS + " -o ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -Wl,-relax ${BGQ_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake new file mode 100644 index 000000000..102ac80ee --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(GNU C) diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake new file mode 100644 index 000000000..cd8ab246f --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(GNU CXX) diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake new file mode 100644 index 000000000..c029f0fb2 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(GNU Fortran) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake new file mode 100644 index 000000000..0077313d4 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(XL C) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake new file mode 100644 index 000000000..0f43cb256 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(XL CXX) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake new file mode 100644 index 000000000..12e446e11 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(XL Fortran) diff --git a/Modules/Platform/BlueGeneQ-dynamic.cmake b/Modules/Platform/BlueGeneQ-dynamic.cmake new file mode 100644 index 000000000..02839003f --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneQ-base) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") diff --git a/Modules/Platform/BlueGeneQ-static-GNU-C.cmake b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake new file mode 100644 index 000000000..70c84bace --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(GNU C) diff --git a/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake new file mode 100644 index 000000000..8f991de11 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(GNU CXX) diff --git a/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake new file mode 100644 index 000000000..24dd9e755 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(GNU Fortran) diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake new file mode 100644 index 000000000..5555a6875 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(XL C) diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake new file mode 100644 index 000000000..07c3c3d11 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(XL CXX) diff --git a/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake new file mode 100644 index 000000000..6f99933cb --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(XL Fortran) diff --git a/Modules/Platform/BlueGeneQ-static.cmake b/Modules/Platform/BlueGeneQ-static.cmake new file mode 100644 index 000000000..30b530d89 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneQ-base) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") From a066f73263c8c56f968324e51daee717291b3908 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 20 Mar 2015 00:01:03 -0400 Subject: [PATCH 0323/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7d81aa911..81274646e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150319) +set(CMake_VERSION_PATCH 20150320) #set(CMake_VERSION_RC 1) From 2aaf4f60810a86d62927a915e9286e4c2be9c53a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Mar 2015 09:35:59 -0400 Subject: [PATCH 0324/1029] Help: Add notes for topic 'mingw-compile-features' --- Help/release/dev/mingw-compile-features.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/mingw-compile-features.rst diff --git a/Help/release/dev/mingw-compile-features.rst b/Help/release/dev/mingw-compile-features.rst new file mode 100644 index 000000000..e2ed30b1e --- /dev/null +++ b/Help/release/dev/mingw-compile-features.rst @@ -0,0 +1,6 @@ +mingw-compile-features +---------------------- + +* The :manual:`Compile Features ` functionality + is now aware of features supported by GNU compilers on Windows, versions + 4.4 through 5.0. From a2c068a7ce47ab5934735b9f9168dda9760646ec Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Tue, 17 Mar 2015 23:34:03 +0100 Subject: [PATCH 0325/1029] file: Teach GLOB to list directories optionally GLOB lists directories by default and GLOB_RECURSE does not. LIST_DIRECTORIES enables user to control the behavior explicitly for consistently for both GLOB and GLOB_RECURSE. --- Help/command/file.rst | 17 ++++- Source/cmFileCommand.cxx | 62 ++++++++++++++++++- ...B-error-LIST_DIRECTORIES-no-arg-result.txt | 1 + ...B-error-LIST_DIRECTORIES-no-arg-stderr.txt | 1 + .../GLOB-error-LIST_DIRECTORIES-no-arg.cmake | 1 + ...or-LIST_DIRECTORIES-not-boolean-result.txt | 1 + ...or-LIST_DIRECTORIES-not-boolean-stderr.txt | 1 + ...B-error-LIST_DIRECTORIES-not-boolean.cmake | 1 + Tests/RunCMake/file/GLOB-stderr.txt | 6 ++ Tests/RunCMake/file/GLOB.cmake | 28 +++++++++ .../GLOB_RECURSE-cyclic-recursion-stderr.txt | 15 +++++ .../file/GLOB_RECURSE-cyclic-recursion.cmake | 23 +++++++ Tests/RunCMake/file/GLOB_RECURSE-stderr.txt | 6 ++ Tests/RunCMake/file/GLOB_RECURSE.cmake | 28 +++++++++ Tests/RunCMake/file/RunCMakeTest.cmake | 10 +++ 15 files changed, 195 insertions(+), 6 deletions(-) create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake create mode 100644 Tests/RunCMake/file/GLOB-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB.cmake create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE.cmake diff --git a/Help/command/file.rst b/Help/command/file.rst index 73d4cfa79..2fe741490 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -92,9 +92,12 @@ store it in a ````. :: - file(GLOB [RELATIVE ] [...]) - file(GLOB_RECURSE [RELATIVE ] - [FOLLOW_SYMLINKS] [...]) + file(GLOB + [LIST_DIRECTORIES true|false] [RELATIVE ] + [...]) + file(GLOB_RECURSE [FOLLOW_SYMLINKS] + [LIST_DIRECTORIES true|false] [RELATIVE ] + [...]) Generate a list of files that match the ```` and store it into the ````. Globbing expressions are similar to @@ -102,6 +105,9 @@ regular expressions, but much simpler. If ``RELATIVE`` flag is specified, the results will be returned as relative paths to the given path. +By default ``GLOB`` lists directories - directories are omited in result if +``LIST_DIRECTORIES`` is set to false. + .. note:: We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is @@ -119,6 +125,11 @@ matched directory and match the files. Subdirectories that are symlinks are only traversed if ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to ``NEW``. +By default ``GLOB_RECURSE`` omits directories from result list - setting +``LIST_DIRECTORIES`` to true adds directories to result list. +If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to +``OLD`` then ``LIST_DIRECTORIES`` treats symlinks as directories. + Examples of recursive globbing include:: /dir/*.py - match all python files in /dir and subdirectories diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index ec22ea0a5..ae9099e93 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -920,6 +920,35 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, bool first = true; for ( ; i != args.end(); ++i ) { + if( *i == "LIST_DIRECTORIES" ) + { + ++i; + if(i != args.end()) + { + if(cmSystemTools::IsOn(i->c_str())) + { + g.SetListDirs(true); + g.SetRecurseListDirs(true); + } + else if(cmSystemTools::IsOff(i->c_str())) + { + g.SetListDirs(false); + g.SetRecurseListDirs(false); + } + else + { + this->SetError("LIST_DIRECTORIES missing bool value."); + return false; + } + } + else + { + this->SetError("LIST_DIRECTORIES missing bool value."); + return false; + } + ++i; + } + if ( recurse && (*i == "FOLLOW_SYMLINKS") ) { explicitFollowSymlinks = true; @@ -950,6 +979,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } } + cmsys::Glob::GlobMessages globMessages; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { std::string expr = this->Makefile->GetCurrentDirectory(); @@ -957,16 +987,42 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, if (!expr.empty()) { expr += "/" + *i; - g.FindFiles(expr); + g.FindFiles(expr, &globMessages); } else { - g.FindFiles(*i); + g.FindFiles(*i, &globMessages); } } else { - g.FindFiles(*i); + g.FindFiles(*i, &globMessages); + } + + if(!globMessages.empty()) + { + bool shouldExit = false; + for(cmsys::Glob::GlobMessagesIterator it=globMessages.begin(); + it != globMessages.end(); ++it) + { + if(it->type == cmsys::Glob::cyclicRecursion) + { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + "Cyclic recursion detected while globbing for '" + + *i + "':\n" + it->content); + } + else + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "Error has occured while globbing for '" + + *i + "' - " + it->content); + shouldExit = true; + } + } + if(shouldExit) + { + return false; + } } std::vector::size_type cc; diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt new file mode 100644 index 000000000..9629cfd68 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake new file mode 100644 index 000000000..a8e15f23e --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES) diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt new file mode 100644 index 000000000..9629cfd68 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake new file mode 100644 index 000000000..f73543398 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES 13) diff --git a/Tests/RunCMake/file/GLOB-stderr.txt b/Tests/RunCMake/file/GLOB-stderr.txt new file mode 100644 index 000000000..c47dc4097 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-stderr.txt @@ -0,0 +1,6 @@ +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 2[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 2/dir 2 file diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake new file mode 100644 index 000000000..3d577e3a0 --- /dev/null +++ b/Tests/RunCMake/file/GLOB.cmake @@ -0,0 +1,28 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt new file mode 100644 index 000000000..f73aa834e --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt @@ -0,0 +1,15 @@ +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 11[ ] +.*/test/abc;.*/test/depth1;.*/test/depth1/depth2;.*/test/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1;.*/test/depth1/depth2/depth3/recursion/depth1/depth2;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake new file mode 100644 index 000000000..a8c67849f --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake @@ -0,0 +1,23 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/recursion") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "message to write") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/file_symlink") + +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt new file mode 100644 index 000000000..5d48e4730 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt @@ -0,0 +1,6 @@ +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 8[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir;.*/test/dir 2/non_empty_dir/dir 2 subdir file diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake new file mode 100644 index 000000000..6db377b41 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake @@ -0,0 +1,28 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 14819e721..d3dfb1b7c 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -17,3 +17,13 @@ run_cmake(LOCK-error-no-result-variable) run_cmake(LOCK-error-no-timeout) run_cmake(LOCK-error-timeout) run_cmake(LOCK-error-unknown-option) +run_cmake(GLOB) +run_cmake(GLOB_RECURSE) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) + +if(NOT WIN32 OR CYGWIN) + run_cmake(GLOB_RECURSE-cyclic-recursion) +endif() From 6e54b0b91032d858ae33b3cb093b5e4c9e15970e Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Mar 2015 09:43:37 -0400 Subject: [PATCH 0326/1029] Help: Add notes for topic 'file-globbing-directory-listing' --- Help/release/dev/file-globbing-directory-listing.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/file-globbing-directory-listing.rst diff --git a/Help/release/dev/file-globbing-directory-listing.rst b/Help/release/dev/file-globbing-directory-listing.rst new file mode 100644 index 000000000..c4d7ba500 --- /dev/null +++ b/Help/release/dev/file-globbing-directory-listing.rst @@ -0,0 +1,6 @@ +file-globbing-directory-listing +------------------------------- + +* The :command:`file(GLOB)` and :command:`file(GLOB_RECURSE)` commands + learned a new ``LIST_DIRECTORIES `` option to specify whether + the glob result should include directories. From f85db2f32358e6de921aba7d1cb8ecb81da934c0 Mon Sep 17 00:00:00 2001 From: Stanislav Ionascu Date: Sun, 8 Feb 2015 13:50:16 +0100 Subject: [PATCH 0327/1029] Qbs: Add new 'extra' generator for qbs project files --- Help/generator/Qbs.rst | 25 ++ Help/manual/cmake-generators.7.rst | 1 + Help/release/dev/add-extra-qbs-generator.rst | 6 + Source/CMakeLists.txt | 2 + Source/cmExtraQbsGenerator.cxx | 260 +++++++++++++++++++ Source/cmExtraQbsGenerator.h | 48 ++++ Source/cmake.cxx | 4 + Tests/CMakeLists.txt | 16 +- 8 files changed, 361 insertions(+), 1 deletion(-) create mode 100644 Help/generator/Qbs.rst create mode 100644 Help/release/dev/add-extra-qbs-generator.rst create mode 100644 Source/cmExtraQbsGenerator.cxx create mode 100644 Source/cmExtraQbsGenerator.h diff --git a/Help/generator/Qbs.rst b/Help/generator/Qbs.rst new file mode 100644 index 000000000..e569b7730 --- /dev/null +++ b/Help/generator/Qbs.rst @@ -0,0 +1,25 @@ +Qbs +--- + +Generates Qbs project files. + +Project files for Qbs will be created in the top directory and +in every subdirectory which features a CMakeLists.txt file containing +a PROJECT() call. Additionally a hierarchy of makefiles is generated +into the build tree. The appropriate make program can build the +project through the default make target. A "make install" target is +also provided. + +This "extra" generator may be specified as: + +``Qbs - MinGW Makefiles`` + Generate with :generator:`MinGW Makefiles`. + +``Qbs - NMake Makefiles`` + Generate with :generator:`NMake Makefiles`. + +``Qbs - Ninja`` + Generate with :generator:`Ninja`. + +``Qbs - Unix Makefiles`` + Generate with :generator:`Unix Makefiles`. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index bda7eefe3..804229b22 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -85,3 +85,4 @@ The following extra generators are known to CMake. /generator/KDevelop3 /generator/Kate /generator/Sublime Text 2 + /generator/Qbs diff --git a/Help/release/dev/add-extra-qbs-generator.rst b/Help/release/dev/add-extra-qbs-generator.rst new file mode 100644 index 000000000..edb441f34 --- /dev/null +++ b/Help/release/dev/add-extra-qbs-generator.rst @@ -0,0 +1,6 @@ +add-extra-qbs-geneator +---------------------- + +* It is now possible to generate :generator:`Qbs` project files + for use with QtCreator IDE, matching make tool must be used + to build the project through the generated makefiles. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 482bd39d6..04f6a8136 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -229,6 +229,8 @@ set(SRCS cmExtraKateGenerator.h cmExtraSublimeTextGenerator.cxx cmExtraSublimeTextGenerator.h + cmExtraQbsGenerator.cxx + cmExtraQbsGenerator.h cmFileLock.cxx cmFileLock.h cmFileLockPool.cxx diff --git a/Source/cmExtraQbsGenerator.cxx b/Source/cmExtraQbsGenerator.cxx new file mode 100644 index 000000000..5a1f9ef57 --- /dev/null +++ b/Source/cmExtraQbsGenerator.cxx @@ -0,0 +1,260 @@ +#include "cmExtraQbsGenerator.h" + +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmGeneratedFileStream.h" +#include "cmSourceFile.h" + +cmExtraQbsGenerator::cmExtraQbsGenerator() +{ +#if defined(_WIN32) + this->SupportedGlobalGenerators.push_back("MinGW Makefiles"); + this->SupportedGlobalGenerators.push_back("NMake Makefiles"); +#endif + this->SupportedGlobalGenerators.push_back("Ninja"); + this->SupportedGlobalGenerators.push_back("Unix Makefiles"); +} + +cmExtraQbsGenerator::~cmExtraQbsGenerator() {} + +void cmExtraQbsGenerator::GetDocumentation(cmDocumentationEntry &entry, + const std::string &) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Qbs project files."; +} + +void cmExtraQbsGenerator::Generate() +{ + for (std::map >::const_iterator + it = this->GlobalGenerator->GetProjectMap().begin(); + it != this->GlobalGenerator->GetProjectMap().end(); ++it) + { + // create a project file + this->CreateProjectFile(it->first, it->second); + } +} + +void cmExtraQbsGenerator::CreateProjectFile( + const std::string &name, + const std::vector &lgs) +{ + const cmMakefile *mf = lgs[0]->GetMakefile(); + std::string outputDir = mf->GetStartOutputDirectory(); + + const std::string filename = outputDir + "/" + name + ".qbs"; + + this->CreateNewProjectFile(name, lgs, filename); +} + +void cmExtraQbsGenerator::CreateNewProjectFile( + const std::string &projectName, const std::vector &lgs, + const std::string &filename) +{ + cmGeneratedFileStream fout(filename.c_str()); + if (!fout) + { + return; + } + + fout << "import qbs\n" + << "import qbs.File\n\n" + << "Project {\n" + << "\tname:\"" << projectName << "\"\n"; + std::vector::const_iterator itr = lgs.begin(); + for (; itr != lgs.end(); ++itr) + { + cmLocalGenerator *lg = (*itr); + this->AppendSubProject(fout, lg); + } + fout << "}\n"; +} + +void cmExtraQbsGenerator::AppendSubProject(cmGeneratedFileStream &fout, + cmLocalGenerator *lg) +{ + const cmMakefile *mk = lg->GetMakefile(); + if (!mk || mk->GetTargets().size() == 0) + { + return; + } + + const std::string &relativePath = cmSystemTools::RelativePath( + mk->GetHomeDirectory(), mk->GetCurrentDirectory()); + fout << "\tProject {\n" + << "\t\tname:\"" << relativePath << "\"\n"; + this->AppendProduct(fout, lg); + fout << "\t}\n"; +} + +void cmExtraQbsGenerator::AppendProduct(cmGeneratedFileStream &fout, + cmLocalGenerator *lg) +{ + const cmMakefile *mk = lg->GetMakefile(); + const cmTargets &ts = mk->GetTargets(); + std::string cfg = mk->GetSafeDefinition("CMAKE_BUILD_TYPE"); + cmTargets::const_iterator itr = ts.begin(); + for (; itr != ts.end(); ++itr) + { + const cmTarget &t = itr->second; + this->AppendTarget(fout, lg, t, cfg); + } +} + +void cmExtraQbsGenerator::AppendTarget(cmGeneratedFileStream &fout, + cmLocalGenerator *lg, const cmTarget &t, + const std::string &cfg) +{ + std::string type; + bool isBuildable = true; + switch (t.GetType()) + { + case cmTarget::EXECUTABLE: + type = "application"; + break; + case cmTarget::SHARED_LIBRARY: + type = "dynamiclibrary"; + break; + case cmTarget::STATIC_LIBRARY: + type = "staticlibrary"; + break; + default: + isBuildable = false; + break; + } + + if (type.empty()) + { + fout << "\t\tProject {\n"; + } + else + { + fout << "\t\tProduct {\n"; + fout << "\t\t\tdestinationDirectory: \"" << t.GetDirectory(cfg) << "\"\n"; + } + fout << "\t\t\tname:\"" << t.GetName() << "\"\n"; + + if (!type.empty()) + { + fout << "\t\t\ttype: \"" << type << "\"\n"; + fout << "\t\t\ttargetName: \"" << t.GetName() << "\"\n"; + } + + if (isBuildable) + { + fout << "\t\t\tDepends { name: \"cpp\" }\n"; + cmGeneratorTarget *gt = this->GlobalGenerator->GetGeneratorTarget(&t); + this->AppendSources(fout, gt, t, cfg); + + std::set langs, incPaths, defs; + t.GetLanguages(langs, cfg); + for (std::set::const_iterator lang = langs.begin(); + lang != langs.end(); + ++ lang) + { + const std::vector &paths = + gt->GetIncludeDirectories(cfg, *lang); + std::copy(paths.begin(), paths.end(), + std::inserter(incPaths, incPaths.end())); + + lg->AddCompileDefinitions(defs, &t, cfg, *lang); + } + this->AppendIncludePaths(fout, incPaths); + this->AppendCompileDefinitions(fout, defs); + } + + fout << "\t\t}\n"; +} + +void cmExtraQbsGenerator::AppendSources(cmGeneratedFileStream &fout, + cmGeneratorTarget *gt, + const cmTarget &t, + const std::string &cfg) +{ + std::vector sources; + gt->GetSourceFiles(sources, cfg); + if (sources.empty()) + { + return; + } + + std::vector genSources; + std::vector::const_iterator itr = sources.begin(); + fout << "\t\t\tfiles: [\n" + << "\t\t\t\t\"" << t.GetMakefile()->GetCurrentListFile() << "\",\n"; + for (; itr != sources.end(); ++itr) + { + if (!(*itr)->GetPropertyAsBool("GENERATED")) + { + fout << "\t\t\t\t\"" << (*itr)->GetFullPath() << "\",\n"; + } + else + { + genSources.push_back(*itr); + } + } + fout << "\t\t\t]\n"; + + if (!genSources.empty()) + { + fout << "\t\t\tGroup {\n" + << "\t\t\t\tname:\"Generated\"\n" + << "\t\t\t\tfiles: [\n"; + itr = genSources.begin(); + std::string groupCondition; + bool initialCondition = true; + for (; itr != genSources.end(); ++itr) + { + const std::string &path = (*itr)->GetFullPath(); + fout << "\t\t\t\t\t\"" << path << "\",\n"; + if (initialCondition) + { + initialCondition = false; + } + else + { + groupCondition += "\t\t\t\t\t && "; + } + groupCondition += "File.exists(\"" + path + "\")\n"; + } + fout << "\t\t\t\t]\n" + << "\t\t\t\tcondition: " << groupCondition << "\t\t\t}\n"; + } +} + +void cmExtraQbsGenerator::AppendIncludePaths( + cmGeneratedFileStream &fout, + const std::set &paths) +{ + if (paths.empty()) + { + return; + } + + std::set::const_iterator itr = paths.begin(); + fout << "\t\t\tcpp.includePaths: [\n"; + for (; itr != paths.end(); ++ itr) + { + fout << "\t\t\t\t\"" << (*itr) << "\",\n"; + } + fout << "\t\t\t]\n"; +} + +void cmExtraQbsGenerator::AppendCompileDefinitions( + cmGeneratedFileStream &fout, + const std::set &defs) +{ + if (defs.empty()) + { + return; + } + + std::set::const_iterator itr = defs.begin(); + fout << "\t\t\tcpp.defines: [\n"; + for (; itr != defs.end(); ++ itr) + { + fout << "\t\t\t\t'" << (*itr) << "',\n"; + } + fout << "\t\t\t]\n"; +} diff --git a/Source/cmExtraQbsGenerator.h b/Source/cmExtraQbsGenerator.h new file mode 100644 index 000000000..531ccc925 --- /dev/null +++ b/Source/cmExtraQbsGenerator.h @@ -0,0 +1,48 @@ +#ifndef CMEXTRAQBSGENERATOR_H +#define CMEXTRAQBSGENERATOR_H + +#include "cmExternalMakefileProjectGenerator.h" + +class cmGeneratorTarget; + +class cmExtraQbsGenerator : public cmExternalMakefileProjectGenerator +{ +public: + cmExtraQbsGenerator(); + ~cmExtraQbsGenerator(); + + virtual std::string GetName() const + { return cmExtraQbsGenerator::GetActualName(); } + static std::string GetActualName() { return "Qbs"; } + static cmExternalMakefileProjectGenerator *New() + { return new cmExtraQbsGenerator; } + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry &entry, + const std::string &fullName) const; + + virtual void Generate(); + +private: + void CreateProjectFile(const std::string &name, + const std::vector &lgs); + void CreateNewProjectFile(const std::string &projectName, + const std::vector &lgs, + const std::string &filename); + void AppendSubProject(cmGeneratedFileStream &fout, cmLocalGenerator *lg); + void AppendProduct(cmGeneratedFileStream &fout, cmLocalGenerator *lg); + void AppendTarget(cmGeneratedFileStream &fout, + cmLocalGenerator *lg, + const cmTarget &t, + const std::string &cfg); + void AppendSources(cmGeneratedFileStream &fout, + cmGeneratorTarget *gt, + const cmTarget &t, + const std::string &cfg); + void AppendIncludePaths(cmGeneratedFileStream &fout, + const std::set &paths); + void AppendCompileDefinitions(cmGeneratedFileStream &fout, + const std::set &defs); +}; + +#endif // CMEXTRAQBSGENERATOR_H diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 11196e422..51df7f2f5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -86,6 +86,8 @@ # include "cmGlobalKdevelopGenerator.h" #endif +#include "cmExtraQbsGenerator.h" + #ifdef CMAKE_USE_ECLIPSE # include "cmExtraEclipseCDT4Generator.h" #endif @@ -1029,6 +1031,8 @@ void cmake::AddDefaultExtraGenerators() &cmExtraSublimeTextGenerator::New); this->AddExtraGenerator(cmExtraKateGenerator::GetActualName(), &cmExtraKateGenerator::New); + this->AddExtraGenerator(cmExtraQbsGenerator::GetActualName(), + &cmExtraQbsGenerator::New); #ifdef CMAKE_USE_ECLIPSE this->AddExtraGenerator(cmExtraEclipseCDT4Generator::GetActualName(), diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 40bea5117..5fa7044ce 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -560,7 +560,21 @@ if(BUILD_TESTING) --test-command Simple) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator") endif () - + # check for the Qbs generator + if ("${cmakeOutput}" MATCHES Qbs) + add_test(Simple_QbsGenerator ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Simple" + "${CMake_BINARY_DIR}/Tests/Simple_QbsGenerator" + --build-two-config + --build-generator "Qbs - Unix Makefiles" + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-project Simple + --build-options ${build_options} + --test-command Simple) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_QbsGenerator") + endif () endif() # test for correct sub-project generation From 610464c12e0ef71b2bea28973b70630c4ce9a70e Mon Sep 17 00:00:00 2001 From: Justin Borodinsky Date: Wed, 18 Mar 2015 20:30:26 -0500 Subject: [PATCH 0328/1029] QtAutogen: Ensure write access to AutogenInfo.cmake (#15416) ConfigureFile uses the input file permissions, but we require write access in cmQtAutoGenerators::SetupAutoGenerateTarget to append to the file. --- Source/cmQtAutoGenerators.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 42c18f7da..08092c744 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -22,6 +22,8 @@ # include "cmLocalVisualStudioGenerator.h" #endif +#include + #include #include #include @@ -582,6 +584,18 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); + // Ensure we have write permission in case .in was read-only. + mode_t perm = 0; +#if defined(WIN32) && !defined(__CYGWIN__) + mode_t mode_write = S_IWRITE; +#else + mode_t mode_write = S_IWUSR; +#endif + cmSystemTools::GetPermissions(outputFile, perm); + if (!(perm & mode_write)) + { + cmSystemTools::SetPermissions(outputFile, perm | mode_write); + } if (!configDefines.empty() || !configIncludes.empty() || !configUicOptions.empty()) From a21e8df0da0d43f8c678d4c07f731035d04c0e27 Mon Sep 17 00:00:00 2001 From: Mark Studenka Date: Thu, 19 Mar 2015 10:55:00 -0400 Subject: [PATCH 0329/1029] UseJava: Fix add_jar argument parsing (#14655) Since commit v2.8.11~63^2 (UseJava.cmake: require explicit request to include jars, 2013-03-26) the argument parsing always overrides the variable settings even if the corresponding arguments are not passed. Re-order logic to fix this. --- Modules/UseJava.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 3a6acd862..5eb0ca8c1 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -340,6 +340,13 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) function(add_jar _TARGET_NAME) + cmake_parse_arguments(_add_jar + "" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" + "SOURCES;INCLUDE_JARS" + ${ARGN} + ) + # In CMake < 2.8.12, add_jar used variables which were set prior to calling # add_jar for customizing the behavior of add_jar. In order to be backwards # compatible, check if any of those variables are set, and use them to @@ -347,28 +354,21 @@ function(add_jar _TARGET_NAME) # argument will override the value set here.) # # New features should use named arguments only. - if(DEFINED CMAKE_JAVA_TARGET_VERSION) + if(NOT DEFINED _add_jar_VERSION AND DEFINED CMAKE_JAVA_TARGET_VERSION) set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}") endif() - if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + if(NOT DEFINED _add_jar_OUTPUT_DIR AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}") endif() - if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) + if(NOT DEFINED _add_jar_OUTPUT_NAME AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}") # reset set(CMAKE_JAVA_TARGET_OUTPUT_NAME) endif() - if(DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) + if(NOT DEFINED _add_jar_ENTRY_POINT AND DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}") endif() - cmake_parse_arguments(_add_jar - "" - "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" - "SOURCES;INCLUDE_JARS" - ${ARGN} - ) - set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS}) if (NOT DEFINED _add_jar_OUTPUT_DIR) From 00842df48d8d3585562b8d64d56cd6646dc9d3ff Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Mar 2015 12:59:54 -0400 Subject: [PATCH 0330/1029] PGI: Remove invalid -fPIE flag (#15460) The PGI compilers on Linux do not have the -fPIE flag. Remove the table entry added by commit v2.8.9~125^2~2 (Add platform variables for position independent code flags, 2012-05-05), which likely included it only as part of a sweeping introduction of such flags. --- Modules/Platform/Linux-PGI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake index 3cbb35c72..baa2248a5 100644 --- a/Modules/Platform/Linux-PGI.cmake +++ b/Modules/Platform/Linux-PGI.cmake @@ -21,7 +21,7 @@ set(__LINUX_COMPILER_PGI 1) macro(__linux_compiler_pgi lang) # Shared library compile and link flags. set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") - set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") endmacro() From 3556fb1b81fccac63600a2509f92e9ef738fed69 Mon Sep 17 00:00:00 2001 From: Steven Vancoillie Date: Fri, 20 Mar 2015 09:13:00 +0100 Subject: [PATCH 0331/1029] SunPro: Add position independent code flag for Fortran compiler --- Modules/Compiler/SunPro-Fortran.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index e4db1e878..196aae49a 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -2,6 +2,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") +set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-KPIC") set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") From ad094f435e005b484771acae36b79895c8e36e3f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Mar 2015 16:44:05 -0400 Subject: [PATCH 0332/1029] cmGlobalNinjaGenerator: Fix spelling of "unknown" --- Source/cmGlobalNinjaGenerator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ac7a6ebfd..128679363 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1041,21 +1041,21 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) //and knownDependencies so no matter if unix or windows paths they //should all match now. - std::vector unkownExplicitDepends; + std::vector unknownExplicitDepends; this->CombinedCustomCommandExplicitDependencies.erase("all"); std::set_difference(this->CombinedCustomCommandExplicitDependencies.begin(), this->CombinedCustomCommandExplicitDependencies.end(), knownDependencies.begin(), knownDependencies.end(), - std::back_inserter(unkownExplicitDepends)); + std::back_inserter(unknownExplicitDepends)); std::string const rootBuildDirectory = this->GetCMakeInstance()->GetHomeOutputDirectory(); for (std::vector::const_iterator - i = unkownExplicitDepends.begin(); - i != unkownExplicitDepends.end(); + i = unknownExplicitDepends.begin(); + i != unknownExplicitDepends.end(); ++i) { //verify the file is in the build directory From ed8e30b00d032594fbb67d62f8bd4319ae6e5907 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 18 Mar 2015 16:24:11 -0400 Subject: [PATCH 0333/1029] cmGlobalNinjaGenerator: Optimize handling of known build outputs Teach WriteUnknownExplicitDependencies to take ownership of the set of WriteBuild outputs immediately since no other methods need the data. This avoids re-inserting the whole set into another already populated set. --- Source/cmGlobalNinjaGenerator.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 128679363..6c612ab21 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -955,6 +955,13 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) { + // We need to collect the set of known build outputs. + // Start with those generated by WriteBuild calls. + // No other method needs this so we can take ownership + // of the set locally and throw it out when we are done. + std::set knownDependencies; + knownDependencies.swap(this->CombinedBuildOutputs); + //now write out the unknown explicit dependencies. //union the configured files, evaluations files and the CombinedBuildOutputs, @@ -971,7 +978,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) cmLocalNinjaGenerator *ng = static_cast(this->LocalGenerators[0]); - std::set knownDependencies; for (std::vector::const_iterator i = this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) { @@ -1026,15 +1032,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) knownDependencies.insert( ng->ConvertToNinjaPath(i->first) ); } - //insert outputs from all WirteBuild commands - //these paths have already be encoded when added to CombinedBuildOutputs - knownDependencies.insert(this->CombinedBuildOutputs.begin(), - this->CombinedBuildOutputs.end()); - - //after we have combined the data into knownDependencies we have no need - //to keep this data around - this->CombinedBuildOutputs.clear(); - //now we difference with CombinedCustomCommandExplicitDependencies to find //the list of items we know nothing about. //We have encoded all the paths in CombinedCustomCommandExplicitDependencies From 18917d66d4997786afcb27580518e325342117d2 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Fri, 20 Mar 2015 21:52:49 +0100 Subject: [PATCH 0334/1029] CPack/RPM ignore install prefix relocation path Patch adds possibility to remove CPACK_PACKAGING_INSTALL_PREFIX from the list of relocation paths when crating a relocatable rpm. --- Modules/CPackRPM.cmake | 21 +++++++++++++++++-- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 4 ++++ .../RunCPackVerifyResult.cmake | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 539a0aa66..162eba758 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -408,6 +408,16 @@ # # May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for # relocatable RPM packages. +# +# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION +# CPACK_RPM_NO__INSTALL_PREFIX_RELOCATION +# +# * Mandatory : NO +# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM__PACKAGE_PREFIX +# are treated as one of relocation paths +# +# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM__PACKAGE_PREFIX +# from relocatable RPM prefix paths. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -437,8 +447,15 @@ function(cpack_rpm_prepare_relocation_paths) # set base path prefix if(EXISTS "${WDIR}/${PATH_PREFIX}") - set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") - list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") + if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND + NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION) + set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") + list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: removing '${PATH_PREFIX}' from relocation paths") + endif() + endif() endif() # set other path prefixes diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 109bb1caa..ac9b55222 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -28,6 +28,10 @@ if(CPACK_GENERATOR MATCHES "RPM") # test package description override - headers rpm is generated in the middle set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") + + # test package do not use CPACK_PACKAGING_INSTALL_PREFIX + # as relocation path + set(CPACK_RPM_NO_libraries_INSTALL_PREFIX_RELOCATION true) endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 6762b45a2..cf4da745c 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -174,10 +174,10 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") + set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") From bd9c7f9b2c788f9bf69c2ce4eb93d27212a6dfaa Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Mar 2015 16:43:21 -0400 Subject: [PATCH 0335/1029] Ninja: Add policy to require explicit custom command byproducts Add policy CMP0058 to avoid generating 'phony' ninja rules for unknown custom command dependencies. This requires projects to specify their custom command byproducts explicitly. With this requirement we no longer have to assume that unknown custom command dependencies are generated and can instead simply assume they are source files expected to exist when the build starts. This is particularly important in in-source builds. It is also helpful for out-of-source builds to allow Ninja to diagnose missing files before running custom command rules that depend on them. --- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0058.rst | 108 ++++++++++++++++++ Help/release/dev/ninja-require-byproducts.rst | 9 ++ Source/cmGlobalNinjaGenerator.cxx | 61 +++++++++- Source/cmGlobalNinjaGenerator.h | 5 + Source/cmPolicies.cxx | 5 + Source/cmPolicies.h | 1 + Tests/RunCMake/CMakeLists.txt | 3 + .../Ninja/CMP0058-NEW-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake | 3 + .../Ninja/CMP0058-NEW-no-build-result.txt | 1 + .../Ninja/CMP0058-NEW-no-build-stderr.txt | 1 + Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake | 2 + .../Ninja/CMP0058-OLD-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake | 3 + .../Ninja/CMP0058-OLD-no-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake | 2 + .../Ninja/CMP0058-WARN-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake | 2 + .../Ninja/CMP0058-WARN-no-build-stdout.txt | 4 + .../RunCMake/Ninja/CMP0058-WARN-no-stderr.txt | 19 +++ Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake | 1 + Tests/RunCMake/Ninja/CMP0058-common.cmake | 17 +++ Tests/RunCMake/Ninja/CMakeLists.txt | 3 + Tests/RunCMake/Ninja/RunCMakeTest.cmake | 18 +++ 25 files changed, 279 insertions(+), 6 deletions(-) create mode 100644 Help/policy/CMP0058.rst create mode 100644 Help/release/dev/ninja-require-byproducts.rst create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-common.cmake create mode 100644 Tests/RunCMake/Ninja/CMakeLists.txt create mode 100644 Tests/RunCMake/Ninja/RunCMakeTest.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 76ca5d4ed..228df142b 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -115,3 +115,4 @@ All Policies /policy/CMP0055 /policy/CMP0056 /policy/CMP0057 + /policy/CMP0058 diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst new file mode 100644 index 000000000..0f2038337 --- /dev/null +++ b/Help/policy/CMP0058.rst @@ -0,0 +1,108 @@ +CMP0058 +------- + +Ninja requires custom command byproducts to be explicit. + +When an intermediate file generated during the build is consumed +by an expensive operation or a large tree of dependents, one may +reduce the work needed for an incremental rebuild by updating the +file timestamp only when its content changes. With this approach +the generation rule must have a separate output file that is always +updated with a new timestamp that is newer than any dependencies of +the rule so that the build tool re-runs the rule only when the input +changes. We refer to the separate output file as a rule's *witness* +and the generated file as a rule's *byproduct*. + +Byproducts may not be listed as outputs because their timestamps are +allowed to be older than the inputs. No build tools (like ``make``) +that existed when CMake was designed have a way to express byproducts. +Therefore CMake versions prior to 3.2 had no way to specify them. +Projects typically left byproducts undeclared in the rules that +generate them. For example: + +.. code-block:: cmake + + add_custom_command( + OUTPUT witness.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/input.txt + byproduct.txt # timestamp may not change + COMMAND ${CMAKE_COMMAND} -E touch witness.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input.txt + ) + add_custom_target(Provider DEPENDS witness.txt) + add_custom_command( + OUTPUT generated.c + COMMAND expensive-task -i byproduct.txt -o generated.c + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt + ) + add_library(Consumer generated.c) + add_dependencies(Consumer Provider) + +This works well for all generators except :generator:`Ninja`. +The Ninja build tool sees a rule listing ``byproduct.txt`` +as a dependency and no rule listing it as an output. Ninja then +complains that there is no way to satisfy the dependency and +stops building even though there are order-only dependencies +that ensure ``byproduct.txt`` will exist before its consumers +need it. See discussion of this problem in `Ninja Issue 760`_ +for further details on why Ninja works this way. + +.. _`Ninja Issue 760`: https://github.com/martine/ninja/issues/760 + +Instead of leaving byproducts undeclared in the rules that generate +them, Ninja expects byproducts to be listed along with other outputs. +Such rules may be marked with a ``restat`` option that tells Ninja +to check the timestamps of outputs after the rules run. This +prevents byproducts whose timestamps do not change from causing +their dependents to re-build unnecessarily. + +Since the above approach does not tell CMake what custom command +generates ``byproduct.txt``, the Ninja generator does not have +enough information to add the byproduct as an output of any rule. +CMake 2.8.12 and above work around this problem and allow projects +using the above approach to build by generating ``phony`` build +rules to tell Ninja to tolerate such missing files. However, this +workaround prevents Ninja from diagnosing a dependency that is +really missing. It also works poorly in in-source builds where +every custom command dependency, even on source files, needs to +be treated this way because CMake does not have enough information +to know which files are generated as byproducts of custom commands. + +CMake 3.2 introduced the ``BYPRODUCTS`` option to the +:command:`add_custom_command` and :command:`add_custom_target` +commands. This option allows byproducts to be specified explicitly: + +.. code-block:: cmake + + add_custom_command( + OUTPUT witness.txt + BYPRODUCTS byproduct.txt # explicit byproduct specification + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/input.txt + byproduct.txt # timestamp may not change + ... + +The ``BYPRODUCTS`` option is used by the :generator:`Ninja` generator +to list byproducts among the outputs of the custom commands that +generate them, and is ignored by other generators. + +CMake 3.3 and above prefer to require projects to specify custom +command byproducts explicitly so that it can avoid using the +``phony`` rule workaround altogether. Policy ``CMP0058`` was +introduced to provide compatibility with existing projects that +still need the workaround. + +This policy has no effect on generators other than :generator:`Ninja`. +The ``OLD`` behavior for this policy is to generate Ninja ``phony`` +rules for unknown dependencies in the build tree. The ``NEW`` +behavior for this policy is to not generate these and instead +require projects to specify custom command ``BYPRODUCTS`` explicitly. + +This policy was introduced in CMake version 3.3. +CMake version |release| warns when it sees unknown dependencies in +out-of-source build trees if the policy is not set and then uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set +the policy to ``OLD`` or ``NEW`` explicitly. The policy setting +must be in scope at the end of the top-level ``CMakeLists.txt`` +file of the project and has global effect. diff --git a/Help/release/dev/ninja-require-byproducts.rst b/Help/release/dev/ninja-require-byproducts.rst new file mode 100644 index 000000000..ccde4bc69 --- /dev/null +++ b/Help/release/dev/ninja-require-byproducts.rst @@ -0,0 +1,9 @@ +ninja-require-byproducts +------------------------ + +* The :generator:`Ninja` generator now requires that calls to the + :command:`add_custom_command` and :command:`add_custom_target` + commands use the ``BYPRODUCTS`` option to explicitly specify any + files generated by the custom commands that are not listed as + outputs (perhaps because their timestamps are allowed to be older + than the inputs). See policy :policy:`CMP0058`. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 6c612ab21..f74f1e065 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -17,6 +17,7 @@ #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" #include "cmVersion.h" +#include "cmAlgorithms.h" #include #include @@ -183,7 +184,10 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, i != outputs.end(); ++i) { build += " " + EncodeIdent(EncodePath(*i), os); - this->CombinedBuildOutputs.insert( EncodePath(*i) ); + if (this->ComputingUnknownDependencies) + { + this->CombinedBuildOutputs.insert( EncodePath(*i) ); + } } build += ":"; @@ -281,11 +285,14 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, orderOnly, vars); - //we need to track every dependency that comes in, since we are trying - //to find dependencies that are side effects of build commands - for(cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) + if (this->ComputingUnknownDependencies) { - this->CombinedCustomCommandExplicitDependencies.insert( EncodePath(*i) ); + //we need to track every dependency that comes in, since we are trying + //to find dependencies that are side effects of build commands + for(cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) + { + this->CombinedCustomCommandExplicitDependencies.insert(EncodePath(*i)); + } } } @@ -477,6 +484,8 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , CompileCommandsStream(0) , Rules() , AllDependencies() + , ComputingUnknownDependencies(false) + , PolicyCMP0058(cmPolicies::WARN) { // // Ninja is not ported to non-Unix OS yet. // this->ForceUnixPaths = true; @@ -510,6 +519,13 @@ void cmGlobalNinjaGenerator::Generate() this->OpenBuildFileStream(); this->OpenRulesFileStream(); + this->PolicyCMP0058 = + this->LocalGenerators[0]->GetMakefile() + ->GetPolicyStatus(cmPolicies::CMP0058); + this->ComputingUnknownDependencies = + (this->PolicyCMP0058 == cmPolicies::OLD || + this->PolicyCMP0058 == cmPolicies::WARN); + this->cmGlobalGenerator::Generate(); this->WriteAssumedSourceDependencies(); @@ -955,6 +971,11 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) { + if (!this->ComputingUnknownDependencies) + { + return; + } + // We need to collect the set of known build outputs. // Start with those generated by WriteBuild calls. // No other method needs this so we can take ownership @@ -1047,9 +1068,11 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) knownDependencies.end(), std::back_inserter(unknownExplicitDepends)); - std::string const rootBuildDirectory = this->GetCMakeInstance()->GetHomeOutputDirectory(); + bool const inSourceBuild = + (rootBuildDirectory == this->GetCMakeInstance()->GetHomeDirectory()); + std::vector warnExplicitDepends; for (std::vector::const_iterator i = unknownExplicitDepends.begin(); i != unknownExplicitDepends.end(); @@ -1067,8 +1090,34 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) "", deps, cmNinjaDeps()); + if (this->PolicyCMP0058 == cmPolicies::WARN && + !inSourceBuild && warnExplicitDepends.size() < 10) + { + warnExplicitDepends.push_back(*i); + } } } + + if (!warnExplicitDepends.empty()) + { + std::ostringstream w; + w << + (this->GetCMakeInstance()->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0058)) << "\n" + "This project specifies custom command DEPENDS on files " + "in the build tree that are not specified as the OUTPUT or " + "BYPRODUCTS of any add_custom_command or add_custom_target:\n" + " " << cmJoin(warnExplicitDepends, "\n ") << + "\n" + "For compatibility with versions of CMake that did not have " + "the BYPRODUCTS option, CMake is generating phony rules for " + "such files to convince 'ninja' to build." + "\n" + "Project authors should add the missing BYPRODUCTS or OUTPUT " + "options to the custom commands that produce these files." + ; + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } } void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3f6af6c20..6aa76f988 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -368,6 +368,11 @@ private: /// The set of custom command outputs we have seen. std::set CustomCommandOutputs; + /// Whether we are collecting known build outputs and needed + /// dependencies to determine unknown dependencies. + bool ComputingUnknownDependencies; + cmPolicies::PolicyStatus PolicyCMP0058; + /// The combined explicit dependencies of custom build commands std::set CombinedCustomCommandExplicitDependencies; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 720030bb8..592df8f16 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -380,6 +380,11 @@ cmPolicies::cmPolicies() CMP0057, "CMP0057", "Disallow multiple MAIN_DEPENDENCY specifications for the same file.", 3,3,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0058, "CMP0058", + "Ninja requires custom command byproducts to be explicit.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 854b132c8..b18b33766 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -115,6 +115,7 @@ public: CMP0056, ///< Honor link flags in try_compile() source-file signature. CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications /// for the same file. + CMP0058, ///< Ninja requires custom command byproducts to be explicit /** \brief Always the last entry. * diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7cbc9fea7..dc6397588 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -64,6 +64,9 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) +if(CMAKE_GENERATOR STREQUAL "Ninja") + add_RunCMake_test(Ninja) +endif() add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt new file mode 100644 index 000000000..8646a13e8 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake new file mode 100644 index 000000000..0f7793096 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0058 NEW) +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt new file mode 100644 index 000000000..fa10109fb --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'byproduct1a', needed by 'output2', missing and no known rule to make it diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake new file mode 100644 index 000000000..582e3d530 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0058 NEW) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt new file mode 100644 index 000000000..8646a13e8 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake new file mode 100644 index 000000000..92a3a0fb5 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0058 OLD) +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt new file mode 100644 index 000000000..8646a13e8 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake new file mode 100644 index 000000000..0326e0766 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0058 OLD) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt new file mode 100644 index 000000000..8646a13e8 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake new file mode 100644 index 000000000..612816796 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake @@ -0,0 +1,2 @@ +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt new file mode 100644 index 000000000..8646a13e8 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt new file mode 100644 index 000000000..439a2d9bf --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt @@ -0,0 +1,19 @@ +^CMake Warning \(dev\): + Policy CMP0058 is not set: Ninja requires custom command byproducts to be + explicit. Run "cmake --help-policy CMP0058" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + This project specifies custom command DEPENDS on files in the build tree + that are not specified as the OUTPUT or BYPRODUCTS of any + add_custom_command or add_custom_target: + + byproduct1a + byproduct1b + + For compatibility with versions of CMake that did not have the BYPRODUCTS + option, CMake is generating phony rules for such files to convince 'ninja' + to build. + + Project authors should add the missing BYPRODUCTS or OUTPUT options to the + custom commands that produce these files. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake new file mode 100644 index 000000000..7bc66ef28 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake @@ -0,0 +1 @@ +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-common.cmake b/Tests/RunCMake/Ninja/CMP0058-common.cmake new file mode 100644 index 000000000..9274d58cd --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-common.cmake @@ -0,0 +1,17 @@ +add_custom_command( + OUTPUT output1 + ${byproducts} + COMMAND ${CMAKE_COMMAND} -E touch output1 + COMMAND ${CMAKE_COMMAND} -E touch byproduct1a + COMMAND ${CMAKE_COMMAND} -E touch byproduct1b + ) +add_custom_target(Drive1 ALL DEPENDS output1) +add_custom_command( + OUTPUT output2 + COMMAND ${CMAKE_COMMAND} -E copy output1 output2 + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output1 + ${CMAKE_CURRENT_BINARY_DIR}/byproduct1a + ${CMAKE_CURRENT_BINARY_DIR}/byproduct1b + ) +add_custom_target(Drive2 ALL DEPENDS output2) +add_dependencies(Drive2 Drive1) diff --git a/Tests/RunCMake/Ninja/CMakeLists.txt b/Tests/RunCMake/Ninja/CMakeLists.txt new file mode 100644 index 000000000..2a0591e74 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake new file mode 100644 index 000000000..64f97bcd6 --- /dev/null +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -0,0 +1,18 @@ +include(RunCMake) + +function(run_CMP0058 case) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(CMP0058-${case}) + run_cmake_command(CMP0058-${case}-build ${CMAKE_COMMAND} --build .) +endfunction() + +run_CMP0058(OLD-no) +run_CMP0058(OLD-by) +run_CMP0058(WARN-no) +run_CMP0058(WARN-by) +run_CMP0058(NEW-no) +run_CMP0058(NEW-by) From 2ec1c0d6e07305c51e0602ddff835919b4b08ed9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 21 Mar 2015 00:01:03 -0400 Subject: [PATCH 0336/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 81274646e..2e10d1ff0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150320) +set(CMake_VERSION_PATCH 20150321) #set(CMake_VERSION_RC 1) From aeb9fb977493c0865a2d6c9fab8affaf69845c85 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 22 Mar 2015 00:01:05 -0400 Subject: [PATCH 0337/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2e10d1ff0..368f23bbd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150321) +set(CMake_VERSION_PATCH 20150322) #set(CMake_VERSION_RC 1) From 840f5b89a456b6f68a9b75c7a0a0bfc3fa37e643 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 22 Mar 2015 11:50:53 +0100 Subject: [PATCH 0338/1029] Help: Install Sphinx HTML object mapping file To link CMake documentation from other documentation sets like KDE extra-cmake-modules the intersphinx extension depends on the objects.inv mapping file. The size overhead of 14k seems to be neglectable. Signed-off-by: Gregor Jasny --- Utilities/Sphinx/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a58604ece..da8175297 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -159,7 +159,6 @@ if(SPHINX_HTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_DOC_DIR} PATTERN .buildinfo EXCLUDE - PATTERN objects.inv EXCLUDE ) endif() @@ -167,7 +166,6 @@ if(SPHINX_SINGLEHTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml DESTINATION ${CMAKE_DOC_DIR} PATTERN .buildinfo EXCLUDE - PATTERN objects.inv EXCLUDE ) endif() From d67196d0e8c5e9feb99d3a609d060f52ad8b9a59 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 23 Mar 2015 00:01:03 -0400 Subject: [PATCH 0339/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 368f23bbd..5ef57abba 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150322) +set(CMake_VERSION_PATCH 20150323) #set(CMake_VERSION_RC 1) From fde70a1b26e130663cc4c02e0530d3aadc165a41 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 5 Mar 2015 16:51:10 -0500 Subject: [PATCH 0340/1029] ctest: Add a new --repeat-until-fail option This option tells ctest to run each test N times until the test fails or the N times have run. This is useful for finding random failing tests. --- Help/manual/ctest.1.rst | 5 ++ Source/CTest/cmCTestMultiProcessHandler.cxx | 13 +++- Source/CTest/cmCTestRunTest.cxx | 73 +++++++++++++++++-- Source/CTest/cmCTestRunTest.h | 9 +++ Source/cmCTest.cxx | 37 +++++++++- Source/cmCTest.h | 12 ++- Source/ctest.cxx | 2 + Tests/RunCMake/CMakeLists.txt | 1 + .../RunCMake/CTestCommandLine/CMakeLists.txt | 3 + .../CTestCommandLine/RunCMakeTest.cmake | 25 +++++++ Tests/RunCMake/CTestCommandLine/init.cmake | 3 + .../repeat-until-fail-bad1-result.txt | 1 + .../repeat-until-fail-bad1-stderr.txt | 1 + .../repeat-until-fail-bad2-result.txt | 1 + .../repeat-until-fail-bad2-stderr.txt | 1 + .../repeat-until-fail-cmake.cmake | 15 ++++ .../repeat-until-fail-ctest-result.txt | 1 + .../repeat-until-fail-ctest-stderr.txt | 1 + .../repeat-until-fail-ctest-stdout.txt | 30 ++++++++ .../repeat-until-fail-good-stderr.txt | 1 + Tests/RunCMake/CTestCommandLine/test1.cmake | 13 ++++ 21 files changed, 233 insertions(+), 15 deletions(-) create mode 100644 Tests/RunCMake/CTestCommandLine/CMakeLists.txt create mode 100644 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/init.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test1.cmake diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index cc132c201..dd3bcfb70 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -194,6 +194,11 @@ Options subsequent calls to ctest with the --rerun-failed option will run the set of tests that most recently failed (if any). +``--repeat-until-fail `` + Require each test to run ```` times without failing in order to pass. + + This is useful in finding sporadic failures in test cases. + ``--max-width `` Set the max width for a test name to output diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index eb33d8edb..bd090db97 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -121,6 +121,11 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->RunningCount += GetProcessorsUsed(test); cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler); + if(this->CTest->GetRepeatUntilFail()) + { + testRun->SetRunUntilFailOn(); + testRun->SetNumberOfRuns(this->CTest->GetTestRepeat()); + } testRun->SetIndex(test); testRun->SetTestProperties(this->Properties[test]); @@ -289,7 +294,13 @@ bool cmCTestMultiProcessHandler::CheckOutput() cmCTestRunTest* p = *i; int test = p->GetIndex(); - if(p->EndTest(this->Completed, this->Total, true)) + bool testResult = p->EndTest(this->Completed, this->Total, true); + if(p->StartAgain()) + { + this->Completed--; // remove the completed test because run again + continue; + } + if(testResult) { this->Passed->push_back(p->GetTestProperties()->Name); } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd74..6f72684d3 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -33,6 +33,9 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->CompressedOutput = ""; this->CompressionRatio = 2; this->StopTimePassed = false; + this->NumberOfRunsLeft = 1; // default to 1 run of the test + this->RunUntilFail = false; // default to run the test once + this->RunAgain = false; // default to not having to run again } cmCTestRunTest::~cmCTestRunTest() @@ -357,13 +360,50 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->MemCheckPostProcess(); this->ComputeWeightedCost(); } - // Always push the current TestResult onto the + // If the test does not need to rerun push the current TestResult onto the // TestHandler vector - this->TestHandler->TestResults.push_back(this->TestResult); + if(!this->NeedsToRerun()) + { + this->TestHandler->TestResults.push_back(this->TestResult); + } delete this->TestProcess; return passed; } +bool cmCTestRunTest::StartAgain() +{ + if(!this->RunAgain) + { + return false; + } + this->RunAgain = false; // reset + // change to tests directory + std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(this->TestProperties->Directory); + this->StartTest(this->TotalNumberOfTests); + // change back + cmSystemTools::ChangeDirectory(current_dir); + return true; +} + +bool cmCTestRunTest::NeedsToRerun() +{ + this->NumberOfRunsLeft--; + if(this->NumberOfRunsLeft == 0) + { + return false; + } + // if number of runs left is not 0, and we are running until + // we find a failed test, then return true so the test can be + // restarted + if(this->RunUntilFail + && this->TestResult.Status == cmCTestTestHandler::COMPLETED) + { + this->RunAgain = true; + return true; + } + return false; +} //---------------------------------------------------------------------- void cmCTestRunTest::ComputeWeightedCost() { @@ -400,6 +440,7 @@ void cmCTestRunTest::MemCheckPostProcess() // Starts the execution of a test. Returns once it has started bool cmCTestRunTest::StartTest(size_t total) { + this->TotalNumberOfTests = total; // save for rerun case cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8) << "Start " << std::setw(getNumWidth(this->TestHandler->GetMaxIndex())) @@ -494,10 +535,10 @@ bool cmCTestRunTest::StartTest(size_t total) //---------------------------------------------------------------------- void cmCTestRunTest::ComputeArguments() { + this->Arguments.clear(); // reset becaue this might be a rerun std::vector::const_iterator j = this->TestProperties->Args.begin(); ++j; // skip test name - // find the test executable if(this->TestHandler->MemCheck) { @@ -682,10 +723,28 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << completed << "/"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << total << " "); + // if this is the last or only run of this test + // then print out completed / total + // Only issue is if a test fails and we are running until fail + // then it will never print out the completed / total, same would + // got for run until pass. Trick is when this is called we don't + // yet know if we are passing or failing. + if(this->NumberOfRunsLeft == 1) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << completed << "/"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << total << " "); + } + // if this is one of several runs of a test just print blank space + // to keep things neat + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + } if ( this->TestHandler->MemCheck ) { diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 476f3e126..3b5c83160 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -27,6 +27,8 @@ public: cmCTestRunTest(cmCTestTestHandler* handler); ~cmCTestRunTest(); + void SetNumberOfRuns(int n) {this->NumberOfRunsLeft = n;} + void SetRunUntilFailOn() { this->RunUntilFail = true;} void SetTestProperties(cmCTestTestHandler::cmCTestTestProperties * prop) { this->TestProperties = prop; } @@ -58,7 +60,10 @@ public: void ComputeArguments(); void ComputeWeightedCost(); + + bool StartAgain(); private: + bool NeedsToRerun(); void DartProcessing(); void ExeNotFound(std::string exe); // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) @@ -92,6 +97,10 @@ private: std::string ActualCommand; std::vector Arguments; bool StopTimePassed; + bool RunUntilFail; + int NumberOfRunsLeft; + bool RunAgain; + size_t TotalNumberOfTests; }; inline int getNumWidth(size_t n) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d396032..2cbdf9cbc 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -328,6 +328,8 @@ cmCTest::cmCTest() this->OutputTestOutputOnTestFailure = false; this->ComputedCompressTestOutput = false; this->ComputedCompressMemCheckOutput = false; + this->RepeatTests = 1; // default to run each test once + this->RepeatUntilFail = false; if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) { this->OutputTestOutputOnTestFailure = true; @@ -1983,11 +1985,11 @@ bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, //---------------------------------------------------------------------- // Processes one command line argument (and its arguments if any) // for many simple options and then returns -void cmCTest::HandleCommandLineArguments(size_t &i, - std::vector &args) +bool cmCTest::HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg) { std::string arg = args[i]; - if(this->CheckArgument(arg, "-F")) { this->Failover = true; @@ -2005,6 +2007,27 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->SetParallelLevel(plevel); this->ParallelLevelSetInCli = true; } + if(this->CheckArgument(arg, "--repeat-until-fail")) + { + if( i >= args.size() - 1) + { + errormsg = "'--repeat-until-fail' requires an argument"; + return false; + } + i++; + long repeat = 1; + if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) + { + errormsg = "'--repeat-until-fail' given non-integer value '" + + args[i] + "'"; + return false; + } + this->RepeatTests = static_cast(repeat); + if(repeat > 1) + { + this->RepeatUntilFail = true; + } + } if(this->CheckArgument(arg, "--no-compress-output")) { @@ -2190,6 +2213,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->GetHandler("test")->SetPersistentOption("RerunFailed", "true"); this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true"); } + return true; } //---------------------------------------------------------------------- @@ -2272,7 +2296,12 @@ int cmCTest::Run(std::vector &args, std::string* output) for(size_t i=1; i < args.size(); ++i) { // handle the simple commandline arguments - this->HandleCommandLineArguments(i,args); + std::string errormsg; + if(!this->HandleCommandLineArguments(i,args, errormsg)) + { + cmSystemTools::Error(errormsg.c_str()); + return 1; + } // handle the script arguments -S -SR -SP this->HandleScriptArguments(i,args,SRArgumentSpecified); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 88191c4f3..3f033d9e3 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -429,8 +429,13 @@ public: { return this->Definitions; } - + // return the number of times a test should be run + int GetTestRepeat() { return this->RepeatTests;} + // return true if test should run until fail + bool GetRepeatUntilFail() { return this->RepeatUntilFail;} private: + int RepeatTests; + bool RepeatUntilFail; std::string ConfigType; std::string ScheduleType; std::string StopTime; @@ -535,8 +540,9 @@ private: bool AddVariableDefinition(const std::string &arg); //! parse and process most common command line arguments - void HandleCommandLineArguments(size_t &i, - std::vector &args); + bool HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg); //! hande the -S -SP and -SR arguments void HandleScriptArguments(size_t &i, diff --git a/Source/ctest.cxx b/Source/ctest.cxx index c0eb8acc6..0fc47b71e 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -75,6 +75,8 @@ static const char * cmDocumentationOptions[][2] = "Run a specific number of tests by number."}, {"-U, --union", "Take the Union of -I and -R"}, {"--rerun-failed", "Run only the tests that failed previously"}, + {"--repeat-until-fail ", "Require each test to run " + "times without failing in order to pass"}, {"--max-width ", "Set the max width for a test name to output"}, {"--interactive-debug-mode [0|1]", "Set the interactive mode to 0 or 1."}, {"--no-label-summary", "Disable timing summary information for labels."}, diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb4205740..ffda31f20 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -198,6 +198,7 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(CTestCommandLine) set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt new file mode 100644 index 000000000..289710955 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake new file mode 100644 index 000000000..2e5156cd6 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -0,0 +1,25 @@ +include(RunCMake) + +run_cmake_command(repeat-until-fail-bad1 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail + ) +run_cmake_command(repeat-until-fail-bad2 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail foo + ) +run_cmake_command(repeat-until-fail-good + ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 + ) + +function(run_repeat_until_fail_tests) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-fail-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(repeat-until-fail-cmake) + run_cmake_command(repeat-until-fail-ctest + ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-fail 3 + ) +endfunction() +run_repeat_until_fail_tests() diff --git a/Tests/RunCMake/CTestCommandLine/init.cmake b/Tests/RunCMake/CTestCommandLine/init.cmake new file mode 100644 index 000000000..a900f675c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/init.cmake @@ -0,0 +1,3 @@ +# This is run by test initialization in repeat-until-fail-cmake.cmake +# with cmake -P. It creates TEST_OUTPUT_FILE with a 0 in it. +file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt new file mode 100644 index 000000000..5ea8816e9 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt new file mode 100644 index 000000000..a79faaef5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake new file mode 100644 index 000000000..465441645 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake @@ -0,0 +1,15 @@ +enable_testing() + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization") + +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt new file mode 100644 index 000000000..45a4fb75d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt new file mode 100644 index 000000000..759378390 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt @@ -0,0 +1 @@ +^Errors while running CTest$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt new file mode 100644 index 000000000..0bc4f701b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt @@ -0,0 +1,30 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-fail-build + Start 1: initialization + Test #1: initialization ................... Passed [0-9.]+ sec + Start 1: initialization + Test #1: initialization ................... Passed [0-9.]+ sec + Start 1: initialization +1/4 Test #1: initialization ................... Passed [0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................ Passed [0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................\*\*\*Failed [0-9.]+ sec + Start 3: hello + Test #3: hello ............................ Passed [0-9.]+ sec + Start 3: hello + Test #3: hello ............................ Passed [0-9.]+ sec + Start 3: hello +3/4 Test #3: hello ............................ Passed [0-9.]+ sec + Start 4: goodbye + Test #4: goodbye .......................... Passed [0-9.]+ sec + Start 4: goodbye + Test #4: goodbye .......................... Passed [0-9.]+ sec + Start 4: goodbye +4/4 Test #4: goodbye .......................... Passed [0-9.]+ sec ++ +75% tests passed, 1 tests failed out of 4 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[ ]+2 - test1 \(Failed\)$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt new file mode 100644 index 000000000..a7c4b11f7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/test1.cmake b/Tests/RunCMake/CTestCommandLine/test1.cmake new file mode 100644 index 000000000..eeae7a204 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test1.cmake @@ -0,0 +1,13 @@ +# This is run by test test1 in repeat-until-fail-cmake.cmake with cmake -P. +# It reads the file TEST_OUTPUT_FILE and increments the number +# found in the file by 1. When the number is 2, then the +# code sends out a cmake error causing the test to fail +# the second time it is run. +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(${COUNT} EQUAL 2) + message(FATAL_ERROR "this test fails on the 2nd run") +endif() From 6bce027662588b972602e2e74c16a1883ed853cf Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 17 Mar 2015 11:39:43 -0400 Subject: [PATCH 0341/1029] Help: Add notes for topic 'ctest-repeat-until-fail' --- Help/release/dev/ctest-repeat-until-fail.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/ctest-repeat-until-fail.rst diff --git a/Help/release/dev/ctest-repeat-until-fail.rst b/Help/release/dev/ctest-repeat-until-fail.rst new file mode 100644 index 000000000..8a679c61c --- /dev/null +++ b/Help/release/dev/ctest-repeat-until-fail.rst @@ -0,0 +1,5 @@ +ctest-repeat-until-fail +----------------------- + +* The :manual:`ctest(1)` tool learned a new ``--repeat-until-fail `` + option to help find sporadic test failures. From 3714955b9cded21b13064886b30a412211ce217e Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Wed, 25 Feb 2015 21:07:43 +0100 Subject: [PATCH 0342/1029] OS X: Add handling for XCTest bundles An XCTest bundle is a CFBundle with a special product-type and bundle extension. For more information about XCTest visit the Mac Developer library at: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ Signed-off-by: Gregor Jasny --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/XCTEST.rst | 13 +++++++++++++ Source/cmGlobalXCodeGenerator.cxx | 12 ++++++++++-- Source/cmTarget.cxx | 16 +++++++++++++++- Source/cmTarget.h | 3 +++ 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 Help/prop_tgt/XCTEST.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 19fdf23f3..1dff33e96 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -243,6 +243,7 @@ Properties on Targets /prop_tgt/VS_WINRT_REFERENCES /prop_tgt/WIN32_EXECUTABLE /prop_tgt/XCODE_ATTRIBUTE_an-attribute + /prop_tgt/XCTEST Properties on Tests =================== diff --git a/Help/prop_tgt/XCTEST.rst b/Help/prop_tgt/XCTEST.rst new file mode 100644 index 000000000..eb47e606f --- /dev/null +++ b/Help/prop_tgt/XCTEST.rst @@ -0,0 +1,13 @@ +XCTEST +------ + +This target is a XCTest CFBundle on the Mac. + +This property will usually get set via the :command:`xctest_add_bundle` +macro in :module:`FindXCTest` module. + +If a module library target has this property set to true it will be +built as a CFBundle when built on the Mac. It will have the directory +structure required for a CFBundle. + +This property depends on :prop_tgt:`BUNDLE` to be effective. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index bd8a1f51a..d340e724f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -804,6 +804,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode = "compiled.mach-o.objfile"; } + else if(ext == "xctest") + { + sourcecode = "wrapper.cfbundle"; + } else if(ext == "xib") { keepLastKnownFileType = true; @@ -2598,7 +2602,9 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget) case cmTarget::STATIC_LIBRARY: return "archive.ar"; case cmTarget::MODULE_LIBRARY: - if (cmtarget.IsCFBundleOnApple()) + if (cmtarget.IsXCTestOnApple()) + return "wrapper.cfbundle"; + else if (cmtarget.IsCFBundleOnApple()) return "wrapper.plug-in"; else return ((this->XcodeVersion >= 22)? @@ -2622,7 +2628,9 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget) case cmTarget::STATIC_LIBRARY: return "com.apple.product-type.library.static"; case cmTarget::MODULE_LIBRARY: - if (cmtarget.IsCFBundleOnApple()) + if (cmtarget.IsXCTestOnApple()) + return "com.apple.product-type.bundle.unit-test"; + else if (cmtarget.IsCFBundleOnApple()) return "com.apple.product-type.bundle"; else return ((this->XcodeVersion >= 22)? diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b70f60d6a..b3d115543 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -615,6 +615,13 @@ bool cmTarget::IsCFBundleOnApple() const this->GetPropertyAsBool("BUNDLE")); } +//---------------------------------------------------------------------------- +bool cmTarget::IsXCTestOnApple() const +{ + return (this->IsCFBundleOnApple() && + this->GetPropertyAsBool("XCTEST")); +} + //---------------------------------------------------------------------------- bool cmTarget::IsBundleOnApple() const { @@ -6791,7 +6798,14 @@ std::string cmTarget::GetCFBundleDirectory(const std::string& config, const char *ext = this->GetProperty("BUNDLE_EXTENSION"); if (!ext) { - ext = "bundle"; + if (this->IsXCTestOnApple()) + { + ext = "xctest"; + } + else + { + ext = "bundle"; + } } fpath += ext; fpath += "/Contents"; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5170b3190..a4ef9775a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -527,6 +527,9 @@ public: /** Return whether this target is a CFBundle (plugin) on Apple. */ bool IsCFBundleOnApple() const; + /** Return whether this target is a XCTest on Apple. */ + bool IsXCTestOnApple() const; + /** Return whether this target is an executable Bundle on Apple. */ bool IsAppBundleOnApple() const; From ba14510b4ebdbbfe115e29111615a4b775fb7198 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 26 Feb 2015 21:55:45 +0100 Subject: [PATCH 0343/1029] OS X: Add FindXCTest module Add a module to lookup XCTest Framework and xctest utility. It also provides APIs for creating 'xctest' targets. Signed-off-by: Gregor Jasny --- Help/manual/cmake-modules.7.rst | 1 + Help/module/FindXCTest.rst | 1 + Modules/FindXCTest.cmake | 196 ++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 Help/module/FindXCTest.rst create mode 100644 Modules/FindXCTest.cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 2b26cc9eb..c9219d5e2 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -212,6 +212,7 @@ All Modules /module/FindWish /module/FindwxWidgets /module/FindwxWindows + /module/FindXCTest /module/FindXercesC /module/FindX11 /module/FindXMLRPC diff --git a/Help/module/FindXCTest.rst b/Help/module/FindXCTest.rst new file mode 100644 index 000000000..ff6273c47 --- /dev/null +++ b/Help/module/FindXCTest.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXCTest.cmake diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake new file mode 100644 index 000000000..3cd9c22bc --- /dev/null +++ b/Modules/FindXCTest.cmake @@ -0,0 +1,196 @@ +#[=======================================================================[.rst: +FindXCTest +---------- + +Functions to help creating and executing XCTest bundles. + +An XCTest bundle is a CFBundle with a special product-type +and bundle extension. The Mac Developer Library provides more +information in the `Testing with Xcode`_ document. + +.. _Testing with Xcode: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ + +Module Functions +^^^^^^^^^^^^^^^^ + +.. command:: xctest_add_bundle + + The ``xctest_add_bundle`` function creates a XCTest bundle named + which will test the target . Supported target types + for testee are Frameworks and App Bundles:: + + xctest_add_bundle( + # Name of the XCTest bundle + # Target name of the testee + ) + +.. command:: xctest_add_test + + The ``xctest_add_test`` function adds an XCTest bundle to the + project to be run by :manual:`ctest(1)`. The test will be named + and tests :: + + xctest_add_test( + # Test name + # Target name of XCTest bundle + ) + +Module Variables +^^^^^^^^^^^^^^^^ + +The following variables are set by including this module: + +.. variable:: XCTest_FOUND + + True if the XCTest Framework and executable were found. + +.. variable:: XCTest_EXECUTABLE + + The path to the xctest command line tool used to execute XCTest bundles. + +.. variable:: XCTest_INCLUDE_DIRS + + The directory containing the XCTest Framework headers. + +.. variable:: XCTest_LIBRARIES + + The location of the XCTest Framework. + +#]=======================================================================] + +#============================================================================= +# Copyright 2015 Gregor Jasny +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(XCTest_INCLUDE_DIR + NAMES "XCTest/XCTest.h" + DOC "XCTest include directory") +mark_as_advanced(XCTest_INCLUDE_DIR) + +find_library(XCTest_LIBRARY + NAMES XCTest + DOC "XCTest Framework library") +mark_as_advanced(XCTest_LIBRARY) + +execute_process( + COMMAND xcrun --find xctest + OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _xcrun_err) +if(_xcrun_out) + set(XCTest_EXECUTABLE "${_xcrun_out}" CACHE FILEPATH "XCTest executable") + mark_as_advanced(XCTest_EXECUTABLE) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(XCTest + FOUND_VAR XCTest_FOUND + REQUIRED_VARS XCTest_LIBRARY XCTest_INCLUDE_DIR XCTest_EXECUTABLE) + +if(XCTest_FOUND) + set(XCTest_INCLUDE_DIRS "${XCTest_INCLUDE_DIR}") + set(XCTest_LIBRARIES "${XCTest_LIBRARY}") +endif(XCTest_FOUND) + + +function(xctest_add_bundle target testee) + if(NOT XCTest_FOUND) + message(FATAL_ERROR "XCTest is required to create a XCTest Bundle.") + endif(NOT XCTest_FOUND) + + if(NOT CMAKE_OSX_SYSROOT) + message(FATAL_ERROR "Adding XCTest bundles requires CMAKE_OSX_SYSROOT to be set.") + endif() + + add_library(${target} MODULE ${ARGN}) + + set_target_properties(${target} PROPERTIES + BUNDLE TRUE + XCTEST TRUE + XCTEST_TESTEE ${testee}) + + target_link_libraries(${target} PRIVATE "-framework Foundation") + target_link_libraries(${target} PRIVATE ${XCTest_LIBRARIES}) + target_include_directories(${target} PRIVATE ${XCTest_INCLUDE_DIRS}) + + # retrieve testee target type + if(NOT TARGET ${testee}) + message(FATAL_ERROR "${testee} is not a target.") + endif() + get_property(_testee_type TARGET ${testee} PROPERTY TYPE) + get_property(_testee_framework TARGET ${testee} PROPERTY FRAMEWORK) + get_property(_testee_macosx_bundle TARGET ${testee} PROPERTY MACOSX_BUNDLE) + + if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework) + # testee is a Framework + target_link_libraries(${target} PRIVATE ${testee}) + + elseif(_testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle) + # testee is an App Bundle + add_dependencies(${target} ${testee}) + if(XCODE) + set_target_properties(${target} PROPERTIES + XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)" + XCODE_ATTRIBUTE_TEST_HOST "$") + else(XCODE) + target_link_libraries(${target} + PRIVATE -bundle_loader $) + endif(XCODE) + + else() + message(FATAL_ERROR "Testee ${testee} is of unsupported type.") + endif() +endfunction(xctest_add_bundle) + + +function(xctest_add_test name bundle) + if(NOT XCTest_EXECUTABLE) + message(FATAL_ERROR "XCTest executable is required to register a test.") + endif() + + # check that bundle is a XCTest Bundle + + if(NOT TARGET ${bundle}) + message(FATAL_ERROR "${bundle} is not a target.") + endif(NOT TARGET ${bundle}) + + get_property(_test_type TARGET ${bundle} PROPERTY TYPE) + get_property(_test_bundle TARGET ${bundle} PROPERTY BUNDLE) + get_property(_test_xctest TARGET ${bundle} PROPERTY XCTEST) + + if(NOT _test_type STREQUAL "MODULE_LIBRARY" + OR NOT _test_xctest OR NOT _test_bundle) + message(FATAL_ERROR "Test ${bundle} is not an XCTest Bundle") + endif() + + # get and check testee properties + + get_property(_testee TARGET ${bundle} PROPERTY XCTEST_TESTEE) + if(NOT TARGET ${_testee}) + message(FATAL_ERROR "${_testee} is not a target.") + endif() + + get_property(_testee_type TARGET ${_testee} PROPERTY TYPE) + get_property(_testee_framework TARGET ${_testee} PROPERTY FRAMEWORK) + + # register test + + add_test( + NAME ${name} + COMMAND ${XCTest_EXECUTABLE} $/../..) + + # point loader to testee in case rpath is disabled + + if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework) + set_property(TEST ${name} APPEND PROPERTY + ENVIRONMENT DYLD_FRAMEWORK_PATH=$/..) + endif() +endfunction(xctest_add_test) From 87a4b8580cad34fefa5c5e1833b0963a6bcf3e7d Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 26 Feb 2015 21:55:46 +0100 Subject: [PATCH 0344/1029] Tests: Add XCTest example to test Frameworks and Cocoa App Bundles Signed-off-by: Gregor Jasny --- Tests/CMakeLists.txt | 6 + Tests/XCTest/CMakeLists.txt | 57 ++ Tests/XCTest/CocoaExample/AppDelegate.h | 6 + Tests/XCTest/CocoaExample/AppDelegate.m | 18 + Tests/XCTest/CocoaExample/Info.plist | 30 + Tests/XCTest/CocoaExample/MainMenu.xib | 680 ++++++++++++++++++ Tests/XCTest/CocoaExample/main.m | 5 + .../CocoaExampleTests/CocoaExampleTests.m | 13 + .../FrameworkExample/FrameworkExample.c | 6 + .../FrameworkExample/FrameworkExample.h | 1 + Tests/XCTest/FrameworkExample/Info.plist | 28 + .../FrameworkExampleTests.m | 16 + Tests/XCTest/FrameworkExampleTests/Info.plist | 24 + 13 files changed, 890 insertions(+) create mode 100644 Tests/XCTest/CMakeLists.txt create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.h create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.m create mode 100644 Tests/XCTest/CocoaExample/Info.plist create mode 100644 Tests/XCTest/CocoaExample/MainMenu.xib create mode 100644 Tests/XCTest/CocoaExample/main.m create mode 100644 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.c create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.h create mode 100644 Tests/XCTest/FrameworkExample/Info.plist create mode 100644 Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m create mode 100644 Tests/XCTest/FrameworkExampleTests/Info.plist diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 765fc804c..9e419f8ee 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1505,6 +1505,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6 + AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) + ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) + endif() + add_test(linkorder1 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt new file mode 100644 index 000000000..e8666231b --- /dev/null +++ b/Tests/XCTest/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.1) +project(XCTest) +enable_testing() + +find_package(XCTest REQUIRED) + +# Framework + +add_library(FrameworkExample SHARED + FrameworkExample/FrameworkExample.c + FrameworkExample/FrameworkExample.h + FrameworkExample/Info.plist) + +target_include_directories(FrameworkExample PUBLIC .) + +set_target_properties(FrameworkExample PROPERTIES + FRAMEWORK TRUE + VERSION "1.0.0" + SOVERSION "1.0.0" + FRAMEWORK_VERSION "A" + MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExample/Info.plist + PUBLIC_HEADER FrameworkExample/FrameworkExample.h) + +# XCTest for Framework + +xctest_add_bundle(FrameworkExampleTests FrameworkExample + FrameworkExampleTests/FrameworkExampleTests.m + FrameworkExampleTests/Info.plist) + +set_target_properties(FrameworkExampleTests PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExampleTests/Info.plist + ) + +xctest_add_test(XCTest.FrameworkExample FrameworkExampleTests) + +# Cocoa App Bundle + +add_executable(CocoaExample MACOSX_BUNDLE + CocoaExample/main.m + CocoaExample/AppDelegate.m + CocoaExample/AppDelegate.h + CocoaExample/MainMenu.xib +) + +target_link_libraries(CocoaExample PRIVATE "-framework Foundation") +target_link_libraries(CocoaExample PRIVATE "-framework AppKit") + +set_target_properties(CocoaExample PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CocoaExample/Info.plist + RESOURCE "CocoaExample/MainMenu.xib") + +# XCTest for Cocoa App Bundle + +xctest_add_bundle(CocoaExampleTests CocoaExample + CocoaExampleTests/CocoaExampleTests.m) + +xctest_add_test(XCTest.CocoaExample CocoaExampleTests) diff --git a/Tests/XCTest/CocoaExample/AppDelegate.h b/Tests/XCTest/CocoaExample/AppDelegate.h new file mode 100644 index 000000000..4bf41019e --- /dev/null +++ b/Tests/XCTest/CocoaExample/AppDelegate.h @@ -0,0 +1,6 @@ +#import + +@interface AppDelegate : NSObject + + +@end diff --git a/Tests/XCTest/CocoaExample/AppDelegate.m b/Tests/XCTest/CocoaExample/AppDelegate.m new file mode 100644 index 000000000..07af62fd5 --- /dev/null +++ b/Tests/XCTest/CocoaExample/AppDelegate.m @@ -0,0 +1,18 @@ +#import "AppDelegate.h" + +@interface AppDelegate () + +@property (assign) IBOutlet NSWindow *window; +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + +@end diff --git a/Tests/XCTest/CocoaExample/Info.plist b/Tests/XCTest/CocoaExample/Info.plist new file mode 100644 index 000000000..5267c6322 --- /dev/null +++ b/Tests/XCTest/CocoaExample/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + CocoaExample + CFBundleIconFile + + CFBundleIdentifier + org.cmake.CocoaExample + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + CocoaExample + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/Tests/XCTest/CocoaExample/MainMenu.xib b/Tests/XCTest/CocoaExample/MainMenu.xib new file mode 100644 index 000000000..9498a0a7d --- /dev/null +++ b/Tests/XCTest/CocoaExample/MainMenu.xib @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/XCTest/CocoaExample/main.m b/Tests/XCTest/CocoaExample/main.m new file mode 100644 index 000000000..8a6799b41 --- /dev/null +++ b/Tests/XCTest/CocoaExample/main.m @@ -0,0 +1,5 @@ +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +} diff --git a/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m b/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m new file mode 100644 index 000000000..70d61d6ff --- /dev/null +++ b/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m @@ -0,0 +1,13 @@ +#import + +@interface CocoaExampleTests : XCTestCase + +@end + +@implementation CocoaExampleTests + +- (void)testExample { + XCTAssert(YES, @"Pass"); +} + +@end diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c b/Tests/XCTest/FrameworkExample/FrameworkExample.c new file mode 100644 index 000000000..2da78da78 --- /dev/null +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c @@ -0,0 +1,6 @@ +#include "FrameworkExample.h" + +int FourtyTwo() +{ + return 42; +} diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.h b/Tests/XCTest/FrameworkExample/FrameworkExample.h new file mode 100644 index 000000000..2e0b499bf --- /dev/null +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.h @@ -0,0 +1 @@ +int FourtyTwo(); diff --git a/Tests/XCTest/FrameworkExample/Info.plist b/Tests/XCTest/FrameworkExample/Info.plist new file mode 100644 index 000000000..a22acea22 --- /dev/null +++ b/Tests/XCTest/FrameworkExample/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FrameworkExample + CFBundleIdentifier + org.cmake.FrameworkExample + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FrameworkExample + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + + NSHumanReadableCopyright + + NSPrincipalClass + + + diff --git a/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m new file mode 100644 index 000000000..7cba23ecb --- /dev/null +++ b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m @@ -0,0 +1,16 @@ +#import + +#import "FrameworkExample/FrameworkExample.h" + +@interface FrameworkExampleTests : XCTestCase + +@end + +@implementation FrameworkExampleTests + +- (void)testFourtyTwo { + // This is an example of a functional test case. + XCTAssertEqual(42, FourtyTwo()); +} + +@end diff --git a/Tests/XCTest/FrameworkExampleTests/Info.plist b/Tests/XCTest/FrameworkExampleTests/Info.plist new file mode 100644 index 000000000..293921b75 --- /dev/null +++ b/Tests/XCTest/FrameworkExampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FrameworkExampleTests + CFBundleIdentifier + org.cmake.FrameworkExampleTests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FrameworkExampleTests + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + From 4178cd88fc01bd38fde2f3ee7a1702cfb4808f93 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Feb 2015 09:09:25 -0500 Subject: [PATCH 0345/1029] Help: Add notes for topic 'xcode-xctest' --- Help/release/dev/xcode-xctest.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/xcode-xctest.rst diff --git a/Help/release/dev/xcode-xctest.rst b/Help/release/dev/xcode-xctest.rst new file mode 100644 index 000000000..7a2f07b97 --- /dev/null +++ b/Help/release/dev/xcode-xctest.rst @@ -0,0 +1,6 @@ +xcode-xctest +------------ + +* On OS X, CMake learned to create XCTest bundles to test Frameworks + and App Bundles within Xcode. The :module:`FindXCTest` module + provides convenience functions to handle :prop_tgt:`XCTEST` bundles. From fb3e4de8e81f5f14edd2123f53ae1eaed7c37172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Wed, 11 Mar 2015 13:04:15 +0100 Subject: [PATCH 0346/1029] CPack: Add support to overwrite or pass additional parameter to codesign --- Modules/CPackBundle.cmake | 5 +++++ Source/CPack/cmCPackBundleGenerator.cxx | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index d26a0b32b..b41221612 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -52,6 +52,11 @@ # list the main application folder, or the main executable. You should # list any frameworks and plugins that are included in your app bundle. # +# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER +# +# Additional parameter that will passed to codesign. +# Default value: "--deep -f" +# # .. variable:: CPACK_COMMAND_CODESIGN # # Path to the codesign(1) command used to sign applications with an diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 6e7a26b22..b2d701944 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -221,6 +221,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) bundle_path += ".app"; // A list of additional files to sign, ie. frameworks and plugins. + const std::string sign_parameter = + this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + : "--deep -f"; + const std::string sign_files = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") : ""; @@ -234,7 +239,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) { std::ostringstream temp_sign_file_cmd; temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_sign_file_cmd << " --deep -f -s \"" << cpack_apple_cert_app; + temp_sign_file_cmd << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app; temp_sign_file_cmd << "\" -i "; temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID"); temp_sign_file_cmd << " \""; @@ -254,7 +260,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) // sign main binary std::ostringstream temp_sign_binary_cmd; temp_sign_binary_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_sign_binary_cmd << " --deep -f -s \"" << cpack_apple_cert_app; + temp_sign_binary_cmd << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app; temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; if(!this->RunCommand(temp_sign_binary_cmd, &output)) @@ -269,7 +276,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) // sign app bundle std::ostringstream temp_codesign_cmd; temp_codesign_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_codesign_cmd << " --deep -f -s \"" << cpack_apple_cert_app << "\""; + temp_codesign_cmd << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app << "\""; if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) { temp_codesign_cmd << " --entitlements "; From 81bfebfe8c1cd568c945250ac26ac18d92fcd251 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Fri, 20 Mar 2015 15:13:33 -0400 Subject: [PATCH 0347/1029] Linux: Ignore Debian-specific case when cross-compiling When constructing settings for the target environment during cross compiling we should not check for /etc/debian_version on the host. --- Modules/Platform/Linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index fe8e0039f..e40a74fab 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -52,6 +52,6 @@ include(Platform/UnixPaths) # Debian has lib64 paths only for compatibility so they should not be # searched. -if(EXISTS "/etc/debian_version") +if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) endif() From 209c142f68a8902db802ca6c73c22c395a7aea06 Mon Sep 17 00:00:00 2001 From: Steven Vancoillie Date: Mon, 23 Mar 2015 09:22:14 +0100 Subject: [PATCH 0348/1029] SunPro: Drop non-existent -KPIE flag --- Modules/Compiler/SunPro-C.cmake | 1 - Modules/Compiler/SunPro-CXX.cmake | 1 - 2 files changed, 2 deletions(-) diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index c5b5203fd..92252cb13 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -1,7 +1,6 @@ set(CMAKE_C_VERBOSE_FLAG "-#") set(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC) -set(CMAKE_C_COMPILE_OPTIONS_PIE -KPIE) set(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index c7bc734be..022b4d4ae 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -1,7 +1,6 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v") set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC) -set(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE) set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") From bcdda24851c83c86c19ec9cd96c90e7cdec688ef Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 24 Mar 2015 00:01:04 -0400 Subject: [PATCH 0349/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5ef57abba..b9a4a9c5a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150323) +set(CMake_VERSION_PATCH 20150324) #set(CMake_VERSION_RC 1) From 52642b466ec47f61195b4112407845e62b381596 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Fri, 20 Mar 2015 23:48:22 +0100 Subject: [PATCH 0350/1029] OS X: Look for Xcode 5 platform-specific Frameworks The Xcode 5 platform specific framework locations differ from the Xcode 6 ones. Look first for the Xcode 6 ones, then for iOS Xcode 5 ones and last for the Xcode 5 OS X ones. For reference, the XCTest.framework is located as follows: Xcode511.app/Contents/Developer/Library/Frameworks/XCTest.framework Xcode511.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/XCTest.framework Xcode511.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework Signed-off-by: Gregor Jasny --- Modules/Platform/Darwin.cmake | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index b912d98d3..4e4810a2a 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -167,12 +167,20 @@ if(_CMAKE_OSX_SYSROOT_PATH) ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks ) # add platform developer framework path if exists - get_filename_component(_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH - ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks ABSOLUTE) - if(IS_DIRECTORY ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) - list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH - ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) - endif() + foreach(_path + # Xcode 6 + ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks + # Xcode 5 iOS + ${_CMAKE_OSX_SYSROOT_PATH}/Developer/Library/Frameworks + # Xcode 5 OSX + ${_CMAKE_OSX_SYSROOT_PATH}/../../../../../Library/Frameworks + ) + get_filename_component(_abolute_path "${_path}" ABSOLUTE) + if(EXISTS "${_abolute_path}") + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}") + break() + endif() + endforeach() endif() list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks From 6ab1413499284dc8e1d7a8ac1f1940798a79e674 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Mon, 23 Mar 2015 18:06:46 +0100 Subject: [PATCH 0351/1029] Tests: Enable XCTest tests for Xcode 5 Signed-off-by: Gregor Jasny --- Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 49fd02b67..41032f8f6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1519,7 +1519,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6 + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) From 9c76ff015a393a2a5107a9db7f8ba91eb12c4ffa Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Tue, 24 Mar 2015 20:55:59 -0600 Subject: [PATCH 0352/1029] QtDialog: Fix CMake packaging with CPack on OS X with Qt5. --- Source/QtDialog/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index b59af94bd..9cc993a79 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -45,11 +45,11 @@ if (Qt5Widgets_FOUND) get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) - set(_qt_plugin_dest "${CMAKE_INSTALL_PREFIX}/PlugIns/${_qt_plugin_type}") + set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}") set(${_qt_plugins_var} - "${${_qt_plugins_var}};${_qt_plugin_dest}/${_qt_plugin_file}") + "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") else() message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") endif() From 26c43005847394ab110ebbdb29f1a1f37eaa7b7a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 25 Mar 2015 00:01:04 -0400 Subject: [PATCH 0353/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b9a4a9c5a..8f0e54c40 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150324) +set(CMake_VERSION_PATCH 20150325) #set(CMake_VERSION_RC 1) From a4a1b729c63ec81037af06ac1009d12cc1dc3188 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 25 Mar 2015 12:38:37 -0400 Subject: [PATCH 0354/1029] Fix warnings from clang scanbuild. --- Source/CPack/cmCPackDebGenerator.cxx | 5 +++++ Source/cmCTest.cxx | 27 +++++++++++++++++-------- Source/cmFileCommand.cxx | 1 + Source/cmFindPackageCommand.cxx | 2 -- Source/cmMakefile.cxx | 8 ++++++-- Source/cmSetTargetPropertiesCommand.cxx | 10 +-------- 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 0a64bd5eb..87764e1eb 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -507,6 +507,11 @@ int cmCPackDebGenerator::createDeb() //int retVal = -1; res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retval, toplevel.c_str(), this->GeneratorVerbose, 0); + if ( !res || retval ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum " + << cmd << std::endl); + } // debian md5sums entries are like this: // 014f3604694729f3bf19263bac599765 usr/bin/ccmake // thus strip the full path (with the trailing slash) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 0026fd77d..df61fe6bf 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1343,16 +1343,21 @@ int cmCTest::RunTest(std::vector argv, } *retVal = inst.Run(args, output); - *output += oss.str(); - if ( log ) + if(output) + { + *output += oss.str(); + } + if ( log && output) { *log << *output; } cmSystemTools::ChangeDirectory(oldpath); - - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, - "Internal cmCTest object used to run test." << std::endl - << *output << std::endl); + if(output) + { + cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, + "Internal cmCTest object used to run test." << std::endl + << *output << std::endl); + } return cmsysProcess_State_Exited; } @@ -1422,7 +1427,10 @@ int cmCTest::RunTest(std::vector argv, *retVal = cmsysProcess_GetExitException(cp); std::string outerr = "\n*** Exception executing: "; outerr += cmsysProcess_GetExceptionString(cp); - *output += outerr; + if(output) + { + *output += outerr; + } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl << std::flush); } @@ -1430,7 +1438,10 @@ int cmCTest::RunTest(std::vector argv, { std::string outerr = "\n*** ERROR executing: "; outerr += cmsysProcess_GetErrorString(cp); - *output += outerr; + if(output) + { + *output += outerr; + } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl << std::flush); } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index ae9099e93..93e3ac4fe 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3422,6 +3422,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) // enable HTTP ERROR parsing ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); + check_curl_result(res, "UPLOAD cannot set fail on error flag: "); // enable uploading res = ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 87f903718..4d7fd60f1 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -679,7 +679,6 @@ bool cmFindPackageCommand::HandlePackageMode() if(cmSystemTools::IsOff(def) || !fileFound) { fileFound = this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable); } // Sanity check. @@ -1598,7 +1597,6 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) if ((haveResult == false) && (this->Version.empty())) { result = true; - haveResult = true; } ConfigFileInfo configFileInfo; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eeb9c7200..7f355a6a0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2208,7 +2208,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, if(i==lastElement) { // group already exists, replace its regular expression - if ( regex ) + if ( regex && sg) { // We only want to set the regular expression. If there are already // source files in the group, we don't want to remove them. @@ -2224,7 +2224,11 @@ void cmMakefile::AddSourceGroup(const std::vector& name, sg = this->GetSourceGroup(currentName); i = 0; // last component found } - + if(!sg) + { + cmSystemTools::Error("Could not create source group "); + return; + } // build the whole source group path const char* fullname = sg->GetFullName(); cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index e41a0ca35..06217bb1f 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -25,14 +25,12 @@ bool cmSetTargetPropertiesCommand // first collect up the list of files std::vector propertyPairs; - bool doingFiles = true; int numFiles = 0; std::vector::const_iterator j; for(j= args.begin(); j != args.end();++j) { if(*j == "PROPERTIES") { - doingFiles = false; // now loop through the rest of the arguments, new style ++j; if (std::distance(j, args.end()) % 2 != 0) @@ -43,15 +41,9 @@ bool cmSetTargetPropertiesCommand propertyPairs.insert(propertyPairs.end(), j, args.end()); break; } - else if (doingFiles) - { - numFiles++; - } else { - this->SetError("called with illegal arguments, maybe missing " - "a PROPERTIES specifier?"); - return false; + numFiles++; } } if(propertyPairs.empty()) From 5d1d995bb7a982b13d691f7a926e497f4c44d6f1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 26 Mar 2015 00:01:04 -0400 Subject: [PATCH 0355/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8f0e54c40..baf3b2b41 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150325) +set(CMake_VERSION_PATCH 20150326) #set(CMake_VERSION_RC 1) From a8e7a1047ad3b61238f073ea3d2cd138f207c1ed Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 26 Mar 2015 09:32:39 -0400 Subject: [PATCH 0356/1029] GNU: Do not use -isystem with gfortran The compiler documents that USE statements search for ".mod" files in directories specified with -I, but not -isystem. Reported-by: Hugh Sorby --- Modules/Compiler/GNU-Fortran.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index dfd79274d..e9c8a594a 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -8,5 +8,8 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") +# No -isystem for Fortran because it will not find .mod files. +unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran) + # Fortran-specific feature flags. set(CMAKE_Fortran_MODDIR_FLAG -J) From e680d43d7dd96096962379f627828a182ac0fa80 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 26 Mar 2015 11:05:56 -0400 Subject: [PATCH 0357/1029] Fix an unused variable warning from scanbuild. --- Source/cmSetTestsPropertiesCommand.cxx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index d079a19a4..e9cfaccea 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -26,14 +26,12 @@ bool cmSetTestsPropertiesCommand // first collect up the list of files std::vector propertyPairs; - bool doingFiles = true; int numFiles = 0; std::vector::const_iterator j; for(j= args.begin(); j != args.end();++j) { if(*j == "PROPERTIES") { - doingFiles = false; // now loop through the rest of the arguments, new style ++j; if (std::distance(j, args.end()) % 2 != 0) @@ -44,15 +42,9 @@ bool cmSetTestsPropertiesCommand propertyPairs.insert(propertyPairs.end(), j, args.end()); break; } - else if (doingFiles) - { - numFiles++; - } else { - this->SetError("called with illegal arguments, maybe " - "missing a PROPERTIES specifier?"); - return false; + numFiles++; } } if(propertyPairs.empty()) @@ -62,7 +54,6 @@ bool cmSetTestsPropertiesCommand return false; } - // now loop over all the targets int i; for(i = 0; i < numFiles; ++i) From 8603791553965de4d80a42347022dec1fbd8cd98 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 26 Mar 2015 16:56:44 +0100 Subject: [PATCH 0358/1029] CPackWIX: Add static_casts for XML_Parser. "XML_Parser" in cmexpat is a typedef for void* while newer releases of expat seem to use struct XML_ParserStruct *XML_Parser. Add static_casts so that the build works with either variant. --- Source/CPack/WiX/cmWIXPatchParser.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index ef67b23ec..e066c280f 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -132,8 +132,8 @@ void cmWIXPatchParser::ReportError(int line, int column, const char* msg) void cmWIXPatchParser::ReportValidationError(std::string const& message) { - ReportError(XML_GetCurrentLineNumber(Parser), - XML_GetCurrentColumnNumber(Parser), + ReportError(XML_GetCurrentLineNumber(static_cast(this->Parser)), + XML_GetCurrentColumnNumber(static_cast(this->Parser)), message.c_str()); } From a704098de83460e8e9bae02434a6c31e7fc3ffd7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 26 Mar 2015 18:12:04 -0400 Subject: [PATCH 0359/1029] ExternalProject: fix the build command for generator overrides The `binary_dir` variable is never set, so this is invalid. Instead, use "." which all the other build commands use anyways. Also only set the --config option if it is meaningful. --- Modules/ExternalProject.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d7b985de9..0c73d41a2 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1197,7 +1197,10 @@ function(_ep_get_build_command name step cmd_var) else() set(cmd "${CMAKE_COMMAND}") endif() - set(args --build ${binary_dir} --config ${CMAKE_CFG_INTDIR}) + set(args --build ".") + if (CMAKE_CFG_INTDIR AND NOT CMAKE_CFG_INTDIR STREQUAL ".") + list(APPEND args --config "${CMAKE_CFG_INTDIR}") + endif () if(step STREQUAL "INSTALL") list(APPEND args --target install) endif() From 685d179b8b8e0f0b98dbfd227f6ccd88b17749b0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 27 Mar 2015 00:01:04 -0400 Subject: [PATCH 0360/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index baf3b2b41..999182f94 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150326) +set(CMake_VERSION_PATCH 20150327) #set(CMake_VERSION_RC 1) From 98a3b2e29ece5195e7948681a410bc5fae880a23 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 27 Mar 2015 12:22:15 +0100 Subject: [PATCH 0361/1029] CPackWIX: Omit codepage conversion when internal encoding is already UTF-8. --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/WiX/cmWIXSourceWriter.cxx | 10 ++++++++-- Source/CPack/WiX/cmWIXSourceWriter.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 257ce7ae3..99eabf20f 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -430,7 +430,7 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, tmp << name << "=\"" << value << '"'; source.AddProcessingInstruction("define", - cmWIXSourceWriter::WindowsCodepageToUtf8(tmp.str())); + cmWIXSourceWriter::CMakeEncodingToUtf8(tmp.str())); } bool cmCPackWIXGenerator::CreateWiXSourceFiles() diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index aad19daf1..219fca84a 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -10,6 +10,8 @@ See the License for more information. ============================================================================*/ +#include "cmStandardIncludes.h" + #include "cmWIXSourceWriter.h" #include @@ -118,7 +120,7 @@ void cmWIXSourceWriter::AddProcessingInstruction( void cmWIXSourceWriter::AddAttribute( std::string const& key, std::string const& value) { - std::string utf8 = WindowsCodepageToUtf8(value); + std::string utf8 = CMakeEncodingToUtf8(value); File << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"'; } @@ -132,8 +134,11 @@ void cmWIXSourceWriter::AddAttributeUnlessEmpty( } } -std::string cmWIXSourceWriter::WindowsCodepageToUtf8(std::string const& value) +std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) { +#ifdef CMAKE_ENCODING_UTF8 + return value; +#else if(value.empty()) { return std::string(); @@ -167,6 +172,7 @@ std::string cmWIXSourceWriter::WindowsCodepageToUtf8(std::string const& value) &utf8[0], static_cast(utf8.size()), 0, 0); return std::string(&utf8[0], utf8.size()); +#endif } diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 3957d9663..3b9999cc6 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -43,7 +43,7 @@ public: void AddAttributeUnlessEmpty( std::string const& key, std::string const& value); - static std::string WindowsCodepageToUtf8(std::string const& value); + static std::string CMakeEncodingToUtf8(std::string const& value); protected: cmCPackLog* Logger; From 9e14a5dee2b7ec420fcfea49c2f2f41da84e2cbf Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Mar 2015 09:32:53 -0400 Subject: [PATCH 0362/1029] cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin --- Source/cmGlobalXCodeGenerator.cxx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d340e724f..447f97583 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -21,6 +21,7 @@ #include "cmCustomCommandGenerator.h" #include "cmGeneratorTarget.h" #include "cmGlobalGeneratorFactory.h" +#include "cmAlgorithms.h" #include @@ -3415,16 +3416,7 @@ bool cmGlobalXCodeGenerator this->Architectures); buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); - std::string archString; - const char* sep = ""; - for( std::vector::iterator i = - this->Architectures.begin(); - i != this->Architectures.end(); ++i) - { - archString += sep; - archString += *i; - sep = " "; - } + std::string const& archString = cmJoin(this->Architectures, " "); buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); } From b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Mar 2015 10:46:11 -0400 Subject: [PATCH 0363/1029] Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736) Teach the Xcode generator that ONLY_ACTIVE_ARCH=YES means to use ARCHS, and that the default of ONLY_ACTIVE_ARCH=NO means to use NATIVE_ARCH and ignore ARCHS. In the latter case there is no reason to generate ARCHS. --- Modules/CompilerId/Xcode-3.pbxproj.in | 1 - Source/cmGlobalXCodeGenerator.cxx | 51 +++++++++++---------------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index 7f686a27b..20f3da312 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -79,7 +79,6 @@ 1DEB928A08733DD80010E9CD = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ONLY_ACTIVE_ARCH = YES; CODE_SIGNING_REQUIRED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 447f97583..f139ad10d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3381,44 +3381,33 @@ bool cmGlobalXCodeGenerator this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); const char* osxArch = this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); - if(!osxArch || strlen(osxArch) == 0) - { - if(this->XcodeVersion >= 32) - { - osxArch = "$(ARCHS_STANDARD_32_64_BIT)"; - } - else if(this->XcodeVersion == 31) - { - osxArch = "$(ARCHS_STANDARD_32_BIT)"; - } - else if(this->XcodeVersion <= 30) - { -#ifdef __ppc__ - osxArch = "ppc"; -#endif -#ifdef __i386 - osxArch = "i386"; -#endif - } - buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", - this->CreateString("YES")); - } - const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - if(osxArch && sysroot) + std::string archs; + if(sysroot) { - // recompute this as it may have been changed since enable language - this->Architectures.clear(); - cmSystemTools::ExpandListArgument(std::string(osxArch), - this->Architectures); + if(osxArch) + { + // recompute this as it may have been changed since enable language + this->Architectures.clear(); + cmSystemTools::ExpandListArgument(std::string(osxArch), + this->Architectures); + archs = cmJoin(this->Architectures, " "); + } buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); - std::string const& archString = cmJoin(this->Architectures, " "); - buildSettings->AddAttribute("ARCHS", - this->CreateString(archString.c_str())); + } + if (archs.empty()) + { + // Tell Xcode to use NATIVE_ARCH instead of ARCHS. + buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); + } + else + { + // Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO). + buildSettings->AddAttribute("ARCHS", this->CreateString(archs.c_str())); } if(deploymentTarget && *deploymentTarget) { From 564c07f7dd819d9ea070b22ad16849d3be6bb89a Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Mar 2015 09:29:55 -0400 Subject: [PATCH 0364/1029] ExternalData: Parameterize internal file(GLOB) operation selection Extend the _ExternalData_arg_find_files signature with an option to specify the kind of file(GLOB) operation to be performed. Set CMP0009 to NEW so that GLOB_RECURSE does not follow symlinks. --- Modules/ExternalData.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index b3206beb5..eab266f28 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -685,7 +685,8 @@ macro(_ExternalData_arg_associated) # Find files named explicitly. foreach(file ${associated_files}) _ExternalData_exact_regex(file_regex "${file}") - _ExternalData_arg_find_files("${reldir}${file}" "${reldir_regex}${file_regex}") + _ExternalData_arg_find_files(GLOB "${reldir}${file}" + "${reldir_regex}${file_regex}") endforeach() # Find files matching the given regular expressions. @@ -695,13 +696,13 @@ macro(_ExternalData_arg_associated) set(all "${all}${sep}${reldir_regex}${regex}") set(sep "|") endforeach() - _ExternalData_arg_find_files("${reldir}" "${all}") + _ExternalData_arg_find_files(GLOB "${reldir}" "${all}") endmacro() macro(_ExternalData_arg_single) # Match only the named data by itself. _ExternalData_exact_regex(data_regex "${reldata}") - _ExternalData_arg_find_files("${reldata}" "${data_regex}") + _ExternalData_arg_find_files(GLOB "${reldata}" "${data_regex}") endmacro() macro(_ExternalData_arg_series) @@ -756,12 +757,15 @@ macro(_ExternalData_arg_series) # Then match base, number, and extension. _ExternalData_exact_regex(series_base "${relbase}") _ExternalData_exact_regex(series_ext "${ext}") - _ExternalData_arg_find_files("${relbase}*${ext}" + _ExternalData_arg_find_files(GLOB "${relbase}*${ext}" "${series_base}${series_match}${series_ext}") endmacro() -function(_ExternalData_arg_find_files pattern regex) - file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") +function(_ExternalData_arg_find_files glob pattern regex) + cmake_policy(PUSH) + cmake_policy(SET CMP0009 NEW) + file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") + cmake_policy(POP) foreach(entry IN LISTS globbed) if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$") set(relname "${CMAKE_MATCH_1}") From 230f2d6e7060e70b7205fc65f6bee7ce37e3f27b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Mar 2015 10:23:51 -0400 Subject: [PATCH 0365/1029] ExternalData: Add option to recursively match under directories Extend the ``DATA{Dir/,...}`` syntax with a new ``RECURSE:`` option to enable recursive matching of associated files. This will allow an entire directory tree of data to be referenced at once. --- .../dev/ExternalData-recursive-match.rst | 7 ++++++ Modules/ExternalData.cmake | 23 ++++++++++++++++--- Tests/Module/ExternalData/CMakeLists.txt | 1 + Tests/Module/ExternalData/Data1Check.cmake | 6 +++++ .../Module/ExternalData/DirRecurse/A.dat.md5 | 1 + .../Module/ExternalData/DirRecurse/B.dat.md5 | 1 + .../Module/ExternalData/DirRecurse/C.dat.md5 | 1 + .../ExternalData/DirRecurse/Sub1/A.dat.md5 | 1 + .../ExternalData/DirRecurse/Sub1/B.dat.md5 | 1 + .../ExternalData/DirRecurse/Sub1/C.dat.md5 | 1 + .../DirRecurse/Sub2/Dir/A.dat.md5 | 1 + .../DirRecurse/Sub2/Dir/B.dat.md5 | 1 + .../DirRecurse/Sub2/Dir/C.dat.md5 | 1 + .../ExternalData/BadRecurse1-result.txt | 1 + .../ExternalData/BadRecurse1-stderr.txt | 6 +++++ Tests/RunCMake/ExternalData/BadRecurse1.cmake | 2 ++ .../ExternalData/BadRecurse2-result.txt | 1 + .../ExternalData/BadRecurse2-stderr.txt | 6 +++++ Tests/RunCMake/ExternalData/BadRecurse2.cmake | 2 ++ .../ExternalData/BadRecurse3-result.txt | 1 + .../ExternalData/BadRecurse3-stderr.txt | 9 ++++++++ Tests/RunCMake/ExternalData/BadRecurse3.cmake | 2 ++ .../RunCMake/ExternalData/RunCMakeTest.cmake | 3 +++ 23 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 Help/release/dev/ExternalData-recursive-match.rst create mode 100644 Tests/Module/ExternalData/DirRecurse/A.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/B.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/C.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 create mode 100644 Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 create mode 100644 Tests/RunCMake/ExternalData/BadRecurse1-result.txt create mode 100644 Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt create mode 100644 Tests/RunCMake/ExternalData/BadRecurse1.cmake create mode 100644 Tests/RunCMake/ExternalData/BadRecurse2-result.txt create mode 100644 Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt create mode 100644 Tests/RunCMake/ExternalData/BadRecurse2.cmake create mode 100644 Tests/RunCMake/ExternalData/BadRecurse3-result.txt create mode 100644 Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt create mode 100644 Tests/RunCMake/ExternalData/BadRecurse3.cmake diff --git a/Help/release/dev/ExternalData-recursive-match.rst b/Help/release/dev/ExternalData-recursive-match.rst new file mode 100644 index 000000000..4d8c7899f --- /dev/null +++ b/Help/release/dev/ExternalData-recursive-match.rst @@ -0,0 +1,7 @@ +ExternalData-recursive-match +---------------------------- + +* The :module:`ExternalData` module learned a new ``RECURSE:`` + option in ``DATA{}`` references specifying directories. + This allows an entire directory tree of associated files + to be matched. diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index eab266f28..883ab6935 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -244,7 +244,8 @@ associated file options. For example, the argument ``DATA{MyDataDir/,REGEX:.*}`` will pass the full path to a ``MyDataDir`` directory on the command line and ensure that the directory contains files corresponding to every file or content link in the ``MyDataDir`` -source directory. +source directory. In order to match associated files in subdirectories, +specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``. Hash Algorithms ^^^^^^^^^^^^^^^ @@ -597,6 +598,7 @@ function(_ExternalData_arg target arg options var_file) # Process options. set(series_option "") + set(recurse_option "") set(associated_files "") set(associated_regex "") foreach(opt ${options}) @@ -606,6 +608,9 @@ function(_ExternalData_arg target arg options var_file) elseif(opt STREQUAL ":") # Activate series matching. set(series_option "${opt}") + elseif(opt STREQUAL "RECURSE:") + # Activate recursive matching in directories. + set(recurse_option "${opt}") elseif("x${opt}" MATCHES "^[^][:/*?]+$") # Specific associated file. list(APPEND associated_files "${opt}") @@ -622,6 +627,9 @@ function(_ExternalData_arg target arg options var_file) if(associated_files OR associated_regex) message(FATAL_ERROR "Series option \"${series_option}\" not allowed with associated files.") endif() + if(recurse_option) + message(FATAL_ERROR "Recurse option \"${recurse_option}\" allowed only with directories.") + endif() # Load a whole file series. _ExternalData_arg_series() elseif(data_is_directory) @@ -634,6 +642,9 @@ function(_ExternalData_arg target arg options var_file) "must list associated files.") endif() else() + if(recurse_option) + message(FATAL_ERROR "Recurse option \"${recurse_option}\" allowed only with directories.") + endif() # Load the named data file. _ExternalData_arg_single() if(associated_files OR associated_regex) @@ -681,11 +692,17 @@ macro(_ExternalData_arg_associated) set(reldir "${reldir}/") endif() _ExternalData_exact_regex(reldir_regex "${reldir}") + if(recurse_option) + set(glob GLOB_RECURSE) + set(reldir_regex "${reldir_regex}(.+/)?") + else() + set(glob GLOB) + endif() # Find files named explicitly. foreach(file ${associated_files}) _ExternalData_exact_regex(file_regex "${file}") - _ExternalData_arg_find_files(GLOB "${reldir}${file}" + _ExternalData_arg_find_files(${glob} "${reldir}${file}" "${reldir_regex}${file_regex}") endforeach() @@ -696,7 +713,7 @@ macro(_ExternalData_arg_associated) set(all "${all}${sep}${reldir_regex}${regex}") set(sep "|") endforeach() - _ExternalData_arg_find_files(GLOB "${reldir}" "${all}") + _ExternalData_arg_find_files(${glob} "${reldir}" "${all}") endmacro() macro(_ExternalData_arg_single) diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index 6c5e59c69..b6e24d247 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -44,6 +44,7 @@ ExternalData_Add_Test(Data1 -D Paired=DATA{PairedA.dat,PairedB.dat} -D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat} -D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat} + -D DirRecurse=DATA{DirRecurse/,RECURSE:,A.dat,REGEX:[BC].dat} -D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}" -P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake ) diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake index 9845a3b83..f60c2094d 100644 --- a/Tests/Module/ExternalData/Data1Check.cmake +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -90,6 +90,12 @@ foreach(n A B C) message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") endif() endforeach() +foreach(n A Sub1/A Sub2/Dir/A B Sub1/B Sub2/Dir/B C Sub1/C Sub2/Dir/C) + set(file "${DirRecurse}/${n}.dat") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() list(LENGTH Semicolons len) if("${len}" EQUAL 2) foreach(file ${Semicolons}) diff --git a/Tests/Module/ExternalData/DirRecurse/A.dat.md5 b/Tests/Module/ExternalData/DirRecurse/A.dat.md5 new file mode 100644 index 000000000..4a78fc783 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/DirRecurse/B.dat.md5 b/Tests/Module/ExternalData/DirRecurse/B.dat.md5 new file mode 100644 index 000000000..4557a216a --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/DirRecurse/C.dat.md5 b/Tests/Module/ExternalData/DirRecurse/C.dat.md5 new file mode 100644 index 000000000..a7f23dd7f --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 new file mode 100644 index 000000000..4a78fc783 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 new file mode 100644 index 000000000..4557a216a --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 new file mode 100644 index 000000000..a7f23dd7f --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 new file mode 100644 index 000000000..4a78fc783 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 new file mode 100644 index 000000000..4557a216a --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 new file mode 100644 index 000000000..a7f23dd7f --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/RunCMake/ExternalData/BadRecurse1-result.txt b/Tests/RunCMake/ExternalData/BadRecurse1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt new file mode 100644 index 000000000..aedc33015 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Recurse option "RECURSE:" allowed only with directories. +Call Stack \(most recent call first\): + .* + BadRecurse1.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse1.cmake b/Tests/RunCMake/ExternalData/BadRecurse1.cmake new file mode 100644 index 000000000..f70b9f9d5 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse1.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{Series.txt,:,RECURSE:}) diff --git a/Tests/RunCMake/ExternalData/BadRecurse2-result.txt b/Tests/RunCMake/ExternalData/BadRecurse2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt new file mode 100644 index 000000000..3f809ca69 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Recurse option "RECURSE:" allowed only with directories. +Call Stack \(most recent call first\): + .* + BadRecurse2.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse2.cmake b/Tests/RunCMake/ExternalData/BadRecurse2.cmake new file mode 100644 index 000000000..c4dc35d54 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse2.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{Data.txt,RECURSE:}) diff --git a/Tests/RunCMake/ExternalData/BadRecurse3-result.txt b/Tests/RunCMake/ExternalData/BadRecurse3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt new file mode 100644 index 000000000..37740e0f7 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown option "RECURSE:x" in argument + + DATA{Directory1/,RECURSE:x,Data.dat} + +Call Stack \(most recent call first\): + .* + BadRecurse3.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse3.cmake b/Tests/RunCMake/ExternalData/BadRecurse3.cmake new file mode 100644 index 000000000..9a22f6218 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse3.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{Directory1/,RECURSE:x,Data.dat}) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index 241fa1fba..b5ab22d1a 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -9,6 +9,9 @@ run_cmake(BadCustom4) run_cmake(BadHashAlgo1) run_cmake(BadOption1) run_cmake(BadOption2) +run_cmake(BadRecurse1) +run_cmake(BadRecurse2) +run_cmake(BadRecurse3) run_cmake(BadSeries1) run_cmake(BadSeries2) run_cmake(BadSeries3) From 4d08e6b6dd21658bdcdc4dc1cd2a2b03d377d531 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Mar 2015 15:27:40 -0400 Subject: [PATCH 0366/1029] QtAutogen: Fix rcc rebuild with Ninja generator (#15459) The rcc outputs are byproducts of the cmake_autogen rule, not outputs. We still must run cmake_autogen on every run even if the rcc outputs exist. Ninja requires explicit byproduct specification, which is now possible in CMake since commit v3.2.0-rc1~340^2~2 (Add an option for explicit BYPRODUCTS of custom commands, 2014-11-13). Revise the logic introduced by commit v3.2.0-rc1~480^2 (QtAutogen: Regenerate qrc files if their input changes, 2014-09-17) to specify byproducts explicitly. --- Source/cmQtAutoGenerators.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 08092c744..4cb49c8a9 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -374,7 +374,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #endif std::vector rcc_output; - if(makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja" + bool const isNinja = + makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja"; + if(isNinja #if defined(_WIN32) && !defined(__CYGWIN__) || usePRE_BUILD #endif @@ -444,7 +446,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #endif { cmTarget* autogenTarget = 0; - if (!rcc_output.empty()) + if (!rcc_output.empty() && !isNinja) { std::vector no_byproducts; makefile->AddCustomCommandToOutput(rcc_output, no_byproducts, @@ -464,7 +466,8 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) { autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, - workingDirectory.c_str(), depends, + workingDirectory.c_str(), + /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); } From 817d31db9797bfc1c6ff7e60e420532362b14463 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Mar 2015 16:23:41 -0400 Subject: [PATCH 0367/1029] Help: Format add_dependencies documentation Add reStructuredText markup. --- Help/command/add_dependencies.rst | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst index 10997ec20..1cbac200b 100644 --- a/Help/command/add_dependencies.rst +++ b/Help/command/add_dependencies.rst @@ -7,13 +7,16 @@ Add a dependency between top-level targets. add_dependencies( []...) -Make a top-level depend on other top-level targets to ensure -that they build before does. A top-level target is one -created by ADD_EXECUTABLE, ADD_LIBRARY, or ADD_CUSTOM_TARGET. -Dependencies added to an IMPORTED target are followed transitively in -its place since the target itself does not build. +Make a top-level ```` depend on other top-level targets to +ensure that they build before ```` does. A top-level target +is one created by one of the :command:`add_executable`, +:command:`add_library`, or :command:`add_custom_target` commands. -See the DEPENDS option of ADD_CUSTOM_TARGET and ADD_CUSTOM_COMMAND for -adding file-level dependencies in custom rules. See the -OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to add file-level -dependencies to object files. +Dependencies added to an :ref:`imported target ` +are followed transitively in its place since the target itself does +not build. + +See the ``DEPENDS`` option of :command:`add_custom_target` and +:command:`add_custom_command` commands for adding file-level +dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS` +source file property to add file-level dependencies to object files. From ac14cbf01710c08e9bf31670cf40d88512b55752 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 27 Mar 2015 16:25:09 -0400 Subject: [PATCH 0368/1029] Allow add_dependencies() on INTERFACE libraries (#15414) Revert commit v3.0.0-rc1~175^2~20 (add_dependencies: Disallow use with INTERFACE_LIBRARY, 2013-12-25). Teach our dependency analysis to transitively follow INTERFACE target utility dependencies as was done or IMPORTED targets in commit v2.8.6~127^2~1 (Allow add_dependencies() on imported targets, 2010-11-19). Extend the InterfaceLibrary test with a case to cover header generation for a header-only INTERFACE library via a custom target. --- Help/command/add_dependencies.rst | 4 ++-- .../dev/add_dependencies-INTERFACE-libraries.rst | 7 +++++++ Source/cmAddDependenciesCommand.cxx | 9 --------- Source/cmComputeTargetDepends.cxx | 6 ++++-- Tests/InterfaceLibrary/headerdir/CMakeLists.txt | 11 ++++++++--- .../headerdir/iface_header_builddir.h.in | 1 + Tests/RunCMake/interface_library/RunCMakeTest.cmake | 1 - .../interface_library/add_dependencies-result.txt | 1 - .../interface_library/add_dependencies-stderr.txt | 6 ------ .../RunCMake/interface_library/add_dependencies.cmake | 4 ---- 10 files changed, 22 insertions(+), 28 deletions(-) create mode 100644 Help/release/dev/add_dependencies-INTERFACE-libraries.rst create mode 100644 Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in delete mode 100644 Tests/RunCMake/interface_library/add_dependencies-result.txt delete mode 100644 Tests/RunCMake/interface_library/add_dependencies-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/add_dependencies.cmake diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst index 1cbac200b..c3583cf95 100644 --- a/Help/command/add_dependencies.rst +++ b/Help/command/add_dependencies.rst @@ -13,8 +13,8 @@ is one created by one of the :command:`add_executable`, :command:`add_library`, or :command:`add_custom_target` commands. Dependencies added to an :ref:`imported target ` -are followed transitively in its place since the target itself does -not build. +or an :ref:`interface library ` are followed +transitively in its place since the target itself does not build. See the ``DEPENDS`` option of :command:`add_custom_target` and :command:`add_custom_command` commands for adding file-level diff --git a/Help/release/dev/add_dependencies-INTERFACE-libraries.rst b/Help/release/dev/add_dependencies-INTERFACE-libraries.rst new file mode 100644 index 000000000..dfac2aff7 --- /dev/null +++ b/Help/release/dev/add_dependencies-INTERFACE-libraries.rst @@ -0,0 +1,7 @@ +add_dependencies-INTERFACE-libraries +------------------------------------ + +* The :command:`add_dependencies` command learned to allow dependencies + to be added to :ref:`interface libraries `. + Dependencies added to an interface library are followed transitively + in its place since the target itself does not build. diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index b560452c4..3a7494650 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -33,15 +33,6 @@ bool cmAddDependenciesCommand } if(cmTarget* target = this->Makefile->FindTargetToUse(target_name)) { - if (target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - std::ostringstream e; - e << "Cannot add target-level dependencies to INTERFACE library " - "target \"" << target_name << "\".\n"; - this->SetError(e.str()); - return false; - } - std::vector::const_iterator s = args.begin(); ++s; // skip over target_name for (; s != args.end(); ++s) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index cf2b88e4a..bbffd5da0 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -418,9 +418,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, cmTarget const* dependee, bool linking) { - if(dependee->IsImported()) + if(dependee->IsImported() || + dependee->GetType() == cmTarget::INTERFACE_LIBRARY) { - // Skip imported targets but follow their utility dependencies. + // Skip IMPORTED and INTERFACE targets but follow their utility + // dependencies. std::set const& utils = dependee->GetUtilityItems(); for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt index 98f521e8c..826a9ed9c 100644 --- a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt +++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt @@ -3,6 +3,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library(headeriface INTERFACE) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h" - "#define IFACE_HEADER_BUILDDIR\n" -) +add_custom_target(headeriface_gen + COMMENT "Generating iface_header_builddir.h" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/iface_header_builddir.h.in + ${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h + VERBATIM + ) +add_dependencies(headeriface headeriface_gen) diff --git a/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in b/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in new file mode 100644 index 000000000..42dd6dfd9 --- /dev/null +++ b/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in @@ -0,0 +1 @@ +#define IFACE_HEADER_BUILDDIR diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index 08e81c6c8..201daa7c7 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -7,5 +7,4 @@ run_cmake(whitelist) run_cmake(invalid_signature) run_cmake(global-interface) run_cmake(genex_link) -run_cmake(add_dependencies) run_cmake(add_custom_command-TARGET) diff --git a/Tests/RunCMake/interface_library/add_dependencies-result.txt b/Tests/RunCMake/interface_library/add_dependencies-result.txt deleted file mode 100644 index d00491fd7..000000000 --- a/Tests/RunCMake/interface_library/add_dependencies-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt deleted file mode 100644 index c550b6869..000000000 --- a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at add_dependencies.cmake:4 \(add_dependencies\): - add_dependencies Cannot add target-level dependencies to INTERFACE library - target "iface". - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/add_dependencies.cmake b/Tests/RunCMake/interface_library/add_dependencies.cmake deleted file mode 100644 index 12cdfb4ff..000000000 --- a/Tests/RunCMake/interface_library/add_dependencies.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -add_library(foo empty.cpp) -add_library(iface INTERFACE) -add_dependencies(iface foo) From 918fe54c829ebb39aa6bfbbc3f4eff401047b90a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 28 Mar 2015 00:01:04 -0400 Subject: [PATCH 0369/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 999182f94..100894bec 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150327) +set(CMake_VERSION_PATCH 20150328) #set(CMake_VERSION_RC 1) From d35da548886601c6b478a0c6341aad76feb2cc94 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 29 Mar 2015 00:01:04 -0400 Subject: [PATCH 0370/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 100894bec..8f75300cf 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150328) +set(CMake_VERSION_PATCH 20150329) #set(CMake_VERSION_RC 1) From 6474f0e2635e13bfa2592ad6ed2d3e026353955a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 30 Mar 2015 00:01:04 -0400 Subject: [PATCH 0371/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8f75300cf..ef2842a82 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150329) +set(CMake_VERSION_PATCH 20150330) #set(CMake_VERSION_RC 1) From e3f84fc504e96d1bdbc9c70434135903c449bdd1 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 25 Mar 2015 22:36:38 -0600 Subject: [PATCH 0372/1029] cpack: Fix CPACK_PACKAGING_INSTALL_PREFIX handling for archives (#14677) Fix the case when the archive generator is used to package components with an install prefix. --- Source/CPack/cmCPackArchiveGenerator.cxx | 8 ++++++ Tests/CMakeLists.txt | 28 +++++++++++++++++++ Tests/CPackComponentsPrefix/CMakeLists.txt | 13 +++++++++ .../file-development.txt | 1 + Tests/CPackComponentsPrefix/file-runtime.txt | 1 + 5 files changed, 51 insertions(+) create mode 100644 Tests/CPackComponentsPrefix/CMakeLists.txt create mode 100644 Tests/CPackComponentsPrefix/file-development.txt create mode 100644 Tests/CPackComponentsPrefix/file-runtime.txt diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index e2437b520..05b5cd997 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -63,6 +63,14 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); filePrefix += "/"; } + const char* installPrefix = + this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + if(installPrefix && installPrefix[0] == '/' && installPrefix[1] != 0) + { + // add to file prefix and remove the leading '/' + filePrefix += installPrefix+1; + filePrefix += "/"; + } std::vector::const_iterator fileIt; for (fileIt = component->Files.begin(); fileIt != component->Files.end(); ++fileIt ) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 41032f8f6..f2df4af89 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -862,6 +862,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK}) set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) + set(CTEST_RUN_CPackComponentsPrefix ${CTEST_TEST_CPACK}) # Do not try to build RPM if (NOT RPMBUILD_EXECUTABLE) @@ -1035,6 +1036,33 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators") endif() + if(CTEST_RUN_CPackComponentsPrefix) + set(CPackComponents_BUILD_OPTIONS) + if(APPLE) + set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) + endif() + if(NOT NSIS_MAKENSIS_EXECUTABLE) + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_NSIS:BOOL=OFF) + endif() + + add_test(CPackComponentsPrefix ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackComponentsPrefix" + "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix" + ${build_generator_args} + --build-project CPackComponentsPrefix + --build-two-config + --build-target package + --build-options ${build_options} + -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} + -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} + -DCPACK_BINARY_ZIP:BOOL=ON + ${CPackComponents_BUILD_OPTIONS} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix") + endif() + if(CTEST_package_X11_TEST) set(X11_build_target_arg --build-target package) else() diff --git a/Tests/CPackComponentsPrefix/CMakeLists.txt b/Tests/CPackComponentsPrefix/CMakeLists.txt new file mode 100644 index 000000000..207dae855 --- /dev/null +++ b/Tests/CPackComponentsPrefix/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackComponentsPrefix NONE) + +install(FILES file-runtime.txt + DESTINATION bin COMPONENT Runtime) +install(FILES file-development.txt + DESTINATION lib COMPONENT Development) + +set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 1) +set(CPACK_COMPONENTS_ALL Development) +set(CPACK_ARCHIVE_COMPONENT_INSTALL 1) +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/My-1.0") +include(CPack) diff --git a/Tests/CPackComponentsPrefix/file-development.txt b/Tests/CPackComponentsPrefix/file-development.txt new file mode 100644 index 000000000..df22d2f51 --- /dev/null +++ b/Tests/CPackComponentsPrefix/file-development.txt @@ -0,0 +1 @@ +This file is installed with the Development component. diff --git a/Tests/CPackComponentsPrefix/file-runtime.txt b/Tests/CPackComponentsPrefix/file-runtime.txt new file mode 100644 index 000000000..135c13d3e --- /dev/null +++ b/Tests/CPackComponentsPrefix/file-runtime.txt @@ -0,0 +1 @@ +This file is installed with the Runtime component. From b372a99a130ec89561b2ad8d3147298dff3cf4df Mon Sep 17 00:00:00 2001 From: Felix Schwitzer Date: Thu, 26 Mar 2015 21:03:20 +0100 Subject: [PATCH 0373/1029] UseSWIG: Do not use MAIN_DEPENDENCY on custom commands (#15480) Add the dependency on the main swig input source file as a normal DEPENDS option. We cannot use MAIN_DEPENDENCY because if there are multiple target languages then multiple custom commands would want to use the same MAIN_DEPENDENCY, but at most one custom command may specify a given source file as its MAIN_DEPENDENCY. Exposed by a CMP0057 warning. --- Modules/UseSWIG.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 7939b1f62..742341813 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -204,8 +204,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) ${swig_include_dirs} -o "${swig_generated_file_fullname}" "${swig_source_file_fullname}" - MAIN_DEPENDENCY "${swig_source_file_fullname}" - DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} + DEPENDS "${swig_source_file_fullname}" ${SWIG_MODULE_${name}_EXTRA_DEPS} COMMENT "Swig source") set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} PROPERTIES GENERATED 1) From d9420364a2c38434ac5864c0ca209d9c32f904df Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 30 Mar 2015 16:08:54 -0400 Subject: [PATCH 0374/1029] Move scanbuild exceptions out of dashboard script and into cmake. --- CTestCustom.cmake.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index f499be1d9..8c4d400a3 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -62,6 +62,18 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: "[0-9,]+ warnings? generated." + +# scanbuild exceptions + "char_traits.h:.*: warning: Null pointer argument in call to string length function" + "stl_construct.h:.*: warning: Forming reference to null pointer" + ".*stl_uninitialized.h:75:19: warning: Forming reference to null pointer.*" + ".*stl_vector.h:.*: warning: Returning null reference.*" + "warning: Value stored to 'yymsg' is never read" + "warning: Value stored to 'yytoken' is never read" + "index_encoder.c.241.2. warning: Value stored to .out_start. is never read" + "index.c.*warning: Access to field.*results in a dereference of a null pointer.*loaded from variable.*" + "cm_sha2.*warning: Value stored to.*is never read" + "testProcess.*warning: Dereference of null pointer .loaded from variable .invalidAddress.." ) if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") From 4adf1dad2a6e462364bae81030c928599d11c24f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 30 Mar 2015 16:32:26 -0400 Subject: [PATCH 0375/1029] Makefile: Tell GNU make to delete rule outputs on error (#15474) Add .DELETE_ON_ERROR to the "build.make" files that contain the actual build rules that generate files. This tells GNU make to delete the output of a rule if the recipe modifies the output but returns failure. This is particularly useful for custom commands that use shell redirection to produce a file. Do not add .DELETE_ON_ERROR for Borland or Watcom make tools because they may not tolerate it and would not honor it anyway. Other make tools that do not understand .DELETE_ON_ERROR will not be hurt. Suggested-by: Andrey Vihrov --- Source/cmGlobalBorlandMakefileGenerator.h | 1 + Source/cmGlobalUnixMakefileGenerator3.h | 3 +++ Source/cmGlobalWatcomWMakeGenerator.h | 1 + Source/cmMakefileTargetGenerator.cxx | 8 ++++++++ 4 files changed, 13 insertions(+) diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 120d2f807..005f0d694 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -46,6 +46,7 @@ public: cmMakefile *, bool optional); virtual bool AllowNotParallel() const { return false; } + virtual bool AllowDeleteOnError() const { return false; } }; #endif diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 50a901e2f..a76a835a7 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -128,6 +128,9 @@ public: /** Does the make tool tolerate .NOTPARALLEL? */ virtual bool AllowNotParallel() const { return true; } + /** Does the make tool tolerate .DELETE_ON_ERROR? */ + virtual bool AllowDeleteOnError() const { return true; } + virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: void WriteMainMakefile2(); diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 0e577b5d6..7bc209bc1 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -45,6 +45,7 @@ public: cmMakefile *, bool optional); virtual bool AllowNotParallel() const { return false; } + virtual bool AllowDeleteOnError() const { return false; } }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 641cd23cc..2cd2d3e13 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -122,6 +122,14 @@ void cmMakefileTargetGenerator::CreateRuleFile() return; } this->LocalGenerator->WriteDisclaimer(*this->BuildFileStream); + if (this->GlobalGenerator->AllowDeleteOnError()) + { + std::vector no_depends; + std::vector no_commands; + this->LocalGenerator->WriteMakeRule( + *this->BuildFileStream, "Delete rule output on recipe failure.", + ".DELETE_ON_ERROR", no_depends, no_commands, false); + } this->LocalGenerator->WriteSpecialTargetsTop(*this->BuildFileStream); } From a6b0b835acfedfe4f46e15b165b2aa9496371580 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 31 Mar 2015 00:01:04 -0400 Subject: [PATCH 0376/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ef2842a82..f4f3aa600 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150330) +set(CMake_VERSION_PATCH 20150331) #set(CMake_VERSION_RC 1) From 845c83756e282feb6086c93d52ee0a0d4eacce9c Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 08:50:40 -0400 Subject: [PATCH 0377/1029] Help: Add link target to cmake-language.7 lists section --- Help/manual/cmake-language.7.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 3e0297cf6..4a9f0b590 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -538,6 +538,8 @@ The :manual:`cmake-variables(7)` manual documents many variables that are provided by CMake or have meaning to CMake when set by project code. +.. _`CMake Language Lists`: + Lists ===== From d51c1f090a5df5a8cd8d58faeee3544b52463924 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 08:51:05 -0400 Subject: [PATCH 0378/1029] Help: Fix xref typos in target_compile_options docs Fix links to the COMPILE_OPTIONS directory and target properties. --- Help/command/target_compile_options.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 3362c5d88..73e01e7f8 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -20,8 +20,8 @@ alternative commands exist to add preprocessor definitions (:command:`target_compile_definitions` and :command:`add_definitions`) or include directories (:command:`target_include_directories` and :command:`include_directories`). See documentation of the -:prop_tgt:`directory ` and -:prop_tgt:` target ` ``COMPILE_OPTIONS`` properties. +:prop_dir:`directory ` and +:prop_tgt:`target ` ``COMPILE_OPTIONS`` properties. The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` From c46125dfac88d566f0bac380bbdee845e839082f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 08:55:16 -0400 Subject: [PATCH 0379/1029] Help: Refine COMPILE_OPTIONS property documentation Make wording of the directory and target properties more consitent and complementary. Specify that the value is a ";-list" with a link to the cmake-language(7) manual section on lists. --- Help/prop_dir/COMPILE_OPTIONS.rst | 4 ++-- Help/prop_tgt/COMPILE_OPTIONS.rst | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Help/prop_dir/COMPILE_OPTIONS.rst b/Help/prop_dir/COMPILE_OPTIONS.rst index 55308608e..877deb000 100644 --- a/Help/prop_dir/COMPILE_OPTIONS.rst +++ b/Help/prop_dir/COMPILE_OPTIONS.rst @@ -3,8 +3,8 @@ COMPILE_OPTIONS List of options to pass to the compiler. -This property specifies the list of options given so far to the -:command:`add_compile_options` command. +This property holds a :ref:`;-list ` of options +given so far to the :command:`add_compile_options` command. This property is used to initialize the :prop_tgt:`COMPILE_OPTIONS` target property when a target is created, which is used by the generators to set diff --git a/Help/prop_tgt/COMPILE_OPTIONS.rst b/Help/prop_tgt/COMPILE_OPTIONS.rst index 27cbec15f..36d786a7f 100644 --- a/Help/prop_tgt/COMPILE_OPTIONS.rst +++ b/Help/prop_tgt/COMPILE_OPTIONS.rst @@ -3,12 +3,13 @@ COMPILE_OPTIONS List of options to pass to the compiler. -This property specifies the list of options specified so far for this -property. +This property holds a :ref:`;-list ` of options +specified so far for its target. Use the :command:`target_compile_options` +command to append more options. This property is intialized by the :prop_dir:`COMPILE_OPTIONS` directory -property, which is used by the generators to set the options for the -compiler. +property when a target is created, and is used by the generators to set +the options for the compiler. Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual From 93a3ec8b7705c6edfa08a59a789d193fcb4cf4c1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 10:26:29 -0400 Subject: [PATCH 0380/1029] CPack: Fix make tool selection during preinstall (#15483) The CMAKE_MAKE_PROGRAM selected by CMake while configuring the project should also be used to drive the "preinstall" target during packaging. Teach CPack to use "cmake --build" instead of constructing the build command line itself. The "cmake --build" command already knows how to select the proper make tool. --- Source/CPack/cmCPackGenerator.cxx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index ee255afbb..67005ef2b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -655,26 +655,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); // Does this generator require pre-install? - if ( globalGenerator->GetPreinstallTargetName() ) + if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) { - globalGenerator->FindMakeProgram(this->MakefileMap); - std::string cmakeMakeProgram - = this->MakefileMap->GetSafeDefinition("CMAKE_MAKE_PROGRAM"); - std::vector buildCommand; - globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram, - installProjectName, installDirectory, - globalGenerator->GetPreinstallTargetName(), - buildConfig, false, false); - std::string buildCommandStr = - cmSystemTools::PrintSingleCommand(buildCommand); + std::string buildCommand = + globalGenerator->GenerateCMakeBuildCommand( + preinstall, buildConfig, "", false); cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Install command: " << buildCommandStr << std::endl); + "- Install command: " << buildCommand << std::endl); cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Run preinstall target for: " << installProjectName << std::endl); std::string output; int retVal = 1; bool resB = - cmSystemTools::RunSingleCommand(buildCommand, + cmSystemTools::RunSingleCommand(buildCommand.c_str(), &output, &retVal, installDirectory.c_str(), @@ -684,12 +677,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/PreinstallOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommandStr << std::endl + ofs << "# Run command: " << buildCommand << std::endl << "# Directory: " << installDirectory << std::endl << "# Output:" << std::endl << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << buildCommandStr + "Problem running install command: " << buildCommand << std::endl << "Please check " << tmpFile << " for errors" << std::endl); From 0778016a0bba246e46f628aecd64e0f8afcc0fdb Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 11:20:20 -0400 Subject: [PATCH 0381/1029] Tests: Do not try to use invalid "ld -v" flag on Solaris Fix the CMakeCommands.target_link_libraries test to use "-V" instead of "-v" on Solaris because the latter does not exist. --- .../target_link_libraries/cmp0022/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index 818b8c99c..741c73e77 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -22,8 +22,18 @@ generate_export_header(staticlib1) add_library(staticlib2 STATIC staticlib2.cpp) generate_export_header(staticlib2) target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) + +# Try adding a private link item to be propagated out of a static lib. +set(private_link "") if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) - target_link_libraries(staticlib1 LINK_PRIVATE "-Wl,-v") + if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set(private_link "-Wl,-V") + else() + set(private_link "-Wl,-v") + endif() +endif() +if(private_link) + target_link_libraries(staticlib1 LINK_PRIVATE "${private_link}") endif() add_executable(staticlib_exe staticlib_exe.cpp) From 1570a4df9246c5f9b7a6818c367ddb596b84d083 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 11:28:47 -0400 Subject: [PATCH 0382/1029] Help: Add notes for topic 'UseSWIG-no-MAIN_DEPENDENCY' --- Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst diff --git a/Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst b/Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst new file mode 100644 index 000000000..5311cf105 --- /dev/null +++ b/Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst @@ -0,0 +1,9 @@ +UseSWIG-no-MAIN_DEPENDENCY +-------------------------- + +* The :module:`UseSWIG` module ``SWIG_ADD_MODULE`` macro no + longer attaches the swig invocation custom command to the + ``.i`` source file in IDE projects. This is because only + one custom command can be safely attached to a given source + file, and adding multiple modules with the same ``.i`` file + for different languages requires more than one such command. From 44990732a8c2340193667c200987503bbbcb442f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 11:33:53 -0400 Subject: [PATCH 0383/1029] Help: Add notes for topic 'makefile-DELETE_ON_ERROR' --- Help/release/dev/makefile-DELETE_ON_ERROR.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/makefile-DELETE_ON_ERROR.rst diff --git a/Help/release/dev/makefile-DELETE_ON_ERROR.rst b/Help/release/dev/makefile-DELETE_ON_ERROR.rst new file mode 100644 index 000000000..c7c45fd5e --- /dev/null +++ b/Help/release/dev/makefile-DELETE_ON_ERROR.rst @@ -0,0 +1,7 @@ +makefile-DELETE_ON_ERROR +------------------------ + +* The Makefile generators now add ``.DELETE_ON_ERROR`` to the + makefiles that contain the actual build rules for files on disk. + This tells GNU make to remove rule outputs when their recipe + modifies an output but fails. From 681f3a2f012dcd17f63faa3c6f932ae92278e3bd Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 29 Mar 2015 20:55:20 +0200 Subject: [PATCH 0384/1029] CPackRPM: Add basic symlink support (#15209) RPM packages can contain symbolic links to relative paths - including support for multiple relocation paths through generation of post install relocation scripts. Add basic support with limitations described in documentation. --- Modules/CPackRPM.cmake | 362 +++++++++++++++++- Tests/CMakeLists.txt | 1 + Tests/CPackComponentsForAll/CMakeLists.txt | 41 +- .../RunCPackVerifyResult.cmake | 91 ++++- .../symlink_postinstall_expected.txt | 57 +++ 5 files changed, 526 insertions(+), 26 deletions(-) create mode 100644 Tests/CPackComponentsForAll/symlink_postinstall_expected.txt diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 162eba758..b8d518c17 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -418,6 +418,41 @@ # # May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM__PACKAGE_PREFIX # from relocatable RPM prefix paths. +# +# Packaging of Symbolic Links +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# CPackRPM supports packaging of symbolic links:: +# +# execute_process(COMMAND ${CMAKE_COMMAND} +# -E create_symlink ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ +# DESTINATION COMPONENT libraries) +# +# Symbolic links will be optimized (paths will be shortened if possible) +# before being added to the package or if multiple relocation paths are +# detected, a post install symlink relocation script will be generated. +# +# Symbolic links may point to locations that are not packaged by the same +# package (either a different component or even not packaged at all) but +# those locations will be treated as if they were a part of the package +# while determining if symlink should be either created or present in a +# post install script - depending on relocation paths. +# +# Currenty there are a few limitations though: +# +# * Only symbolic links with relative path can be packaged. +# +# * For component based packaging component interdependency is not checked +# when processing symbolic links. Symbolic links pointing to content of +# a different component are treated the same way as if pointing to location +# that will not be packaged. +# +# * Symbolic links pointing to a location through one or more intermediate +# symbolic links will not be handled differently - if the intermediate +# symbolic link(s) is also on a relocatable path, relocating it during +# package installation may cause initial symbolic link to point to an +# invalid location. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -503,6 +538,301 @@ function(cpack_rpm_prepare_relocation_paths) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) endfunction() +function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) + foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) + string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") + if(FOUND_) + list(APPEND TMP_PREFIXES "${PKG_PREFIX}") + endif() + endforeach() + + set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) + list(LENGTH PACKAGE_PREFIXES LAST_INDEX) + set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}") + list(SORT SORTED_PACKAGE_PREFIXES) + list(REVERSE SORTED_PACKAGE_PREFIXES) + math(EXPR LAST_INDEX ${LAST_INDEX}-1) + + foreach(SYMLINK_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH) + list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic + string(LENGTH "${SRC_PATH}" SRC_PATH_LEN) + + set(PARTS_CNT 0) + set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n") + + # both paths relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(INDENT "") + else() + set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + set(INDENT " ") + endif() + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n") + endforeach() + + if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endif() + endif() + endforeach() + + # source path relocated + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endforeach() + endif() + + if(PARTS_CNT) + set(SCRIPT "${SCRIPT_PART}") + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # point path relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT "${SCRIPT} fi\n") + endforeach() + + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # no path relocated + if(_RPM_RELOCATION_SCRIPT_X_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT}fi\n") + endforeach() + endif() + + set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS) + list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN) + list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT) + + list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}") + list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO) + + if(SYMLINK_PATHS_COUTN) + foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX) + + # source path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X") + + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # both paths relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}") + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endforeach() + elseif(POINT_PATHS_COUNT) + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endif() + + # no path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X") + + # place variables into parent scope + foreach(VAR IN LISTS RELOCATION_VARS) + set(${VAR} "${${VAR}}" PARENT_SCOPE) + endforeach() + set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE) + set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE) + set(DIRECTIVE "%ghost " PARENT_SCOPE) +endfunction() + +function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE) + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild does + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir + string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST) + string(REPLACE "\n" ";" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(REPLACE "\"" "" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(LENGTH "${WDIR}" WDR_LEN_) + + list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms + + foreach(F IN LISTS INSTALL_FILES_LIST) + unset(DIRECTIVE) + + if(IS_SYMLINK "${WDIR}/${F}") + if(IS_RELOCATABLE) + # check that symlink has relocatable format + get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY) + execute_process(COMMAND ls -la "${WDIR}/${F}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE) + math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3) + string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) + + # get destination path + string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_) + + # check if path is relative or absolute + string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_) + + if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/") + # prevent absolute paths from having /../ or /./ section inside of them + get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE) + else() + # handle relative path + get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE) + endif() + + string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) + + cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") + cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS") + + list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT) + list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT) + + if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT) + # find matching + foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS) + list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX) + if(NOT ${FOUND_INDEX} EQUAL -1) + break() + endif() + endforeach() + + if(NOT ${FOUND_INDEX} EQUAL -1) + # symlinks have the same subpath + if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1) + # permanent symlink + get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY) + file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_}) + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}") + else() + # relocation subpaths + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + else() + # not on the same relocation path + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + elseif(POINT_RELOCATIONS_COUNT) + # point is relocatable + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + else() + # is not relocatable or points to non relocatable path - permanent symlink + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}") + endif() + endif() + elseif(IS_DIRECTORY "${WDIR}/${F}") + set(DIRECTIVE "%dir ") + endif() + + set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n") + endforeach() + + if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) + cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}") + endif() + + set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE) + set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE) +endfunction() + if(CMAKE_BINARY_DIR) message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") endif() @@ -963,9 +1293,10 @@ function(cpack_rpm_generate_package) # destinct parent paths of other relocation paths and remove the # final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) + set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") + list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) + foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") @@ -1142,25 +1473,13 @@ function(cpack_rpm_generate_package) set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() - - # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir - # This is necessary to avoid duplicate files since rpmbuild do - # recursion on its own when encountering a pathname which is a directory - # which is not flagged as %dir - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - if(IS_DIRECTORY "${WDIR}/${F}") - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") - else() - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endif() - endforeach() - set(CPACK_RPM_INSTALL_FILES_LIST "") + # Prepare install files + cpack_rpm_prepare_install_files( + "${CPACK_RPM_INSTALL_FILES}" + "${WDIR}" + "${RPM_USED_PACKAGE_PREFIXES}" + "${CPACK_RPM_PACKAGE_RELOCATABLE}" + ) # The name of the final spec file to be used by rpmbuild set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") @@ -1246,6 +1565,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean %post +\@RPM_SYMLINK_POSTINSTALL\@ \@CPACK_RPM_SPEC_POSTINSTALL\@ %postun diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f2df4af89..5944d081e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -991,6 +991,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ${build_generator_args} --build-project CPackComponentsForAll --build-options ${build_options} + -DCPACK_GENERATOR:STRING=${CPackGen} -DCPACK_BINARY_${CPackGen}:BOOL=ON ${CPackRun_CPackComponentWay} ${CPackComponentsForAll_BUILD_OPTIONS} diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 51af29769..1cc34b00a 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -49,6 +49,44 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) +if("${CPACK_GENERATOR}" MATCHES "RPM") + # Package symbolic links + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) + install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) + install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) + # test symbolic links to same dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to same dir with current dir ./ prefix + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to same dir with longer relative path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to sub dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) + # test symbolic links to parent dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) + # test symbolic link to another relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) + # test symbolic link to non relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) + # test symbolic link from non relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) + # test symbolic link relocatable path to its relocatable subpath + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic link to location outside package + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +endif() + # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_CONTACT "None") @@ -114,7 +152,8 @@ set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) # can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P # variable not being set set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" - "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable" + "${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable") # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index cf4da745c..e7470521c 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -1,3 +1,7 @@ +# prevent older policies from interfearing with this script +cmake_policy(PUSH) +cmake_policy(VERSION ${CMAKE_VERSION}) + message(STATUS "=============================================================================") message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message(STATUS "") @@ -138,6 +142,7 @@ if(CPackGen MATCHES "RPM") "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Static libraries used to build programs with MyLib") + set(LIB_SUFFIX "6?4?") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -174,10 +179,32 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/other_relocatable${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") + set(check_content_list "^/usr/foo/bar/lib${LIB_SUFFIX} +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_longer +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/symlink_subdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable/bar +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_other_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_to_non_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/libmylib.a +/usr/foo/bar/non_relocatable +/usr/foo/bar/non_relocatable/depth_two +/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path +/usr/foo/bar/other_relocatable +/usr/foo/bar/other_relocatable/depth_two$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") @@ -188,10 +215,12 @@ if(CPackGen MATCHES "RPM") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") - set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") + set(check_content_list "^/usr/foo/bar +/usr/foo/bar/bin +/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") @@ -269,5 +298,59 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() + + ####################### + # verify generated symbolic links + ####################### + file(GLOB_RECURSE symlink_files RELATIVE "${CPackComponentsForAll_BINARY_DIR}" "${CPackComponentsForAll_BINARY_DIR}/*/symlink_*") + + foreach(check_symlink IN LISTS symlink_files) + get_filename_component(symlink_name "${check_symlink}" NAME) + execute_process(COMMAND ls -la "${check_symlink}" + WORKING_DIRECTORY "${CPackComponentsForAll_BINARY_DIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if("${symlink_name}" STREQUAL "symlink_samedir_path" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_current_dir" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_longer") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_subdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_two/depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_parentdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}../$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_to_non_relocatable_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_outside_package") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath") + # these links were not canged - post install script only - ignore them + else() + message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'") + endif() + + if(NOT check_symlink) + message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'") + endif() + endforeach() + + # verify post install symlink relocation script + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*libraries*.spec") + file(READ ${spec_file} spec_file_content) + file(READ "${CMAKE_CURRENT_LIST_DIR}/symlink_postinstall_expected.txt" symlink_postinstall_expected) + # prepare regex + string(STRIP "${symlink_postinstall_expected}" symlink_postinstall_expected) + string(REPLACE "[" "\\[" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "$" "\\$" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "lib" "lib${LIB_SUFFIX}" symlink_postinstall_expected "${symlink_postinstall_expected}") + # compare + string(REGEX MATCH ".*${symlink_postinstall_expected}.*" symlink_postinstall_expected_matches "${spec_file_content}") + if(NOT symlink_postinstall_expected_matches) + message(FATAL_ERROR "error: unexpected rpm symbolic link postinstall script! generated spec file: '${spec_file_content}'") + endif() endif() endif() + +cmake_policy(POP) diff --git a/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt new file mode 100644 index 000000000..ba46792ee --- /dev/null +++ b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt @@ -0,0 +1,57 @@ +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi + fi + if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi +fi +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_2=true + fi +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" +fi From 68e13e98f5c719cba641bf7a3a01cbfd7c6bd394 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 14:07:13 -0400 Subject: [PATCH 0385/1029] Help: Add notes for topic 'cpack-rpm-basic-symlink-handling' --- Help/release/dev/cpack-rpm-basic-symlink-handling.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/cpack-rpm-basic-symlink-handling.rst diff --git a/Help/release/dev/cpack-rpm-basic-symlink-handling.rst b/Help/release/dev/cpack-rpm-basic-symlink-handling.rst new file mode 100644 index 000000000..3af4cf139 --- /dev/null +++ b/Help/release/dev/cpack-rpm-basic-symlink-handling.rst @@ -0,0 +1,6 @@ +cpack-rpm-basic-symlink-handling +-------------------------------- + +* The :module:`CPackRPM` module learned to package symbolic links + more cleanly and now supports directory symlinks with recent + ``rpmbuild`` versions. From 7b1cdb00279908cacabada92f8a53e4986465423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85dne=20Hovda?= Date: Mon, 30 Mar 2015 21:32:25 +0200 Subject: [PATCH 0386/1029] jsoncpp: Provide 'isfinite' implementation on older AIX and HP-UX Newer AIX and HP-UX platforms provide 'isfinite' as a macro. Older versions do not, so add the definition if it is not provided. --- Utilities/cmjsoncpp/src/lib_json/json_writer.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp index 7f8e6f11d..15222d6c4 100644 --- a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp +++ b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp @@ -27,6 +27,20 @@ # define isfinite finite #endif +// AIX +#if defined(_AIX) +# if !defined(isfinite) +# define isfinite finite +# endif +#endif + +// HP-UX +#if defined(__hpux) +# if !defined(isfinite) +# define isfinite finite +# endif +#endif + // Ancient glibc #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 # if !defined(isfinite) From b687d672815d45aab9d8043eef23405525aa98e2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 16:04:29 -0400 Subject: [PATCH 0387/1029] Tests: Fix RunCMake.CTestCommandLine expected output time matching When matching ctest command-line output, we must account for the formatting of times that take 10 seconds or more. The values are right-justified, so use " +" to match any amount of space before them. --- .../repeat-until-fail-ctest-stdout.txt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt index 0bc4f701b..6e133cdce 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt @@ -1,26 +1,26 @@ ^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-fail-build Start 1: initialization - Test #1: initialization ................... Passed [0-9.]+ sec + Test #1: initialization ................... Passed +[0-9.]+ sec Start 1: initialization - Test #1: initialization ................... Passed [0-9.]+ sec + Test #1: initialization ................... Passed +[0-9.]+ sec Start 1: initialization -1/4 Test #1: initialization ................... Passed [0-9.]+ sec +1/4 Test #1: initialization ................... Passed +[0-9.]+ sec Start 2: test1 - Test #2: test1 ............................ Passed [0-9.]+ sec + Test #2: test1 ............................ Passed +[0-9.]+ sec Start 2: test1 - Test #2: test1 ............................\*\*\*Failed [0-9.]+ sec + Test #2: test1 ............................\*\*\*Failed +[0-9.]+ sec Start 3: hello - Test #3: hello ............................ Passed [0-9.]+ sec + Test #3: hello ............................ Passed +[0-9.]+ sec Start 3: hello - Test #3: hello ............................ Passed [0-9.]+ sec + Test #3: hello ............................ Passed +[0-9.]+ sec Start 3: hello -3/4 Test #3: hello ............................ Passed [0-9.]+ sec +3/4 Test #3: hello ............................ Passed +[0-9.]+ sec Start 4: goodbye - Test #4: goodbye .......................... Passed [0-9.]+ sec + Test #4: goodbye .......................... Passed +[0-9.]+ sec Start 4: goodbye - Test #4: goodbye .......................... Passed [0-9.]+ sec + Test #4: goodbye .......................... Passed +[0-9.]+ sec Start 4: goodbye -4/4 Test #4: goodbye .......................... Passed [0-9.]+ sec +4/4 Test #4: goodbye .......................... Passed +[0-9.]+ sec + 75% tests passed, 1 tests failed out of 4 + From 3113d86df4b469abdf3852671dc985420e06d363 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 16:25:37 -0400 Subject: [PATCH 0388/1029] CTestCustom: Suppress OS X universal binary link arch warnings --- CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 8c4d400a3..d716498ac 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -53,6 +53,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" + "ld: warning: in .*/libgcc.a, file is not of required architecture" "warning.*This version of Mac OS X is unsupported" "clang.*: warning: argument unused during compilation: .-g" "note: in expansion of macro" # diagnostic context note From e86f44b72616ebce43dcd62d170f7ca90ff31fdf Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Mar 2015 16:28:28 -0400 Subject: [PATCH 0389/1029] cmCPackDebGenerator: Cast file mode to proper type for %o formatter --- Source/CPack/cmCPackDebGenerator.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 87764e1eb..fcf41229d 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -805,12 +805,14 @@ static int put_arobj(CF *cfp, struct stat *sb) if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) (void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, - sb->st_mode, (long long)sb->st_size + lname, ARFMAG); + (unsigned)sb->st_mode, (long long)sb->st_size + lname, + ARFMAG); else { lname = 0; (void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, - sb->st_mode, (long long)sb->st_size, ARFMAG); + (unsigned)sb->st_mode, (long long)sb->st_size, + ARFMAG); } off_t size = sb->st_size; From c0312d9276db0c5d1ba84e574df5d10382b96a70 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 1 Apr 2015 00:01:04 -0400 Subject: [PATCH 0390/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f4f3aa600..ad42d78b2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150331) +set(CMake_VERSION_PATCH 20150401) #set(CMake_VERSION_RC 1) From aca1d93bd9b9921ecef83b80bed219a2f5879500 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Apr 2015 12:50:03 -0400 Subject: [PATCH 0391/1029] cpack: Disable CMake Cygwin legacy warning while packaging In cpack we load the platform information modules to give the configuration scripts access to the host system information. CYGWIN.cmake warns unless we explicitly tell it not to warn since there is no chance for a cmake_minimum_required(VERSION) to be called. --- Source/CPack/cpack.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 6106472f1..00b23cd85 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -203,6 +203,9 @@ int main (int argc, char const* const* argv) cmgg.SetCMakeInstance(&cminst); cmsys::auto_ptr cmlg(cmgg.CreateLocalGenerator()); cmMakefile* globalMF = cmlg->GetMakefile(); +#if defined(__CYGWIN__) + globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); +#endif bool cpackConfigFileSpecified = true; if ( cpackConfigFile.empty() ) From d7539ced649ab75919c6d769ede1fca2dc08db0e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 19:33:41 +0200 Subject: [PATCH 0392/1029] cmMakefile: Remove bogus comment. --- Source/cmMakefile.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e98f1d9ce..13f873c73 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -438,10 +438,6 @@ public: */ void AddExtraDirectory(const char* dir); - - /** - * Add an auxiliary directory to the build. - */ void MakeStartDirectoriesCurrent() { this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", From 37897347b3fd97668d4831bba11e23f9f493e759 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 19:34:06 +0200 Subject: [PATCH 0393/1029] cmMakefile: Remove unused method. The last user was removed in commit v2.4.0~1516 (ENH: removed unused files, 2005-06-20). --- Source/cmMakefile.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 13f873c73..5e9e87b2b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -616,12 +616,6 @@ public: cmSourceFile* GetOrCreateSource(const std::string& sourceName, bool generated = false); - /** - * Obtain a list of auxiliary source directories. - */ - const std::vector& GetAuxSourceDirectories() const - {return this->AuxSourceDirectories;} - //@{ /** * Return a list of extensions associated with source and header From c3a60cc9cce4881f64bd0342cc841900533719e2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 19:35:12 +0200 Subject: [PATCH 0394/1029] cmMakefile: Remove AddExtraDirectory method. It has no effect. --- Source/cmAuxSourceDirectoryCommand.cxx | 1 - Source/cmMakefile.cxx | 6 ------ Source/cmMakefile.h | 6 ------ 3 files changed, 13 deletions(-) diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index a30d992b4..b8238f850 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -26,7 +26,6 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string sourceListValue; std::string templateDirectory = args[0]; - this->Makefile->AddExtraDirectory(templateDirectory.c_str()); std::string tdir; if(!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7f355a6a0..a89ebc529 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -114,7 +114,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->Internal->VarUsageStack.push(mf.Internal->VarUsageStack.top()); this->Prefix = mf.Prefix; - this->AuxSourceDirectories = mf.AuxSourceDirectories; this->cmStartDirectory = mf.cmStartDirectory; this->StartOutputDirectory = mf.StartOutputDirectory; this->cmHomeDirectory = mf.cmHomeDirectory; @@ -2256,11 +2255,6 @@ void cmMakefile::AddSourceGroup(const std::vector& name, #endif -void cmMakefile::AddExtraDirectory(const char* dir) -{ - this->AuxSourceDirectories.push_back(dir); -} - static bool mightExpandVariablesCMP0019(const char* s) { return s && *s && strstr(s,"${") && strchr(s,'}'); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5e9e87b2b..7891f378a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -433,11 +433,6 @@ public: bool HasCMP0054AlreadyBeenReported( cmListFileContext context) const; - /** - * Add an auxiliary directory to the build. - */ - void AddExtraDirectory(const char* dir); - void MakeStartDirectoriesCurrent() { this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", @@ -967,7 +962,6 @@ protected: void CheckForUnused(const char* reason, const std::string& name) const; std::string Prefix; - std::vector AuxSourceDirectories; // std::string cmStartDirectory; std::string StartOutputDirectory; From 1fcf590b146bd01a64cde30ba0b5ab7fe2e05b64 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 19:46:06 +0200 Subject: [PATCH 0395/1029] cmMakefile: Remove unused SubDirectoryOrder member. The last use was removed in v2.4.0~2054 (ENH: add support for out of source source, 2005-03-14) --- Source/cmMakefile.cxx | 1 - Source/cmMakefile.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a89ebc529..bf33e70cc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -144,7 +144,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->LocalGenerator = mf.LocalGenerator; this->FunctionBlockers = mf.FunctionBlockers; this->MacrosList = mf.MacrosList; - this->SubDirectoryOrder = mf.SubDirectoryOrder; this->Properties = mf.Properties; this->PreOrder = mf.PreOrder; this->WarnUnused = mf.WarnUnused; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7891f378a..864f8b06f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -1051,8 +1051,6 @@ private: std::vector MacrosList; - std::map SubDirectoryOrder; - mutable cmsys::RegularExpression cmDefineRegex; mutable cmsys::RegularExpression cmDefine01Regex; mutable cmsys::RegularExpression cmAtVarRegex; From aafe2821889333ee647c67e0fc55472d7903c02a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 19:48:09 +0200 Subject: [PATCH 0396/1029] cmMakefile: Remove unused Prefix member. Unused since it was added in commit 1f42f521 (NEW: move from tools and config to create CMake, 2000-08-29). --- Source/cmMakefile.cxx | 1 - Source/cmMakefile.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bf33e70cc..6303ffee8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -113,7 +113,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->Internal->VarInitStack.push(mf.Internal->VarInitStack.top()); this->Internal->VarUsageStack.push(mf.Internal->VarUsageStack.top()); - this->Prefix = mf.Prefix; this->cmStartDirectory = mf.cmStartDirectory; this->StartOutputDirectory = mf.StartOutputDirectory; this->cmHomeDirectory = mf.cmHomeDirectory; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 864f8b06f..321caea9f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -961,8 +961,6 @@ protected: // Check for a an unused variable void CheckForUnused(const char* reason, const std::string& name) const; - std::string Prefix; - std::string cmStartDirectory; std::string StartOutputDirectory; std::string cmHomeDirectory; From f2e07a6d90806d50b6897051c2275e38689d16e7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 20:01:52 +0200 Subject: [PATCH 0397/1029] cmMakefile: Remove unused PreOrder member. Remove references from dependendent API. --- Source/cmAddSubDirectoryCommand.cxx | 2 +- Source/cmMakefile.cxx | 9 +++------ Source/cmMakefile.h | 12 ++---------- Source/cmSubdirCommand.cxx | 7 +++---- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 01598bc92..9d55c1a6d 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -122,7 +122,7 @@ bool cmAddSubDirectoryCommand::InitialPass // Add the subdirectory using the computed full paths. this->Makefile->AddSubDirectory(srcPath, binPath, - excludeFromAll, false, true); + excludeFromAll, true); return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6303ffee8..6fbcaebc4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -101,7 +101,6 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->AddDefaultDefinitions(); this->Initialize(); - this->PreOrder = false; this->GeneratingBuildSystem = false; this->SuppressWatches = false; @@ -144,7 +143,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->FunctionBlockers = mf.FunctionBlockers; this->MacrosList = mf.MacrosList; this->Properties = mf.Properties; - this->PreOrder = mf.PreOrder; this->WarnUnused = mf.WarnUnused; this->Initialize(); this->CheckSystemVars = mf.CheckSystemVars; @@ -1694,7 +1692,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } void cmMakefile::AddSubDirectory(const std::string& sub, - bool excludeFromAll, bool preorder) + bool excludeFromAll) { // the source path must be made full if it isn't already std::string srcPath = sub; @@ -1716,13 +1714,13 @@ void cmMakefile::AddSubDirectory(const std::string& sub, this->AddSubDirectory(srcPath, binPath, - excludeFromAll, preorder, false); + excludeFromAll, false); } void cmMakefile::AddSubDirectory(const std::string& srcPath, const std::string& binPath, - bool excludeFromAll, bool preorder, + bool excludeFromAll, bool immediate) { // Make sure the binary directory is unique. @@ -1744,7 +1742,6 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, { lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } - lg2->GetMakefile()->SetPreOrder(preorder); if (immediate) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 321caea9f..ebfe50831 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -292,11 +292,10 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const std::string&, bool excludeFromAll=false, - bool preorder = false); + void AddSubDirectory(const std::string&, bool excludeFromAll=false); void AddSubDirectory(const std::string& fullSrcDir, const std::string& fullBinDir, - bool excludeFromAll, bool preorder, + bool excludeFromAll, bool immediate); /** @@ -864,10 +863,6 @@ public: ///! Initialize a makefile from its parent void InitializeFromParent(); - ///! Set/Get the preorder flag - void SetPreOrder(bool p) { this->PreOrder = p; } - bool GetPreOrder() const { return this->PreOrder; } - void AddInstallGenerator(cmInstallGenerator* g) { if(g) this->InstallGenerators.push_back(g); } std::vector& GetInstallGenerators() @@ -1056,9 +1051,6 @@ private: cmPropertyMap Properties; - // should this makefile be processed before or after processing the parent - bool PreOrder; - // Unused variable flags bool WarnUnused; bool CheckSystemVars; diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 93ad4f353..7cb2edc94 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -22,7 +22,6 @@ bool cmSubdirCommand } bool res = true; bool excludeFromAll = false; - bool preorder = false; for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) @@ -34,7 +33,7 @@ bool cmSubdirCommand } if(*i == "PREORDER") { - preorder = true; + // Ignored continue; } @@ -48,7 +47,7 @@ bool cmSubdirCommand std::string(this->Makefile->GetCurrentOutputDirectory()) + "/" + i->c_str(); this->Makefile->AddSubDirectory(srcPath, binPath, - excludeFromAll, preorder, false); + excludeFromAll, false); } // otherwise it is a full path else if ( cmSystemTools::FileIsDirectory(*i) ) @@ -59,7 +58,7 @@ bool cmSubdirCommand std::string(this->Makefile->GetCurrentOutputDirectory()) + "/" + cmSystemTools::GetFilenameName(*i); this->Makefile->AddSubDirectory(*i, binPath, - excludeFromAll, preorder, false); + excludeFromAll, false); } else { From 078c732185ff610c55707ae66be0a787c78bd2e2 Mon Sep 17 00:00:00 2001 From: Sean James Date: Wed, 1 Apr 2015 15:02:42 -0400 Subject: [PATCH 0398/1029] Xcode: Add file type for Metal shader files --- Source/cmGlobalXCodeGenerator.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f139ad10d..5e584a452 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -865,6 +865,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode += ".asm"; } + else if (ext == "metal") + { + sourcecode += ".metal"; + } //else // { // // Already specialized above or we leave sourcecode == "sourcecode" From c6593511bb1b5f9b73df972ef92c6c9b0a045304 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Apr 2015 16:24:24 -0400 Subject: [PATCH 0399/1029] Help: Add link target to cmake-language.7 variables section --- Help/manual/cmake-language.7.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 4a9f0b590..41542c914 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -485,6 +485,8 @@ The :command:`macro`/:command:`endmacro`, and :command:`function`/:command:`endfunction` commands delimit code blocks to be recorded for later invocation as commands. +.. _`CMake Language Variables`: + Variables ========= From 91eb736390b69d186edda8a1105d898cd58a77ca Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Apr 2015 16:24:39 -0400 Subject: [PATCH 0400/1029] Help: Rewrite 'set` command documentation Much of the information in the old set() command documentation is now covered in the cmake-language(7) manual. Rewrite the documentation with this in mind. Split up the signatures for each kind of variable into different subsections. --- Help/command/set.rst | 160 +++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 98 deletions(-) diff --git a/Help/command/set.rst b/Help/command/set.rst index 7a595505f..9f2bf72fb 100644 --- a/Help/command/set.rst +++ b/Help/command/set.rst @@ -1,116 +1,80 @@ set --- -Set a CMake, cache or environment variable to a given value. +Set a normal, cache, or environment variable to a given value. +See the :ref:`cmake-language(7) variables ` +documentation for the scopes and interaction of normal variables +and cache entries. + +Signatures of this command that specify a ``...`` placeholder +expect zero or more arguments. Multiple arguments will be joined as +a :ref:`;-list ` to form the actual variable +value to be set. Zero arguments will cause normal variables to be +unset. See the :command:`unset` command to unset variables explicitly. + +Set Normal Variable +^^^^^^^^^^^^^^^^^^^ :: - set( - [[CACHE [FORCE]] | PARENT_SCOPE]) + set( ... [PARENT_SCOPE]) -Within CMake sets to the value . is -expanded before is set to it. Normally, set will set a -regular CMake variable. If CACHE is present, then the is -put in the cache instead, unless it is already in the cache. See -section 'Variable types in CMake' below for details of regular and -cache variables and their interactions. If CACHE is used, and - are 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 +Set the given ```` in the current function or directory scope. + +If the ``PARENT_SCOPE`` option is given the variable will be set in +the scope above the current scope. Each new directory or function +creates a new scope. This command will set the value of a variable +into the parent directory or calling function (whichever is applicable +to the case at hand). + +Set Cache Entry +^^^^^^^^^^^^^^^ :: - FILEPATH = File chooser dialog. - PATH = Directory chooser dialog. - STRING = Arbitrary string. - BOOL = Boolean ON/OFF checkbox. - INTERNAL = No GUI entry (used for persistent variables). + set( ... CACHE [FORCE]) -If is INTERNAL, the cache variable is marked as internal, and -will not be shown to the user in tools like cmake-gui. This is -intended for values that should be persisted in the cache, but which -users should not normally change. INTERNAL implies FORCE. +Set the given cache ```` (cache entry). Since cache entries +are meant to provide user-settable values this does not overwrite +existing cache entries by default. Use the ``FORCE`` option to +overwrite existing entries. -Normally, set(...CACHE...) creates cache variables, but does not -modify them. If FORCE is specified, the value of the cache variable -is set, even if the variable is already in the cache. This should -normally be avoided, as it will remove any changes to the cache -variable's value by the user. +The ```` must be specified as one of: -If PARENT_SCOPE is present, the variable will be set in the scope -above the current scope. Each new directory or function creates a new -scope. This command will set the value of a variable into the parent -directory or calling function (whichever is applicable to the case at -hand). PARENT_SCOPE cannot be combined with CACHE. +``BOOL`` + Boolean ``ON/OFF`` value. :manual:`cmake-gui(1)` offers a checkbox. -If is not specified then the variable is removed instead of -set. See also: the unset() command. +``FILEPATH`` + Path to a file on disk. :manual:`cmake-gui(1)` offers a file dialog. + +``PATH`` + Path to a directory on disk. :manual:`cmake-gui(1)` offers a file dialog. + +``STRING`` + A line of text. :manual:`cmake-gui(1)` offers a text field or a + drop-down selection if the :prop_cache:`STRINGS` cache entry + property is set. + +``INTERNAL`` + A line of text. :manual:`cmake-gui(1)` does not show internal entries. + They may be used to store variables persistently across runs. + Use of this type implies ``FORCE``. + +The ```` must be specified as a line of text providing +a quick summary of the option for presentation to :manual:`cmake-gui(1)` +users. + +If the cache entry does not exist prior to the call or the ``FORCE`` +option is given then the cache entry will be set to the given value. +Furthermore, any normal variable binding in the current scope will +be removed to expose the newly cached value to any immediately +following evaluation. + +Set Environment Variable +^^^^^^^^^^^^^^^^^^^^^^^^ :: - set( ... ) + set(ENV{} ...) -In this case is set to a semicolon separated list of -values. - - can be an environment variable such as: - -:: - - set( ENV{PATH} /home/martink ) - -in which case the environment variable will be set. - -*** Variable types in CMake *** - -In CMake there are two types of variables: normal variables and cache -variables. Normal variables are meant for the internal use of the -script (just like variables in most programming languages); they are -not persisted across CMake runs. Cache variables (unless set with -INTERNAL) are mostly intended for configuration settings where the -first CMake run determines a suitable default value, which the user -can then override, by editing the cache with tools such as ccmake or -cmake-gui. Cache variables are stored in the CMake cache file, and -are persisted across CMake runs. - -Both types can exist at the same time with the same name but different -values. When ${FOO} is evaluated, CMake first looks for a normal -variable 'FOO' in scope and uses it if set. If and only if no normal -variable exists then it falls back to the cache variable 'FOO'. - -Some examples: - -The code 'set(FOO "x")' sets the normal variable 'FOO'. It does not -touch the cache, but it will hide any existing cache value 'FOO'. - -The code 'set(FOO "x" CACHE ...)' checks for 'FOO' in the cache, -ignoring any normal variable of the same name. If 'FOO' is in the -cache then nothing happens to either the normal variable or the cache -variable. If 'FOO' is not in the cache, then it is added to the -cache. - -Finally, whenever a cache variable is added or modified by a command, -CMake also *removes* the normal variable of the same name from the -current scope so that an immediately following evaluation of it will -expose the newly cached value. - -Normally projects should avoid using normal and cache variables of the -same name, as this interaction can be hard to follow. However, in -some situations it can be useful. One example (used by some -projects): - -A project has a subproject in its source tree. The child project has -its own CMakeLists.txt, which is included from the parent -CMakeLists.txt using add_subdirectory(). Now, if the parent and the -child project provide the same option (for example a compiler option), -the parent gets the first chance to add a user-editable option to the -cache. Normally, the child would then use the same value that the -parent uses. However, it may be necessary to hard-code the value for -the child project's option while still allowing the user to edit the -value used by the parent project. The parent project can achieve this -simply by setting a normal variable with the same name as the option -in a scope sufficient to hide the option's cache variable from the -child completely. The parent has already set the cache variable, so -the child's set(...CACHE...) will do nothing, and evaluating the -option variable will use the value from the normal variable, which -hides the cache variable. +Set the current process environment ```` to the given value. From 77d466ec556bf6722e20d0c7a9b253d69f113c6c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Apr 2015 16:25:42 -0400 Subject: [PATCH 0401/1029] Help: Document conversion of PATH/FILEPATH cache values to absolute paths Suggested-by: Roger Leigh --- Help/command/set.rst | 9 +++++++++ Help/manual/OPTIONS_BUILD.txt | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Help/command/set.rst b/Help/command/set.rst index 9f2bf72fb..d04b88004 100644 --- a/Help/command/set.rst +++ b/Help/command/set.rst @@ -70,6 +70,15 @@ Furthermore, any normal variable binding in the current scope will be removed to expose the newly cached value to any immediately following evaluation. +It is possible for the cache entry to exist prior to the call but +have no type set if it was created on the :manual:`cmake(1)` command +line by a user through the ``-D=`` option without +specifying a type. In this case the ``set`` command will add the +type. Furthermore, if the ```` is ``PATH`` or ``FILEPATH`` +and the ```` provided on the command line is a relative path, +then the ``set`` command will treat the path as relative to the +current working directory and convert it to an absolute path. + Set Environment Variable ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 363d0aaca..986b541cf 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -10,7 +10,7 @@ containing SET commands that use the CACHE option, not a cache-format file. -``-D :=`` +``-D :=, -D =`` Create a cmake cache entry. When cmake is first run in an empty build tree, it creates a @@ -19,6 +19,14 @@ takes priority over the project's default value. The option may be repeated for as many cache entries as desired. + If the ``:`` portion is given it must be one of the types + specified by the :command:`set` command documentation for its + ``CACHE`` signature. + If the ``:`` portion is omitted the entry will be created + with no type if it does not exist with a type already. If a + command in the project sets the type to ``PATH`` or ``FILEPATH`` + then the ```` will be converted to an absolute path. + ``-U `` Remove matching entries from CMake cache. From a293dcb561e3961c1d55f2fc8ccaaf1b4f17204c Mon Sep 17 00:00:00 2001 From: Bill Newcomb Date: Wed, 1 Apr 2015 13:13:35 -0700 Subject: [PATCH 0402/1029] Tests: Fix CMake.ELF test with read-only source (#15489) When the cmake sources are all set to read-only (e.g. after importing into perforce), the CMake.ELF test fails because the copy of the binary is also read-only and cannot be modified. Fix this by copying the binary without source permissions. --- Tests/CMakeTests/ELFTest.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeTests/ELFTest.cmake.in b/Tests/CMakeTests/ELFTest.cmake.in index 0271abb1f..463577889 100644 --- a/Tests/CMakeTests/ELFTest.cmake.in +++ b/Tests/CMakeTests/ELFTest.cmake.in @@ -11,7 +11,7 @@ set(out "@CMAKE_CURRENT_BINARY_DIR@/ELF-Out") file(REMOVE_RECURSE "${out}") file(MAKE_DIRECTORY "${out}") foreach(f ${names}) - file(COPY ${in}/${f} DESTINATION ${out}) + file(COPY ${in}/${f} DESTINATION ${out} NO_SOURCE_PERMISSIONS) list(APPEND files "${out}/${f}") endforeach() From f707460e42949e4ca372bf23892a7d6fb9eb1b86 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 2 Apr 2015 00:01:04 -0400 Subject: [PATCH 0403/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ad42d78b2..19d6c87b7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150401) +set(CMake_VERSION_PATCH 20150402) #set(CMake_VERSION_RC 1) From 06f61c26cfa19a47610ad718a784bdd7db105cf8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Apr 2015 20:53:31 +0200 Subject: [PATCH 0404/1029] Do not treat DEFINITIONS as a built-in directory property Add policy CMP0059 to cover this change. The property has been deprecated since CMake 2.4 anyway. This will help clean up cmMakefile -- the DefineFlagsOrig member should not need to exist. --- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0059.rst | 17 +++++++++++++++++ Help/prop_dir/DEFINITIONS.rst | 11 ++++++++--- .../remove-DEFINITIONS-directory-property.rst | 6 ++++++ Source/cmMakefile.cxx | 15 +++++++++++++-- Source/cmPolicies.cxx | 5 +++++ Source/cmPolicies.h | 2 ++ Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt | 1 + Tests/RunCMake/CMP0059/CMP0059-NEW-stderr.txt | 2 ++ Tests/RunCMake/CMP0059/CMP0059-NEW.cmake | 17 +++++++++++++++++ Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt | 1 + Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt | 2 ++ Tests/RunCMake/CMP0059/CMP0059-OLD.cmake | 17 +++++++++++++++++ Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt | 1 + Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt | 18 ++++++++++++++++++ Tests/RunCMake/CMP0059/CMP0059-WARN.cmake | 17 +++++++++++++++++ Tests/RunCMake/CMP0059/CMakeLists.txt | 3 +++ Tests/RunCMake/CMP0059/RunCMakeTest.cmake | 5 +++++ Tests/RunCMake/CMakeLists.txt | 1 + 19 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 Help/policy/CMP0059.rst create mode 100644 Help/release/dev/remove-DEFINITIONS-directory-property.rst create mode 100644 Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt create mode 100644 Tests/RunCMake/CMP0059/CMP0059-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0059/CMP0059-NEW.cmake create mode 100644 Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt create mode 100644 Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0059/CMP0059-OLD.cmake create mode 100644 Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt create mode 100644 Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0059/CMP0059-WARN.cmake create mode 100644 Tests/RunCMake/CMP0059/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0059/RunCMakeTest.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 228df142b..d2960de23 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -116,3 +116,4 @@ All Policies /policy/CMP0056 /policy/CMP0057 /policy/CMP0058 + /policy/CMP0059 diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst new file mode 100644 index 000000000..e40f450d3 --- /dev/null +++ b/Help/policy/CMP0059.rst @@ -0,0 +1,17 @@ +CMP0059 +------- + +Don't treat ``DEFINITIONS`` as a built-in directory property. + +CMake 3.3 and above no longer make a list of definitions available through +the :prop_dir:`DEFINITIONS` directory property. The +:prop_dir:`COMPILE_DEFINITIONS` directory property may be used instead. + +The ``OLD`` behavior for this policy is to provide the list of flags given +so far to the :command:`add_definitions` command. The ``NEW`` behavior is +to behave as a normal user-defined directory property. + +This policy was introduced in CMake version 3.3. +CMake version |release| warns when the policy is not set and uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set +it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/prop_dir/DEFINITIONS.rst b/Help/prop_dir/DEFINITIONS.rst index 22f7c1542..79ac3f346 100644 --- a/Help/prop_dir/DEFINITIONS.rst +++ b/Help/prop_dir/DEFINITIONS.rst @@ -1,8 +1,13 @@ DEFINITIONS ----------- -For CMake 2.4 compatibility only. Use COMPILE_DEFINITIONS instead. +For CMake 2.4 compatibility only. Use :prop_dir:`COMPILE_DEFINITIONS` +instead. This read-only property specifies the list of flags given so far to -the add_definitions command. It is intended for debugging purposes. -Use the COMPILE_DEFINITIONS instead. +the :command:`add_definitions` command. It is intended for debugging +purposes. Use the :prop_dir:`COMPILE_DEFINITIONS` directory property +instead. + +This built-in read-only property does not exist if policy +:policy:`CMP0059` is set to ``NEW``. diff --git a/Help/release/dev/remove-DEFINITIONS-directory-property.rst b/Help/release/dev/remove-DEFINITIONS-directory-property.rst new file mode 100644 index 000000000..d8e50f042 --- /dev/null +++ b/Help/release/dev/remove-DEFINITIONS-directory-property.rst @@ -0,0 +1,6 @@ +remove-DEFINITIONS-property +--------------------------- + +* The :command:`add_definitions()` command no longer causes a + :prop_dir:`DEFINITIONS` directory property to be populated. See policy + :policy:`CMP0059`. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6fbcaebc4..ec1d81411 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4209,8 +4209,19 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "DEFINITIONS") { - output += this->DefineFlagsOrig; - return output.c_str(); + switch(this->GetPolicyStatus(cmPolicies::CMP0059)) + { + case cmPolicies::WARN: + this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0059)); + case cmPolicies::OLD: + output += this->DefineFlagsOrig; + return output.c_str(); + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } } else if (prop == "LINK_DIRECTORIES") { diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 592df8f16..0a61bcaf3 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -385,6 +385,11 @@ cmPolicies::cmPolicies() CMP0058, "CMP0058", "Ninja requires custom command byproducts to be explicit.", 3,3,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0059, "CMP0059", + "Do no treat DEFINITIONS as a built-in directory property.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index b18b33766..ced9d8ce9 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -116,6 +116,8 @@ public: CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications /// for the same file. CMP0058, ///< Ninja requires custom command byproducts to be explicit + CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory + /// property. /** \brief Always the last entry. * diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt b/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-NEW-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-NEW-stderr.txt new file mode 100644 index 000000000..76992d84b --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-NEW-stderr.txt @@ -0,0 +1,2 @@ +DEFS: +CUSTOM CONTENT:CUSTOM_CONTENT diff --git a/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake b/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake new file mode 100644 index 000000000..f7b9303cd --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-NEW.cmake @@ -0,0 +1,17 @@ + +cmake_policy(SET CMP0059 NEW) + +add_definitions(-DSOME_DEF) + +get_property(defs DIRECTORY . + PROPERTY DEFINITIONS +) +message("DEFS:${defs}") + +set_property(DIRECTORY . + PROPERTY DEFINITIONS CUSTOM_CONTENT +) +get_property(content DIRECTORY . + PROPERTY DEFINITIONS +) +message("CUSTOM CONTENT:${content}") diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt b/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt new file mode 100644 index 000000000..e35e8c5f1 --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-OLD-stderr.txt @@ -0,0 +1,2 @@ +DEFS: -DSOME_DEF +CUSTOM CONTENT: -DSOME_DEF diff --git a/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake b/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake new file mode 100644 index 000000000..25557744d --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-OLD.cmake @@ -0,0 +1,17 @@ + +cmake_policy(SET CMP0059 OLD) + +add_definitions(-DSOME_DEF) + +get_property(defs DIRECTORY . + PROPERTY DEFINITIONS +) +message("DEFS:${defs}") + +set_property(DIRECTORY . + PROPERTY DEFINITIONS CUSTOM_CONTENT +) +get_property(content DIRECTORY . + PROPERTY DEFINITIONS +) +message("CUSTOM CONTENT:${content}") diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt new file mode 100644 index 000000000..4e04d15d6 --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-WARN-stderr.txt @@ -0,0 +1,18 @@ +CMake Warning \(dev\) at CMP0059-WARN.cmake:6 \(get_property\): + Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + property. Run "cmake --help-policy CMP0059" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +DEFS: -DSOME_DEF +CMake Warning \(dev\) at CMP0059-WARN.cmake:14 \(get_property\): + Policy CMP0059 is not set: Do no treat DEFINITIONS as a built-in directory + property. Run "cmake --help-policy CMP0059" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CUSTOM CONTENT: -DSOME_DEF diff --git a/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake b/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake new file mode 100644 index 000000000..9d0b49c8e --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMP0059-WARN.cmake @@ -0,0 +1,17 @@ + + + +add_definitions(-DSOME_DEF) + +get_property(defs DIRECTORY . + PROPERTY DEFINITIONS +) +message("DEFS:${defs}") + +set_property(DIRECTORY . + PROPERTY DEFINITIONS CUSTOM_CONTENT +) +get_property(content DIRECTORY . + PROPERTY DEFINITIONS +) +message("CUSTOM CONTENT:${content}") diff --git a/Tests/RunCMake/CMP0059/CMakeLists.txt b/Tests/RunCMake/CMP0059/CMakeLists.txt new file mode 100644 index 000000000..ef2163c29 --- /dev/null +++ b/Tests/RunCMake/CMP0059/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0059/RunCMakeTest.cmake b/Tests/RunCMake/CMP0059/RunCMakeTest.cmake new file mode 100644 index 000000000..9b5757954 --- /dev/null +++ b/Tests/RunCMake/CMP0059/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0059-OLD) +run_cmake(CMP0059-NEW) +run_cmake(CMP0059-WARN) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7b9c81070..6daf27abb 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -64,6 +64,7 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) +add_RunCMake_test(CMP0059) if(CMAKE_GENERATOR STREQUAL "Ninja") add_RunCMake_test(Ninja) endif() From 82c51a8ac6c4a8fba127402d96f8269492f3a115 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Apr 2015 13:16:23 -0400 Subject: [PATCH 0405/1029] liblzma: Disable XL compiler optimizations in one source to avoid crash Somehow optimizations of lzma_lzma_optimum_normal by the IBM XL C compiler cause it to crash. Simply disable optimizations of this source file with a pragma. --- Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index d3a63485c..fc54d8d31 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -8,6 +8,9 @@ // You can do whatever you want with this file. // /////////////////////////////////////////////////////////////////////////////// +#if defined(__IBMC__) +# pragma options optimize=0 +#endif #include "lzma_encoder_private.h" #include "fastpos.h" From 2978a5549acd9a55582ab42ae774e75ddf2b606f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 3 Apr 2015 00:01:04 -0400 Subject: [PATCH 0406/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 19d6c87b7..8a931011a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150402) +set(CMake_VERSION_PATCH 20150403) #set(CMake_VERSION_RC 1) From 7fea2b77df2d70283f4918a8ff52836dbc68db6b Mon Sep 17 00:00:00 2001 From: James Bigler Date: Tue, 31 Mar 2015 14:13:04 -0600 Subject: [PATCH 0407/1029] FindCUDA: Use the static CUDA runtime library if available (#15482) Beginning in CUDA 5.5 a static version of the cuda runtime library became available. Since nvcc defaults to using this library over the shared version, FindCUDA will also default to using this version. There are many advantages to using the static version (most importantly to avoid conflicts with multiple versions when building a CUDA based library). Offer a CUDA_USE_STATIC_CUDA_RUNTIME option to control this behavior. --- Help/release/dev/FindCUDA-StaticRuntime.rst | 7 ++ Modules/FindCUDA.cmake | 85 ++++++++++++++++++++- 2 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 Help/release/dev/FindCUDA-StaticRuntime.rst diff --git a/Help/release/dev/FindCUDA-StaticRuntime.rst b/Help/release/dev/FindCUDA-StaticRuntime.rst new file mode 100644 index 000000000..112596c20 --- /dev/null +++ b/Help/release/dev/FindCUDA-StaticRuntime.rst @@ -0,0 +1,7 @@ +FindCUDA-StaticRuntime +---------------------- + +* The :module:`FindCUDA` module now defaults to using the static + CUDA runtime library if it is available. A new + ``CUDA_USE_STATIC_CUDA_RUNTIME`` option is offered to control + this behavior. diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 81e1cad5f..8f80993ac 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -106,6 +106,11 @@ # CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and # CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called. # +# CUDA_USE_STATIC_CUDA_RUNTIME (Default ON) +# -- When enabled the static version of the CUDA runtime library will be used +# in CUDA_LIBRARIES. If the version of CUDA configured doesn't support +# this option, then it will be silently disabled. +# # CUDA_VERBOSE_BUILD (Default OFF) # -- Set to ON to see all the commands used when building the CUDA file. When # using a Makefile generator the value defaults to VERBOSE (run make @@ -272,6 +277,8 @@ # CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS # implementation (alterative to: # CUDA_ADD_CUBLAS_TO_TARGET macro). +# CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library. +# Only available for CUDA version 5.5+ # CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library. # Only available for CUDA version 4.0+. # CUDA_curand_LIBRARY -- CUDA Random Number Generation library. @@ -518,11 +525,12 @@ macro(cuda_unset_include_and_libraries) # This only existed in the 3.0 version of the CUDA toolkit unset(CUDA_CUDARTEMU_LIBRARY CACHE) endif() - unset(CUDA_cupti_LIBRARY CACHE) + unset(CUDA_cudart_static_LIBRARY CACHE) unset(CUDA_cublas_LIBRARY CACHE) unset(CUDA_cublasemu_LIBRARY CACHE) unset(CUDA_cufft_LIBRARY CACHE) unset(CUDA_cufftemu_LIBRARY CACHE) + unset(CUDA_cupti_LIBRARY CACHE) unset(CUDA_curand_LIBRARY CACHE) unset(CUDA_cusolver_LIBRARY CACHE) unset(CUDA_cusparse_LIBRARY CACHE) @@ -532,6 +540,8 @@ macro(cuda_unset_include_and_libraries) unset(CUDA_npps_LIBRARY CACHE) unset(CUDA_nvcuvenc_LIBRARY CACHE) unset(CUDA_nvcuvid_LIBRARY CACHE) + + unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE) endmacro() # Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed, @@ -539,8 +549,8 @@ endmacro() if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}") unset(CUDA_TOOLKIT_TARGET_DIR CACHE) unset(CUDA_NVCC_EXECUTABLE CACHE) - unset(CUDA_VERSION CACHE) cuda_unset_include_and_libraries() + unset(CUDA_VERSION CACHE) endif() if(NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL}") @@ -696,6 +706,53 @@ if(CUDA_VERSION VERSION_EQUAL "3.0") CUDA_CUDARTEMU_LIBRARY ) endif() +if(NOT CUDA_VERSION VERSION_LESS "5.5") + cuda_find_library_local_first(CUDA_cudart_static_LIBRARY cudart_static "static CUDA runtime library") + mark_as_advanced(CUDA_cudart_static_LIBRARY) +endif() +if(CUDA_cudart_static_LIBRARY) + # Set whether to use the static cuda runtime. + option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON) +else() + option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" OFF) +endif() + +if(CUDA_USE_STATIC_CUDA_RUNTIME) + if(UNIX) + # Check for the dependent libraries. Here we look for pthreads. + if (DEFINED CMAKE_THREAD_PREFER_PTHREAD) + set(_cuda_cmake_thread_prefer_pthread ${CMAKE_THREAD_PREFER_PTHREAD}) + endif() + set(CMAKE_THREAD_PREFER_PTHREAD 1) + + # Many of the FindXYZ CMake comes with makes use of try_compile with int main(){return 0;} + # as the source file. Unfortunately this causes a warning with -Wstrict-prototypes and + # -Werror causes the try_compile to fail. We will just temporarily disable other flags + # when doing the find_package command here. + set(_cuda_cmake_c_flags ${CMAKE_C_FLAGS}) + set(CMAKE_C_FLAGS "-fPIC") + find_package(Threads REQUIRED) + set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags}) + + if (DEFINED _cuda_cmake_thread_prefer_pthread) + set(CMAKE_THREAD_PREFER_PTHREAD ${_cuda_cmake_thread_prefer_pthread}) + unset(_cuda_cmake_thread_prefer_pthread) + else() + unset(CMAKE_THREAD_PREFER_PTHREAD) + endif() + if (NOT APPLE) + # Here is librt that has things such as, clock_gettime, shm_open, and shm_unlink. + find_library(CUDA_rt_LIBRARY rt) + find_library(CUDA_dl_LIBRARY dl) + if (NOT CUDA_rt_LIBRARY) + message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") + endif() + if (NOT CUDA_dl_LIBRARY) + message(WARNING "Expecting to find libdl for libcudart_static, but didn't find it.") + endif() + endif() + endif() +endif() # CUPTI library showed up in cuda toolkit 4.0 if(NOT CUDA_VERSION VERSION_LESS "4.0") @@ -703,12 +760,32 @@ if(NOT CUDA_VERSION VERSION_LESS "4.0") mark_as_advanced(CUDA_cupti_LIBRARY) endif() +# Set the CUDA_LIBRARIES variable. This is the set of stuff to link against if you are +# using the CUDA runtime. For the dynamic version of the runtime, most of the +# dependencies are brough in, but for the static version there are additional libraries +# and linker commands needed. +# Initialize to empty +set(CUDA_LIBRARIES) + # If we are using emulation mode and we found the cudartemu library then use # that one instead of cudart. if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) - set(CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY}) + list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY}) +elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY) + list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + if (CUDA_rt_LIBRARY) + list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY}) + endif() + if (CUDA_dl_LIBRARY) + list(APPEND CUDA_LIBRARIES ${CUDA_dl_LIBRARY}) + endif() + if(APPLE) + # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that + # the static cuda runtime can find it at runtime. + list(APPEND CUDA_LIBRARIES -Wl,-rpath,/usr/local/cuda/lib) + endif() else() - set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) + list(APPEND CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) endif() # 1.1 toolkit on linux doesn't appear to have a separate library on From ba9b9d79fb1a753c564be44e17e2d3b979f8108c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Apr 2015 16:16:14 -0400 Subject: [PATCH 0408/1029] Help: Fix syntax in non-relocatable usage requirements example The example in cmake-packages(7) is meant to be incorrect for use of absolute paths, not for its syntax. --- Help/manual/cmake-packages.7.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 3367ba472..b477cab59 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -385,11 +385,11 @@ generate config file packages: .. code-block:: cmake target_link_libraries(ClimbingStats INTERFACE - ${Boost_LIBRARIES};${OtherDep_LIBRARIES}> - ) + ${Boost_LIBRARIES} ${OtherDep_LIBRARIES} + ) target_include_directories(ClimbingStats INTERFACE - $ - ) + "$" + ) Dependencies must provide their own :ref:`IMPORTED targets ` which have their own :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and From 6e331ce9d47c8f9adbf29ee0158b4307debbc02c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Apr 2015 17:17:36 -0400 Subject: [PATCH 0409/1029] Help: Fix typo in cmake-packages(7) manual relevnt => relevant --- Help/manual/cmake-packages.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index b477cab59..6ee9df9a6 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -375,7 +375,7 @@ to be incompatible. Note that it is not advisable to populate any properties which may contain paths, such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and -:prop_tgt:`INTERFACE_LINK_LIBRARIES`, with paths relevnt to dependencies. +:prop_tgt:`INTERFACE_LINK_LIBRARIES`, with paths relevant to dependencies. That would hard-code into installed packages the include directory or library paths for dependencies **as found on the machine the package was made on**. From 031d894fb882ca2e8c2269ba1674578f82155420 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Apr 2015 15:45:48 -0400 Subject: [PATCH 0410/1029] Help: Place relocatable package notes in their own subsections These notes apply only for the use case of creating a package for redistribution on machines other than that where it is built. Clarify this to readers by placing the discussion in dedicated sections titled accordingly. --- Help/command/target_include_directories.rst | 3 +++ Help/command/target_link_libraries.rst | 9 ++++++--- Help/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.rst | 3 +++ Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst | 3 +++ Help/prop_tgt/LINK_INTERFACE_LIBRARIES.rst | 3 +++ Help/prop_tgt/LINK_INTERFACE_LIBRARIES_CONFIG.rst | 3 +++ 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Help/command/target_include_directories.rst b/Help/command/target_include_directories.rst index 1d236ce31..30ec2cb27 100644 --- a/Help/command/target_include_directories.rst +++ b/Help/command/target_include_directories.rst @@ -55,5 +55,8 @@ installation prefix. For example: $ # /include/mylib ) +Creating Relocatable Packages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` .. include:: /include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index e6a82b617..88a555aa4 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -49,9 +49,6 @@ CMake will also propagate :ref:`usage requirements ` from linked library targets. Usage requirements of dependencies affect compilation of sources in the ````. -.. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_LINK_LIBRARIES` -.. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt - If an ```` is a library in a Mac OX framework, the ``Headers`` directory of the framework will also be processed as a :ref:`usage requirement `. This has the same @@ -153,3 +150,9 @@ will not be used in OLD handling of :policy:`CMP0003` or :policy:`CMP0004`. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. + +Creating Relocatable Packages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_LINK_LIBRARIES` +.. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt diff --git a/Help/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.rst b/Help/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.rst index 1cfd7a85f..b1c40b224 100644 --- a/Help/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.rst +++ b/Help/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.rst @@ -22,5 +22,8 @@ installation prefix. For example: $ # /include/mylib ) +Creating Relocatable Packages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. |INTERFACE_PROPERTY_LINK| replace:: ``INTERFACE_INCLUDE_DIRECTORIES`` .. include:: /include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt diff --git a/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst b/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst index 55b7b8d40..832d12bbc 100644 --- a/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst +++ b/Help/prop_tgt/INTERFACE_LINK_LIBRARIES.rst @@ -17,5 +17,8 @@ with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. +Creating Relocatable Packages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. |INTERFACE_PROPERTY_LINK| replace:: ``INTERFACE_LINK_LIBRARIES`` .. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt diff --git a/Help/prop_tgt/LINK_INTERFACE_LIBRARIES.rst b/Help/prop_tgt/LINK_INTERFACE_LIBRARIES.rst index 2e859ebf7..2dcf45cbd 100644 --- a/Help/prop_tgt/LINK_INTERFACE_LIBRARIES.rst +++ b/Help/prop_tgt/LINK_INTERFACE_LIBRARIES.rst @@ -24,5 +24,8 @@ property if policy :policy:`CMP0022` is ``NEW``. This property is deprecated. Use :prop_tgt:`INTERFACE_LINK_LIBRARIES` instead. +Creating Relocatable Packages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. |INTERFACE_PROPERTY_LINK| replace:: ``LINK_INTERFACE_LIBRARIES`` .. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt diff --git a/Help/prop_tgt/LINK_INTERFACE_LIBRARIES_CONFIG.rst b/Help/prop_tgt/LINK_INTERFACE_LIBRARIES_CONFIG.rst index 7f2b5dd94..22ee5a68b 100644 --- a/Help/prop_tgt/LINK_INTERFACE_LIBRARIES_CONFIG.rst +++ b/Help/prop_tgt/LINK_INTERFACE_LIBRARIES_CONFIG.rst @@ -13,5 +13,8 @@ property if policy :policy:`CMP0022` is ``NEW``. This property is deprecated. Use :prop_tgt:`INTERFACE_LINK_LIBRARIES` instead. +Creating Relocatable Packages +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. |INTERFACE_PROPERTY_LINK| replace:: ``LINK_INTERFACE_LIBRARIES_`` .. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt From 227992c3a693bb56ee6f6600a10c6eb19c6fb311 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Apr 2015 16:12:00 -0400 Subject: [PATCH 0411/1029] Help: Reorganize and refine discussion of relocatable packages Re-organize the content added to the cmake-packages(7) manual by * commit v3.0.0-rc1~184^2 (Help: Document export(EXPORT) in the cmake-packages manual, 2013-12-23), * commit v3.0.0-rc1~154^2~1 (Help: Add notes about relocatability of config-file packages, 2014-01-07), and * commit v3.2.0-rc1~345^2 (Help: Warn that paths should not be used in INTERFACE_ build properties, 2014-11-22). These commits broke the natural flow of the original manual and made wording after the new content make less sense. Move the content into new subsections to restore the flow of the original manual and to make explicitly the purpose of the new content. Shorten the relocatable usage requirement "warnings". Refer to the new cmake-packages(7) manual subsection to reduce duplication. Also clarify the distinction between paths to library dependencies and paths to their header files. --- .../INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt | 38 ++--- .../INTERFACE_LINK_LIBRARIES_WARNING.txt | 25 +-- Help/manual/cmake-buildsystem.7.rst | 5 + Help/manual/cmake-packages.7.rst | 152 ++++++++++-------- 4 files changed, 106 insertions(+), 114 deletions(-) diff --git a/Help/include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt b/Help/include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt index 33f71837e..a54d7280d 100644 --- a/Help/include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt +++ b/Help/include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt @@ -1,30 +1,18 @@ Note that it is not advisable to populate the ``INSTALL_INTERFACE`` of the -|INTERFACE_PROPERTY_LINK| of a target with paths for dependencies. -That would hard-code into installed packages the include directory paths -for dependencies **as found on the machine the package was made on**. +|INTERFACE_PROPERTY_LINK| of a target with absolute paths to the include +directories of dependencies. That would hard-code into installed packages +the include directory paths for dependencies +**as found on the machine the package was made on**. The ``INSTALL_INTERFACE`` of the |INTERFACE_PROPERTY_LINK| is only -suitable for specifying the required include directories of the target itself, -not its dependencies. +suitable for specifying the required include directories for headers +provided with the target itself, not those provided by the transitive +dependencies listed in its :prop_tgt:`INTERFACE_LINK_LIBRARIES` target +property. Those dependencies should themselves be targets that specify +their own header locations in |INTERFACE_PROPERTY_LINK|. -That is, code like this is incorrect for targets which will be used to -generate :manual:`cmake-packages(7)`: - -.. code-block:: cmake - - target_include_directories(mylib INTERFACE - $ - ) - -Dependencies must provide their own :ref:`IMPORTED targets ` -which have their own |INTERFACE_PROPERTY_LINK| populated -appropriately. Those :ref:`IMPORTED targets ` may then be -used with the :command:`target_link_libraries` command for ``mylib``. - -That way, when a consumer uses the installed package, the -consumer will run the appropriate :command:`find_package` command to find -the dependencies on their own machine and populate the -:ref:`IMPORTED targets ` with appropriate paths. See -:ref:`Creating Packages` for more. Note that many modules currently shipped -with CMake do not currently provide :ref:`IMPORTED targets `. +See the :ref:`Creating Relocatable Packages` section of the +:manual:`cmake-packages(7)` manual for discussion of additional care +that must be taken when specifying usage requirements while creating +packages for redistribution. diff --git a/Help/include/INTERFACE_LINK_LIBRARIES_WARNING.txt b/Help/include/INTERFACE_LINK_LIBRARIES_WARNING.txt index ceefa4d2b..46e84ac22 100644 --- a/Help/include/INTERFACE_LINK_LIBRARIES_WARNING.txt +++ b/Help/include/INTERFACE_LINK_LIBRARIES_WARNING.txt @@ -1,23 +1,10 @@ Note that it is not advisable to populate the -|INTERFACE_PROPERTY_LINK| of a target with paths for dependencies. -That would hard-code into installed packages the include directory paths +|INTERFACE_PROPERTY_LINK| of a target with absolute paths to dependencies. +That would hard-code into installed packages the library file paths for dependencies **as found on the machine the package was made on**. -That is, code like this is incorrect for targets which will be used to -generate :manual:`cmake-packages(7)`: - -.. code-block:: cmake - - target_link_libraries(mylib INTERFACE - ${Boost_LIBRARIES};${OtherDep_LIBRARIES} - ) - -Dependencies must provide their own :ref:`IMPORTED targets ` -which have their own :prop_tgt:`IMPORTED_LOCATION` populated -appropriately. That way, when a consumer uses the installed package, the -consumer will run the appropriate :command:`find_package` command to find -the dependencies on their own machine and populate the -:ref:`IMPORTED targets ` with appropriate paths. See -:ref:`Creating Packages` for more. Note that many modules currently shipped -with CMake do not currently provide :ref:`IMPORTED targets `. +See the :ref:`Creating Relocatable Packages` section of the +:manual:`cmake-packages(7)` manual for discussion of additional care +that must be taken when specifying usage requirements while creating +packages for redistribution. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 002f2c2e8..ae5e58e15 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -143,6 +143,11 @@ use particular :prop_tgt:`COMPILE_OPTIONS` or the properties must be **requirements**, not merely recommendations or convenience. +See the :ref:`Creating Relocatable Packages` section of the +:manual:`cmake-packages(7)` manual for discussion of additional care +that must be taken when specifying usage requirements while creating +packages for redistribution. + Target Properties ----------------- diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 6ee9df9a6..28c0798e4 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -373,38 +373,6 @@ attempt to use version 3 together with version 4. Packages can choose to employ such a pattern if different major versions of the package are designed to be incompatible. -Note that it is not advisable to populate any properties which may contain -paths, such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and -:prop_tgt:`INTERFACE_LINK_LIBRARIES`, with paths relevant to dependencies. -That would hard-code into installed packages the include directory or library -paths for dependencies **as found on the machine the package was made on**. - -That is, code like this is incorrect for targets which will be used to -generate config file packages: - -.. code-block:: cmake - - target_link_libraries(ClimbingStats INTERFACE - ${Boost_LIBRARIES} ${OtherDep_LIBRARIES} - ) - target_include_directories(ClimbingStats INTERFACE - "$" - ) - -Dependencies must provide their own :ref:`IMPORTED targets ` -which have their own :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and -:prop_tgt:`IMPORTED_LOCATION` populated appropriately. Those -:ref:`IMPORTED targets ` may then be -used with the :command:`target_link_libraries` command for ``ClimbingStats``. - -That way, when a consumer uses the installed package, the -consumer will run the appropriate :command:`find_package` command (via the -find_dependency macro described below) to find -the dependencies on their own machine and populate the -:ref:`IMPORTED targets ` with appropriate paths. Note that -many modules currently shipped with CMake do not currently provide -:ref:`IMPORTED targets `. - A ``NAMESPACE`` with double-colons is specified when exporting the targets for installation. This convention of double-colons gives CMake a hint that the name is an :prop_tgt:`IMPORTED` target when it is used by downstreams @@ -418,6 +386,9 @@ directory in the :variable:`CMAKE_INSTALL_PREFIX`. When the ``IMPORTED`` target is used by downsteam, it automatically consumes the entries from that property. +Creating a Package Configuration File +------------------------------------- + In this case, the ``ClimbingStatsConfig.cmake`` file could be as simple as: .. code-block:: cmake @@ -429,44 +400,6 @@ should be provided by the ``ClimbingStats`` package, they should be in a separate file which is installed to the same location as the ``ClimbingStatsConfig.cmake`` file, and included from there. -Packages created by :command:`install(EXPORT)` are designed to be relocatable, -using paths relative to the location of the package itself. When defining -the interface of a target for ``EXPORT``, keep in mind that the include -directories should be specified as relative paths which are relative to the -:variable:`CMAKE_INSTALL_PREFIX`: - -.. code-block:: cmake - - target_include_directories(tgt INTERFACE - # Wrong, not relocatable: - $ - ) - - target_include_directories(tgt INTERFACE - # Ok, relocatable: - $ - ) - -The ``$`` -:manual:`generator expression ` may be used as -a placeholder for the install prefix without resulting in a non-relocatable -package. This is necessary if complex generator expressions are used: - -.. code-block:: cmake - - target_include_directories(tgt INTERFACE - # Ok, relocatable: - $:$/include/TgtName>> - ) - -The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets -definition file which is specific to the build-tree, and is not relocatable. -This can similiarly be used with a suitable package configuration file and -package version file to define a package for the build tree which may be used -without installation. Consumers of the build tree can simply ensure that the -:variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the -``ClimbingStats_DIR`` to ``/ClimbingStats`` in the cache. - This can also be extended to cover dependencies: .. code-block:: cmake @@ -526,6 +459,85 @@ could not be found because an invalid component was specified. This message variable can be set for any case where the ``_FOUND`` variable is set to ``False``, and will be displayed to the user. +Creating a Package Configuration File for the Build Tree +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets +definition file which is specific to the build-tree, and is not relocatable. +This can similiarly be used with a suitable package configuration file and +package version file to define a package for the build tree which may be used +without installation. Consumers of the build tree can simply ensure that the +:variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the +``ClimbingStats_DIR`` to ``/ClimbingStats`` in the cache. + +.. _`Creating Relocatable Packages`: + +Creating Relocatable Packages +----------------------------- + +Packages created by :command:`install(EXPORT)` are designed to be relocatable, +using paths relative to the location of the package itself. When defining +the interface of a target for ``EXPORT``, keep in mind that the include +directories should be specified as relative paths which are relative to the +:variable:`CMAKE_INSTALL_PREFIX`: + +.. code-block:: cmake + + target_include_directories(tgt INTERFACE + # Wrong, not relocatable: + $ + ) + + target_include_directories(tgt INTERFACE + # Ok, relocatable: + $ + ) + +The ``$`` +:manual:`generator expression ` may be used as +a placeholder for the install prefix without resulting in a non-relocatable +package. This is necessary if complex generator expressions are used: + +.. code-block:: cmake + + target_include_directories(tgt INTERFACE + # Ok, relocatable: + $:$/include/TgtName>> + ) + +This also applies to paths referencing external dependencies. +It is not advisable to populate any properties which may contain +paths, such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and +:prop_tgt:`INTERFACE_LINK_LIBRARIES`, with paths relevant to dependencies. +That would hard-code into installed packages the include directory or library +paths for dependencies **as found on the machine the package was made on**. + +That is, code like this is incorrect for targets which will be used to +generate config file packages: + +.. code-block:: cmake + + target_link_libraries(ClimbingStats INTERFACE + ${Boost_LIBRARIES} ${OtherDep_LIBRARIES} + ) + target_include_directories(ClimbingStats INTERFACE + "$" + ) + +Dependencies must provide their own :ref:`IMPORTED targets ` +which have their own :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and +:prop_tgt:`IMPORTED_LOCATION` populated appropriately. Those +:ref:`IMPORTED targets ` may then be +used with the :command:`target_link_libraries` command for ``ClimbingStats``. + +That way, when a consumer uses the installed package, the +consumer will run the appropriate :command:`find_package` command (via the +find_dependency macro described below) to find +the dependencies on their own machine and populate the +:ref:`IMPORTED targets ` with appropriate paths. Note that +many modules currently shipped with CMake do not currently provide +:ref:`IMPORTED targets `. + .. _`Package Registry`: Package Registry From 3af137824d993ca0a7c18c0768efb12b76154ad0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Apr 2015 09:57:05 -0400 Subject: [PATCH 0412/1029] Help: Update discussion of relocable packages in cmake-packages(7) Explain at the beginning of the section the requirements for a package to be relocatable to justify the rest of the section content. Generalize example to use fictional package names instead of real ones, especially because FindBoost provides no alternative yet. Reword the discussion to represent the preferred approach as "ideal" but also suggest workarounds when find modules do not provide the imported targets. --- Help/manual/cmake-packages.7.rst | 64 ++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 28c0798e4..b9073a57c 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -475,6 +475,10 @@ without installation. Consumers of the build tree can simply ensure that the Creating Relocatable Packages ----------------------------- +A relocatable package must not reference absolute paths of files on +the machine where the package is built that will not exist on the +machines where the package may be installed. + Packages created by :command:`install(EXPORT)` are designed to be relocatable, using paths relative to the location of the package itself. When defining the interface of a target for ``EXPORT``, keep in mind that the include @@ -509,34 +513,56 @@ This also applies to paths referencing external dependencies. It is not advisable to populate any properties which may contain paths, such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and :prop_tgt:`INTERFACE_LINK_LIBRARIES`, with paths relevant to dependencies. -That would hard-code into installed packages the include directory or library -paths for dependencies **as found on the machine the package was made on**. - -That is, code like this is incorrect for targets which will be used to -generate config file packages: +For example, this code may not work well for a relocatable package: .. code-block:: cmake target_link_libraries(ClimbingStats INTERFACE - ${Boost_LIBRARIES} ${OtherDep_LIBRARIES} + ${Foo_LIBRARIES} ${Bar_LIBRARIES} ) target_include_directories(ClimbingStats INTERFACE - "$" + "$" ) -Dependencies must provide their own :ref:`IMPORTED targets ` -which have their own :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and -:prop_tgt:`IMPORTED_LOCATION` populated appropriately. Those -:ref:`IMPORTED targets ` may then be -used with the :command:`target_link_libraries` command for ``ClimbingStats``. +The referenced variables may contain the absolute paths to libraries +and include directories **as found on the machine the package was made on**. +This would create a package with hard-coded paths to dependencies and not +suitable for relocation. -That way, when a consumer uses the installed package, the -consumer will run the appropriate :command:`find_package` command (via the -find_dependency macro described below) to find -the dependencies on their own machine and populate the -:ref:`IMPORTED targets ` with appropriate paths. Note that -many modules currently shipped with CMake do not currently provide -:ref:`IMPORTED targets `. +Ideally such dependencies should be used through their own +:ref:`IMPORTED targets ` that have their own +:prop_tgt:`IMPORTED_LOCATION` and usage requirement properties +such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` populated +appropriately. Those imported targets may then be used with +the :command:`target_link_libraries` command for ``ClimbingStats``: + +.. code-block:: cmake + + target_link_libraries(ClimbingStats INTERFACE Foo::Foo Bar::Bar) + +With this approach the package references its external dependencies +only through the names of :ref:`IMPORTED targets `. +When a consumer uses the installed package, the consumer will run the +appropriate :command:`find_package` commands (via the ``find_dependency`` +macro described above) to find the dependencies and populate the +imported targets with appropriate paths on their own machine. + +Unfortunately many :manual:`modules ` shipped with +CMake do not yet provide :ref:`IMPORTED targets ` +because their development pre-dated this approach. This may improve +incrementally over time. Workarounds to create relocatable packages +using such modules include: + +* When building the package, specify each ``Foo_LIBRARY`` cache + entry as just a library name, e.g. ``-DFoo_LIBRARY=foo``. This + tells the corresponding find module to populate the ``Foo_LIBRARIES`` + with just ``foo`` to ask the linker to search for the library + instead of hard-coding a path. + +* Or, after installing the package content but before creating the + package installation binary for redistribution, manually replace + the absolute paths with placeholders for substitution by the + installation tool when the package is installed. .. _`Package Registry`: From 6ed6ef6237fedc0c187163d8b6c26fb0c9ca43c7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Apr 2015 11:04:57 -0400 Subject: [PATCH 0413/1029] Help: Split cmake-generators(7) into linkable subsections Many places in our documentation refer to "Makefile Generators" or "Visual Studio" generators as a group of generators. Give such places a linkable document section to reference since they cannot cross-reference the individual generators in the groups. --- Help/manual/cmake-generators.7.rst | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 804229b22..6f76fb19a 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -34,6 +34,11 @@ These generators support command-line build tools. In order to use them, one must launch CMake from a command-line prompt whose environment is already configured for the chosen compiler and build tool. +.. _`Makefile Generators`: + +Makefile Generators +^^^^^^^^^^^^^^^^^^^ + .. toctree:: :maxdepth: 1 @@ -42,10 +47,17 @@ already configured for the chosen compiler and build tool. /generator/MinGW Makefiles /generator/NMake Makefiles /generator/NMake Makefiles JOM - /generator/Ninja /generator/Unix Makefiles /generator/Watcom WMake +Ninja Generator +^^^^^^^^^^^^^^^ + +.. toctree:: + :maxdepth: 1 + + /generator/Ninja + IDE Build Tool Generators ------------------------- @@ -53,6 +65,11 @@ These generators support Integrated Development Environment (IDE) project files. Since the IDEs configure their own environment one may launch CMake from any environment. +.. _`Visual Studio Generators`: + +Visual Studio Generators +^^^^^^^^^^^^^^^^^^^^^^^^ + .. toctree:: :maxdepth: 1 @@ -65,6 +82,13 @@ one may launch CMake from any environment. /generator/Visual Studio 11 2012 /generator/Visual Studio 12 2013 /generator/Visual Studio 14 2015 + +Xcode Generator +^^^^^^^^^^^^^^^ + +.. toctree:: + :maxdepth: 1 + /generator/Xcode Extra Generators From af924827120f39f1a7a940bc3f6bc487665145d9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Apr 2015 11:15:12 -0400 Subject: [PATCH 0414/1029] Makefile: Tolerate a BOM while scanning source dependencies (#15493) Otherwise an #include directive on the first line of a source file is ignored if the file contains a Byte-Order-Mark. Suggested-by: Aleksey Konovalov --- Source/cmDependsC.cxx | 21 ++++++++++---- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 26 ++++++++++++++++++ .../CommandLine/cmake_depends-check.cmake | 13 +++++++++ .../CommandLine/cmake_depends-stdout.txt | 1 + .../RunCMake/CommandLine/cmake_depends/test.c | 2 ++ .../RunCMake/CommandLine/cmake_depends/test.h | 1 + .../CommandLine/cmake_depends/test_UTF-16LE.h | Bin 0 -> 58 bytes 7 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/cmake_depends-check.cmake create mode 100644 Tests/RunCMake/CommandLine/cmake_depends-stdout.txt create mode 100644 Tests/RunCMake/CommandLine/cmake_depends/test.c create mode 100644 Tests/RunCMake/CommandLine/cmake_depends/test.h create mode 100644 Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 63d8fa6b3..6cdd4c13d 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -242,13 +242,22 @@ bool cmDependsC::WriteDependencies(const std::set& sources, cmsys::ifstream fin(fullName.c_str()); if(fin) { - // Add this file as a dependency. - dependencies.insert(fullName); + cmsys::FStream::BOM bom = cmsys::FStream::ReadBOM(fin); + if(bom == cmsys::FStream::BOM_None || + bom == cmsys::FStream::BOM_UTF8) + { + // Add this file as a dependency. + dependencies.insert(fullName); - // Scan this file for new dependencies. Pass the directory - // containing the file to handle double-quote includes. - std::string dir = cmSystemTools::GetFilenamePath(fullName); - this->Scan(fin, dir.c_str(), fullName); + // Scan this file for new dependencies. Pass the directory + // containing the file to handle double-quote includes. + std::string dir = cmSystemTools::GetFilenamePath(fullName); + this->Scan(fin, dir.c_str(), fullName); + } + else + { + // Skip file with encoding we do not implement. + } } } } diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index a9c49e788..e8b458482 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -80,3 +80,29 @@ run_cmake(D_nested_cache) set(RunCMake_TEST_OPTIONS "-DFOO:STRING=-DBAR:BOOL=BAZ") run_cmake(D_typed_nested_cache) + +function(run_cmake_depends) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake" " +set(CMAKE_DEPENDS_LANGUAGES \"C\") +set(CMAKE_DEPENDS_CHECK_C + \"${RunCMake_TEST_SOURCE_DIR}/test.c\" + \"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/test.c.o\" + ) +") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeDirectoryInformation.cmake" " +set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\") +set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") +") + run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends + "Unix Makefiles" + ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} + ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} + ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake + ) +endfunction() +run_cmake_depends() diff --git a/Tests/RunCMake/CommandLine/cmake_depends-check.cmake b/Tests/RunCMake/CommandLine/cmake_depends-check.cmake new file mode 100644 index 000000000..031478b7b --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends-check.cmake @@ -0,0 +1,13 @@ +set(depend_make "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/depend.make") +if(EXISTS "${depend_make}") + file(READ "${depend_make}" depend_make_content) + string(REGEX REPLACE "\n+$" "" depend_make_content "${depend_make_content}") + if(NOT depend_make_content MATCHES " +CMakeFiles/DepTarget.dir/test.c.o: .*/Tests/RunCMake/CommandLine/cmake_depends/test.c +CMakeFiles/DepTarget.dir/test.c.o: .*/Tests/RunCMake/CommandLine/cmake_depends/test.h$") + string(REPLACE "\n" "\n " depend_make_content " ${depend_make_content}") + set(RunCMake_TEST_FAILED "depend.make does not have expected content:\n${depend_make_content}") + endif() +else() + set(RunCMake_TEST_FAILED "depend.make missing:\n ${depend_make}") +endif() diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt new file mode 100644 index 000000000..8fe092b4a --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt @@ -0,0 +1 @@ +^Scanning dependencies of target DepTarget$ diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.c b/Tests/RunCMake/CommandLine/cmake_depends/test.c new file mode 100644 index 000000000..92c056f70 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends/test.c @@ -0,0 +1,2 @@ +#include "test.h" +#include "test_UTF-16LE.h" diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.h b/Tests/RunCMake/CommandLine/cmake_depends/test.h new file mode 100644 index 000000000..fd8738811 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends/test.h @@ -0,0 +1 @@ +void test(void) {} diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h new file mode 100644 index 0000000000000000000000000000000000000000..bf56ec694c6608f5080125b027423ed3ca749582 GIT binary patch literal 58 zcmezWuZ$s|A(J76L4l!!A(f#RNX9dSGK4U=0ck@9GX@_9R|X9Rm?}-6x@v}61}+8w DlQ9cg literal 0 HcmV?d00001 From 01a9ab0def07ecddbc1bdfa67fec1bd3e6d030ea Mon Sep 17 00:00:00 2001 From: Gilles Khouzam Date: Tue, 31 Mar 2015 13:49:39 -0700 Subject: [PATCH 0415/1029] VS: Add support for XAML source files XAML files are by default of type Page in the vcxproj and can be overriden by setting the VS_XAML_TYPE property. The .cpp and .h file of the same name are automatically added as depending on the XAML file. New VSXaml test builds a basic XAML WindowsStore 8.1 app with VS2013. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_sf/VS_XAML_TYPE.rst | 6 + Help/release/dev/vs-xaml.rst | 6 + Source/cmGeneratorTarget.cxx | 49 +++++++ Source/cmGeneratorTarget.h | 13 ++ Source/cmVisualStudio10TargetGenerator.cxx | 80 ++++++++++- Source/cmVisualStudio10TargetGenerator.h | 3 + Tests/CMakeLists.txt | 11 ++ Tests/VSWindowsFormsResx/CMakeLists.txt | 2 +- Tests/VSXaml/App.xaml | 7 + Tests/VSXaml/App.xaml.cpp | 125 ++++++++++++++++++ Tests/VSXaml/App.xaml.h | 27 ++++ Tests/VSXaml/Assets/Logo.scale-100.png | Bin 0 -> 801 bytes Tests/VSXaml/Assets/SmallLogo.scale-100.png | Bin 0 -> 329 bytes .../VSXaml/Assets/SplashScreen.scale-100.png | Bin 0 -> 2146 bytes Tests/VSXaml/Assets/StoreLogo.scale-100.png | Bin 0 -> 429 bytes Tests/VSXaml/CMakeLists.txt | 52 ++++++++ Tests/VSXaml/MainPage.xaml | 14 ++ Tests/VSXaml/MainPage.xaml.cpp | 27 ++++ Tests/VSXaml/MainPage.xaml.h | 21 +++ Tests/VSXaml/Package.appxmanifest | 41 ++++++ Tests/VSXaml/VSXaml_TemporaryKey.pfx | Bin 0 -> 2560 bytes Tests/VSXaml/pch.cpp | 6 + Tests/VSXaml/pch.h | 11 ++ 24 files changed, 498 insertions(+), 4 deletions(-) create mode 100644 Help/prop_sf/VS_XAML_TYPE.rst create mode 100644 Help/release/dev/vs-xaml.rst create mode 100644 Tests/VSXaml/App.xaml create mode 100644 Tests/VSXaml/App.xaml.cpp create mode 100644 Tests/VSXaml/App.xaml.h create mode 100644 Tests/VSXaml/Assets/Logo.scale-100.png create mode 100644 Tests/VSXaml/Assets/SmallLogo.scale-100.png create mode 100644 Tests/VSXaml/Assets/SplashScreen.scale-100.png create mode 100644 Tests/VSXaml/Assets/StoreLogo.scale-100.png create mode 100644 Tests/VSXaml/CMakeLists.txt create mode 100644 Tests/VSXaml/MainPage.xaml create mode 100644 Tests/VSXaml/MainPage.xaml.cpp create mode 100644 Tests/VSXaml/MainPage.xaml.h create mode 100644 Tests/VSXaml/Package.appxmanifest create mode 100644 Tests/VSXaml/VSXaml_TemporaryKey.pfx create mode 100644 Tests/VSXaml/pch.cpp create mode 100644 Tests/VSXaml/pch.h diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 1dff33e96..76dd27959 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -298,6 +298,7 @@ Properties on Source Files /prop_sf/VS_SHADER_FLAGS /prop_sf/VS_SHADER_MODEL /prop_sf/VS_SHADER_TYPE + /prop_sf/VS_XAML_TYPE /prop_sf/WRAP_EXCLUDE /prop_sf/XCODE_EXPLICIT_FILE_TYPE /prop_sf/XCODE_LAST_KNOWN_FILE_TYPE diff --git a/Help/prop_sf/VS_XAML_TYPE.rst b/Help/prop_sf/VS_XAML_TYPE.rst new file mode 100644 index 000000000..e92191dcb --- /dev/null +++ b/Help/prop_sf/VS_XAML_TYPE.rst @@ -0,0 +1,6 @@ +VS_XAML_TYPE +------------ + +Mark a XAML source file as a different type than the default ``Page``. +The most common usage would be to set the default App.xaml file as +ApplicationDefinition. diff --git a/Help/release/dev/vs-xaml.rst b/Help/release/dev/vs-xaml.rst new file mode 100644 index 000000000..575899ff8 --- /dev/null +++ b/Help/release/dev/vs-xaml.rst @@ -0,0 +1,6 @@ +vs-xaml +------- + +* The :ref:`Visual Studio Generators` learned to support ``.xaml`` + source files and automatically associate them with corresponding + ``.h`` and ``.cpp`` sources. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e0af47a2f..41d12d703 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -56,6 +56,7 @@ struct ResxTag {}; struct ModuleDefinitionFileTag {}; struct AppManifestTag{}; struct CertificatesTag{}; +struct XamlTag{}; template struct IsSameTag @@ -98,6 +99,20 @@ struct DoAccept data.ExpectedResxHeaders.insert(hFileName); data.ResxSources.push_back(f); } + static void Do(cmGeneratorTarget::XamlData& data, cmSourceFile* f) + { + // Build and save the name of the corresponding .h and .cpp file + // This relationship will be used later when building the project files. + // Both names would have been auto generated from Visual Studio + // where the user supplied the file name and Visual Studio + // appended the suffix. + std::string xaml = f->GetFullPath(); + std::string hFileName = xaml + ".h"; + std::string cppFileName = xaml + ".cpp"; + data.ExpectedXamlHeaders.insert(hFileName); + data.ExpectedXamlSources.insert(cppFileName); + data.XamlSources.push_back(f); + } static void Do(std::string& data, cmSourceFile* f) { data = f->GetFullPath(); @@ -186,6 +201,10 @@ struct TagVisitor { DoAccept::Result>::Do(this->Data, sf); } + else if (ext == "xaml") + { + DoAccept::Result>::Do(this->Data, sf); + } else if(this->Header.find(sf->GetFullPath().c_str())) { DoAccept::Result>::Do(this->Data, sf); @@ -437,6 +456,36 @@ cmGeneratorTarget IMPLEMENT_VISIT(Certificates); } +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetExpectedXamlHeaders(std::set& headers, + const std::string& config) const +{ + XamlData data; + IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) + headers = data.ExpectedXamlHeaders; +} + +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetExpectedXamlSources(std::set& srcs, + const std::string& config) const +{ + XamlData data; + IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) + srcs = data.ExpectedXamlSources; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget +::GetXamlSources(std::vector& srcs, + const std::string& config) const +{ + XamlData data; + IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) + srcs = data.XamlSources; +} + //---------------------------------------------------------------------------- bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index c329cf55e..c79aa728b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -58,6 +58,12 @@ public: const std::string& config) const; void GetCertificates(std::vector&, const std::string& config) const; + void GetXamlSources(std::vector&, + const std::string& config) const; + void GetExpectedXamlHeaders(std::set&, + const std::string& config) const; + void GetExpectedXamlSources(std::set&, + const std::string& config) const; void ComputeObjectMapping(); @@ -132,6 +138,13 @@ public: mutable std::set ExpectedResxHeaders; mutable std::vector ResxSources; }; + + struct XamlData { + std::set ExpectedXamlHeaders; + std::set ExpectedXamlSources; + std::vector XamlSources; + }; + private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector Depends; }; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 19444edc1..dad6f9339 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -461,6 +461,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteAllSources(); this->WriteDotNetReferences(); this->WriteEmbeddedResourceGroup(); + this->WriteXamlFilesGroup(); this->WriteWinRTReferences(); this->WriteProjectReferences(); this->WriteString( @@ -522,8 +523,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() this->WriteString("", 3); std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h"; - (*this->BuildFileStream ) << hFileName; - this->WriteString("\n", 3); + (*this->BuildFileStream) << hFileName << "\n"; std::vector const * configs = this->GlobalGenerator->GetConfigurations(); @@ -546,6 +546,38 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() } } +void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() +{ + std::vector xamlObjs; + this->GeneratorTarget->GetXamlSources(xamlObjs, ""); + if (!xamlObjs.empty()) + { + this->WriteString("\n", 1); + for (std::vector::const_iterator + oi = xamlObjs.begin(); oi != xamlObjs.end(); ++oi) + { + std::string obj = (*oi)->GetFullPath(); + std::string xamlType; + const char * xamlTypeProperty = (*oi)->GetProperty("VS_XAML_TYPE"); + if (xamlTypeProperty) + { + xamlType = xamlTypeProperty; + } + else + { + xamlType = "Page"; + } + + this->WriteSource(xamlType, *oi, ">\n"); + this->WriteString("Designer\n", 3); + this->WriteString("BuildFileStream) << xamlType << ">\n"; + + } + this->WriteString("\n", 1); + } +} + void cmVisualStudio10TargetGenerator::WriteTargetSpecificReferences() { if(this->MSTools) @@ -1192,12 +1224,21 @@ WriteGroupSources(const char* name, void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) { - if(this->IsResxHeader(sf->GetFullPath())) + std::string const& fileName = sf->GetFullPath(); + if (this->IsResxHeader(fileName)) { this->WriteSource("ClInclude", sf, ">\n"); this->WriteString("CppForm\n", 3); this->WriteString("\n", 2); } + else if (this->IsXamlHeader(fileName)) + { + this->WriteSource("ClInclude", sf, ">\n"); + this->WriteString("", 3); + std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); + (*this->BuildFileStream) << xamlFileName << "\n"; + this->WriteString("\n", 2); + } else { this->WriteSource("ClInclude", sf); @@ -1669,6 +1710,17 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( " ", "\n", lang); } } + if (this->IsXamlSource(source->GetFullPath())) + { + (*this->BuildFileStream) << firstString; + firstString = ""; // only do firstString once + hasFlags = true; + this->WriteString("", 3); + const std::string& fileName = source->GetFullPath(); + std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); + (*this->BuildFileStream) << xamlFileName << "\n"; + } + return hasFlags; } @@ -2749,6 +2801,28 @@ bool cmVisualStudio10TargetGenerator:: return it != expectedResxHeaders.end(); } +bool cmVisualStudio10TargetGenerator:: +IsXamlHeader(const std::string& headerFile) +{ + std::set expectedXamlHeaders; + this->GeneratorTarget->GetExpectedXamlHeaders(expectedXamlHeaders, ""); + + std::set::const_iterator it = + expectedXamlHeaders.find(headerFile); + return it != expectedXamlHeaders.end(); +} + +bool cmVisualStudio10TargetGenerator:: +IsXamlSource(const std::string& sourceFile) +{ + std::set expectedXamlSources; + this->GeneratorTarget->GetExpectedXamlSources(expectedXamlSources, ""); + + std::set::const_iterator it = + expectedXamlSources.find(sourceFile); + return it != expectedXamlSources.end(); +} + void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() { bool isAppContainer = false; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index a02dfa845..a2776de6b 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -69,6 +69,7 @@ private: void WriteEmbeddedResourceGroup(); void WriteWinRTReferences(); void WriteWinRTPackageCertificateKeyFile(); + void WriteXamlFilesGroup(); void WritePathAndIncrementalLinkOptions(); void WriteItemDefinitionGroups(); void VerifyNecessaryFiles(); @@ -119,6 +120,8 @@ private: void AddMissingSourceGroups(std::set& groupsUsed, const std::vector& allGroups); bool IsResxHeader(const std::string& headerFile); + bool IsXamlHeader(const std::string& headerFile); + bool IsXamlSource(const std::string& headerFile); cmIDEFlagTable const* GetClFlagTable() const; cmIDEFlagTable const* GetRcFlagTable() const; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5944d081e..1df39aa02 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1927,6 +1927,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1) add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013 ARM" WindowsStore 8.1) add_test_VSWinStorePhone(vs12-store81-X64 "Visual Studio 12 2013 Win64" WindowsStore 8.1) + + add_test(NAME VSXaml COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VSXaml" + "${CMake_BINARY_DIR}/Tests/VSXaml" + --build-generator "Visual Studio 12 2013" + --build-project VSXaml + --build-config $ + --build-options -DCMAKE_SYSTEM_NAME=WindowsStore + -DCMAKE_SYSTEM_VERSION=8.1 + ) endif() if(vs11 AND wp80) add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0) diff --git a/Tests/VSWindowsFormsResx/CMakeLists.txt b/Tests/VSWindowsFormsResx/CMakeLists.txt index 437381085..43c483383 100644 --- a/Tests/VSWindowsFormsResx/CMakeLists.txt +++ b/Tests/VSWindowsFormsResx/CMakeLists.txt @@ -14,7 +14,7 @@ include(CheckCXXSourceCompiles) include(CheckIncludeFile) # Note: The designable form is assumed to have a .h extension as is default in Visual Studio. -# Node: The designable form is assumed to have a .resx file with the same name and path (save extension) as is default in Visual Studio +# Note: The designable form is assumed to have a .resx file with the same name and path (save extension) as is default in Visual Studio set(TARGET_H WindowsFormsResx/MyForm.h diff --git a/Tests/VSXaml/App.xaml b/Tests/VSXaml/App.xaml new file mode 100644 index 000000000..eecf2c192 --- /dev/null +++ b/Tests/VSXaml/App.xaml @@ -0,0 +1,7 @@ + + + diff --git a/Tests/VSXaml/App.xaml.cpp b/Tests/VSXaml/App.xaml.cpp new file mode 100644 index 000000000..334dc1f9c --- /dev/null +++ b/Tests/VSXaml/App.xaml.cpp @@ -0,0 +1,125 @@ +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace VSXaml; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ + +#if _DEBUG + // Show graphics profiling information while debugging. + if (IsDebuggerPresent()) + { + // Display the current frame rate counters + DebugSettings->EnableFrameRateCounter = true; + } +#endif + + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + // Set the default language + rootFrame->Language = Windows::Globalization::ApplicationLanguages::Languages->GetAt(0); + + rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + + } + + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } + else + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Ensure the current window is active + Window::Current->Activate(); + } +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + //TODO: Save application state and stop any background activity +} + +/// +/// Invoked when Navigation to a certain page fails +/// +/// The Frame which failed navigation +/// Details about the navigation failure +void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +{ + throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); +} \ No newline at end of file diff --git a/Tests/VSXaml/App.xaml.h b/Tests/VSXaml/App.xaml.h new file mode 100644 index 000000000..1f65bdab9 --- /dev/null +++ b/Tests/VSXaml/App.xaml.h @@ -0,0 +1,27 @@ +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace VSXaml +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + protected: + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + internal: + App(); + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); + }; +} diff --git a/Tests/VSXaml/Assets/Logo.scale-100.png b/Tests/VSXaml/Assets/Logo.scale-100.png new file mode 100644 index 0000000000000000000000000000000000000000..e26771cb33a49bbef824aa333737181b0a5b09a3 GIT binary patch literal 801 zcmeAS@N?(olHy`uVBq!ia0vp^(?FPm4M^HB7Cr(}k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m=1foIEGZ*dUJQLud<^=L*gE#63Ho!PGzwUb%GPK6&5iF zt!p@aGNX}6(PVh|N)M-?0RNcTbjaWgEU8noxUax-n>&3Ay)#!y&O11y2sKEF zt72@XC1)RvT6Xw=y_`Ce)`nGULLL^lI$kwi^E+dQT7YeXY4GvlRR%kj1x$VZi%Bdd zz}2Giy=-_$h+v#(S+};)DuE4EM?_^qB_eDeo@&q%StD1F>L|*0ZC2sb-}llSMTM?O z6{b3iid~yk@VE7q7Wb+P8?H5IYp?pSVcLE~18m#ygK20HL@6W5woI~Fjlw$fX1U{xQA5a+t0 zH$WNIb=fNpWHo}M9#;K6eszDZKty_|-?j4iocj5#zotrWc;@;w`H@=mjsvS2wXX0_ zY}l$4@^sE?UcC)ji*L=Z&}P!xaL&2((OQlj2dv~pV-ifAS;ZsH1{`D!GY%yys5WH)f>ZLo5m%6XjuXdbKMR7MEHSyb{m!_{Afji&MT$_sz7 z>1{~MlIFe28FRN(GC_~;#Jp4ADipP+9hh|P#-&`vO-Upt3jE0@YLh(^55uYWl9g)Z RA3>Rb!PC{xWt~$(69A&hN*MqE literal 0 HcmV?d00001 diff --git a/Tests/VSXaml/Assets/SmallLogo.scale-100.png b/Tests/VSXaml/Assets/SmallLogo.scale-100.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb0d9d528c42f132872e8af4dc563081b0b9aff GIT binary patch literal 329 zcmV-P0k-~$P)q$gGRCwC#*X;?zAP@%N+|i#I!$mrh zlQ>KU$Rdu>|JH&931_?y6Djl{gb>4nCV5pzDJ?S!mq|4ZejKj%i@j$H{#ML~2Y{DF z$=}bKPaz+UGt{v(4CTQQXym}&iW8{s!ew~XIE7NLjQpy#I2S$rous$~?f%DHT#B*+ zq=#!zc5=0FEqWFpB%UE(L807on!pidHPLgYO}XEgorrg;PB=8ipgQ5u5`&g_MQaRd zaU7Ao8XQMuuN21-s0PPTs1%38x_Yl3Fs-|Y4!C-;M-8g@n*v@1|s#GQ665=9@Rxy?u0YW0&WN+~=RXpPbVXXL4m7Aq=E6I0%{06TwRn=U9d8>exk> zD-Z%M3DNQ`bTLSEF=%NFyoHcAkD*CiXqljo*0E?o$GiDC4q}}|%*0WghLlK#npw?hecrM}Mw?`E(z5C8< z8&*b^!{>5?4aT89vdrgBgSc-x6JZD3F^l#*G(@OO*^1D%Eu7?HAy<3kTLqW9N{^#6vso zVQwY48q7)m{~xQ64RV7{E7Y=&T~?^05Ky`5oNQ8bLgFCPq9co^R09BVRS1OAmH;hU zC#q(N!gNqm!zU#%sv{r5mm-Uv8b-~a1F-;p^>)pnXfKge4s9?;;MFIr*fixPG}NBA z6_G5BEmeO6XXh(emkciB{7tA;iwC2^s^VzyU_h0@ae84ACMY`cIDEju=<`q|2QAEv zW_)W|i|9aknqdmS=#w73eW_csQ$8IhT^vY1^1;X3&J0{%*tcQq!gJpr3w?TJc~@5= zKV5sM{$3k>b#S$@CTkhIF*{v*u(F&$&Yq1naHxt8Mz2N%7aQ3(^VNRZahk1||7?Bl z*idzO_u)FhRj4cPzDO>YA>>lxAGaciEiX8Xzp1SVPv91};$OG3cC&8!v3{Jq^kH@8 UTIccK;hzT5*3#}uZuEx!0OwrBv;Y7A literal 0 HcmV?d00001 diff --git a/Tests/VSXaml/Assets/StoreLogo.scale-100.png b/Tests/VSXaml/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000000000000000000000000000000000000..dcb672712c6823a0c91548ded70a8acb85536b4d GIT binary patch literal 429 zcmV;e0aE^nP)NtYJa1l)bQ5qwGXpZbs7%2oRMd4y35$s&66(fxhNg8W02!vSn zdlrL2h^Fx+3=$z;kK{0D#MyeJ8WRWZcLSf(PcQ_mLOhrmC}O-tX^0c>5`YvCUZVsc zG-6#78ubjJ5nA;OX&^K(q=i6ZNE3m?kTwE^AqxZoLskfB3|S&1F=UO9!cY$g2@Lgu z;9{sJ1P9|X2L`r1#Gs8R{E^$PRrMaC86q| + + + + + diff --git a/Tests/VSXaml/MainPage.xaml.cpp b/Tests/VSXaml/MainPage.xaml.cpp new file mode 100644 index 000000000..d0a64e8b2 --- /dev/null +++ b/Tests/VSXaml/MainPage.xaml.cpp @@ -0,0 +1,27 @@ +// +// MainPage.xaml.cpp +// Implementation of the MainPage class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace VSXaml; + +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 + +MainPage::MainPage() +{ + InitializeComponent(); +} diff --git a/Tests/VSXaml/MainPage.xaml.h b/Tests/VSXaml/MainPage.xaml.h new file mode 100644 index 000000000..ccc781b8f --- /dev/null +++ b/Tests/VSXaml/MainPage.xaml.h @@ -0,0 +1,21 @@ +// +// MainPage.xaml.h +// Declaration of the MainPage class. +// + +#pragma once + +#include "MainPage.g.h" + +namespace VSXaml +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public ref class MainPage sealed + { + public: + MainPage(); + + }; +} diff --git a/Tests/VSXaml/Package.appxmanifest b/Tests/VSXaml/Package.appxmanifest new file mode 100644 index 000000000..873a64aeb --- /dev/null +++ b/Tests/VSXaml/Package.appxmanifest @@ -0,0 +1,41 @@ + + + + + + + VSXaml + Microsoft + Assets\StoreLogo.png + + + + 6.3.0 + 6.3.0 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/VSXaml/VSXaml_TemporaryKey.pfx b/Tests/VSXaml/VSXaml_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..1cad9993d6abdb0e1bc1456b2470dd386f8f3ef2 GIT binary patch literal 2560 zcmai03piBk8eVJGni=CZghDYRk%-pRFm7ctks|lY*luTr$)#MvxFl01mx?ZOEi>g3 zQJdOwNt3M*b5fD*5|R>%Qt4tMbXNO0r@hbfoM)f)J>UO--}`^>`qs1l@A42TDdc!WxrM<_$#VuXj2_^&1GJj}y>MtIm+RA+Ef|7J-`f|w#6 zyo~VR1!N6Q@;@;8a#>hnF|U-_On!9}gTZ&hJoqsQOne(a7^YxxvRC0?&#iSJ4dzY>04ma`qIK5yv(e^KYu z^tO-(h-s32)@;sr=5I3TaiIiy)GeNb^iX5=nIrBbuEm)7?TEH0j#G5Fps^HY9@J6V z^mH*Rrycr0?h@xIJ??#m`R!3!y9#utp=9yeLZ?}h+r^9Nu2B~xIM_`RcgSl&3)Z7IC@l|(#Y?4 zHF*1ql5?KE_Id!YY^o+mNR$Ay|T?YdOP&c z%v?|X1BG@rr$@Y)uumAm$G=%yYUr61W-Kzxo-Aioo;)68ln0NlOC`??+#}A$LH*sd zVGZ+^)uT91tn;Spw*Ag0z>yo-r_b0sUmqRj z9eDN&40Xx*x+h=n_9JlWSh40#Nan=8!%Z(PIqHaY5?Wu>|K2vk@%%FGEex?B$M{P= zSFzr%j}_dfIrTT}KE~gdYvFu{bM#FWAudb%MSHX8#@Q{d&U2Z@=CLU@tKpzRA60>q zC~Qv9n7yZ8TRnAEunW`F!!+?wvAY^o6>mr}*2g!=hxJfD`?WPc+uO%H62YWT6wCL1 zJiwrc2%=p*l8Q3?kb))Zy^9@Ga`1_|u+%RzEAs|@t?gD1u6@{8=gn@iRD3bWU`eqJ z)Kwx@3?>M0Ms&s|&+FQ6?+*+#6DOl~1uj6J}EgNoIe)nCQ z?cN;2Xx2Dia@PBJnO*-`$H_aRie6m>yPH?9632BPETnEW{*L3!zjEQCL zm1TdGiy;KPzG6R8GhyF)f@vG9PN{AVn{{fRY!Gb7ZFEU>v|t7woQ@MhiUVm)e zh%>uEu}&~XINMSJ_SwBw*jcJ$Rvr^_MHHKEdHIQHlj>_z<16L0aj9zI z)|}ZO;l`~MLjBX1JG2|+l_zfBT;DXL;(GU^PkhUotxgZO=xA}XIt(WBd>1n+?!e|=^v>}cos=Av=Zd|RN=oq zjL$SMT(zr4-dPPpSFC3dyerl9$89b@NI3n){+#&a2BEG4E9Kx}-@al&7%Awwt7*Z_ z4lizZL^O@?CHczPi80iKdPj41p#E(uB$91Md103g0Nf*uZp zK^{#Wq&TTN0K0(@AOMI0B7kUA_W&^f8E{3%??^ZhgnD$;P5>fNECThT048b&|G^>y zPJhJ3qFx}t2BHx5pE(sN40R7QAQspQxB+1($rPZWf&j*7C=D|c8Ugf2Ru z;I1E?fUxpA!4xGJq4;KmhfytpFdzmaS1olDvsF0pi&gx3LlwdMMMUOD5>N^YAgUB) zWF-!Aham+beK&J2o9xDpjv>?8Q85U4l?;W7P*9;E=<~BOaWe&-{{;S)%>&o|H5rHn zARb5r5FRLr;ejB~Im>5MEIo<-t#4zQ37u?LQoOEK&tZPfszbZ5?4xx%)7jjS(Q@cY z`6gOoLE+7#O`nkINXLVEgJj$B0w%^fdxVfrZFb2>`(nr3XnRS1>L1A-;;CO(Y$dIu zXPBRGOJK+ePFL4DIZ|y~43x8mzE$#lX?4O>v)|{ggluHm28QxY0_qd_<4U@a)%o+@ zvfE@0U6AKwp9-^!mi#Biaa6M9M7-wGj-SG@y$kxG6-}u}#(e>|`N_gx>typJ?-RJ1 zaD6=4h7@Q*V#`Wf4-Kaz_*kdrH(`uTxVIPIm0LlB){ok2Dle#5l+lZ~Rg3lpzc`Sk zIA1oOQ_g;Xfj|H(jY1+3Y4rcADS+TN7=r+4iKCttER9IwB+#o$2Z9^;K9+%xFSwm# z%`>)^Pq~I1&X4cY@T*}=8=4zTUv^mUclnpAtkdzs4mn_hLW)Oy^hkntHLhjatkv+< zy27B7#8#*JWSuT!gGGtO$iO3d!hzCU8`cT6_^V5)k>;l3j zHR7fE&#aFww`O)S>NRIJ@E1}`Lz7lYe=;F#IU8-@|GraewC^Y4!uSfgxUnuA;!O8L z)(^20_Vnyn z=#3q!Bl}k)`CO4&TF%ggiiBIFck-vy%bteYP?Y}n(PD;>5Ihd6CktUzVMU8E@i3jS s`JY3V%ySx()iaTKAjO&Z|Gm0{QWNWFTqk4^#A|> literal 0 HcmV?d00001 diff --git a/Tests/VSXaml/pch.cpp b/Tests/VSXaml/pch.cpp new file mode 100644 index 000000000..01484ff5a --- /dev/null +++ b/Tests/VSXaml/pch.cpp @@ -0,0 +1,6 @@ +// +// pch.cpp +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" diff --git a/Tests/VSXaml/pch.h b/Tests/VSXaml/pch.h new file mode 100644 index 000000000..2c4354dd1 --- /dev/null +++ b/Tests/VSXaml/pch.h @@ -0,0 +1,11 @@ +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include +#include + +#include "App.xaml.h" From 659896d3ed21bc7da1cf394c17e1a60e4d4ee5f7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 2 Apr 2015 15:41:06 -0400 Subject: [PATCH 0416/1029] Help: Revise target_link_libraries command documentation Organize the documentation into subsections to separate the signatures. Refactor the discussion of allowed link items into bullet points and expand into more detail on each. --- Help/command/target_link_libraries.rst | 202 +++++++++++++++---------- 1 file changed, 121 insertions(+), 81 deletions(-) diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 88a555aa4..393c8b454 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -1,38 +1,107 @@ target_link_libraries --------------------- -Link a target to given libraries. +.. only:: html + + .. contents:: + +Specify libraries or flags to use when linking a given target and/or +its dependents. :ref:`Usage requirements ` +from linked library targets will be propagated. Usage requirements +of a target's dependencies affect compilation of its own sources. + +Overview +^^^^^^^^ + +This command has several signatures as detailed in subsections below. +All of them have the general form:: + + target_link_libraries( ... ... ...) + +The named ```` must have been created in the current directory by +a command such as :command:`add_executable` or :command:`add_library`. +Repeated calls for the same ```` append items in the order called. +Each ```` may be: + +* **A library target name**: The generated link line will have the + full path to the linkable library file associated with the target. + The buildsystem will have a dependency to re-link ```` if + the library file changes. + + The named target must be created by :command:`add_library` within + the project or as an :ref:`IMPORTED library `. + If it is created within the project an ordering dependency will + automatically be added in the build system to make sure the named + library target is up-to-date before the ```` links. + +* **A full path to a library file**: The generated link line will + normally preserve the full path to the file. However, there are + some cases where CMake must ask the linker to search for the library + (e.g. ``/usr/lib/libfoo.so`` becomes ``-lfoo``), such as when it + appears in a system library directory that the compiler front-end + may replace with an alternative. Either way, the buildsystem will + have a dependency to re-link ```` if the library file changes. + + If the library file is in a Mac OSX framework, the ``Headers`` directory + of the framework will also be processed as a + :ref:`usage requirement `. This has the same + effect as passing the framework directory as an include directory. + +* **A plain library name**: The generated link line will ask the linker + to search for the library (e.g. ``foo`` becomes ``-lfoo`` or ``foo.lib``). + +* **A link flag**: Item names starting with ``-``, but not ``-l`` or + ``-framework``, are treated as linker flags. Note that such flags will + be treated like any other library link item for purposes of transitive + dependencies, so they are generally safe to specify only as private link + items that will not propagate to dependents. + +* A ``debug``, ``optimized``, or ``general`` keyword immediately followed + by another ````. The item following such a keyword will be used + only for the corresponding build configuration. The ``debug`` keyword + corresponds to the ``Debug`` configuration (or to configurations named + in the :prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set). + The ``optimized`` keyword corresponds to all other configurations. The + ``general`` keyword corresponds to all configurations, and is purely + optional. Higher granularity may be achieved for per-configuration + rules by creating and linking to + :ref:`IMPORTED library targets `. + +Items containing ``::``, such as ``Foo::Bar``, are assumed to be +:ref:`IMPORTED ` or :ref:`ALIAS ` library +target names and will cause an error if no such target exists. +See policy :policy:`CMP0028`. + +Arguments to ``target_link_libraries`` may use "generator expressions" +with the syntax ``$<...>``. Note however, that generator expressions +will not be used in OLD handling of :policy:`CMP0003` or :policy:`CMP0004`. +See the :manual:`cmake-generator-expressions(7)` manual for available +expressions. See the :manual:`cmake-buildsystem(7)` manual for more on +defining buildsystem properties. + +Libraries for a Target and/or its Dependents +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: - target_link_libraries( [item1 [item2 [...]]] - [[debug|optimized|general] ] ...) + target_link_libraries( + ... + [ ...]...) -Specify libraries or flags to use when linking a given target. The -named ```` must have been created in the current directory by a -command such as :command:`add_executable` or :command:`add_library`. The -remaining arguments specify library names or flags. Repeated calls for -the same ```` append items in the order called. +The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` keywords can be used to +specify both the link dependencies and the link interface in one command. +Libraries and targets following ``PUBLIC`` are linked to, and are made +part of the link interface. Libraries and targets following ``PRIVATE`` +are linked to, but are not made part of the link interface. Libraries +following ``INTERFACE`` are appended to the link interface and are not +used for linking ````. -If a library name matches that of another target in the project a -dependency will automatically be added in the build system to make sure -the library being linked is up-to-date before the target links. Item names -starting with ``-``, but not ``-l`` or ``-framework``, are treated as -linker flags. Note that such flags will be treated like any other library -link item for purposes of transitive dependencies, so they are generally -safe to specify only as private link items that will not propagate to -dependents of ````. +Libraries for both a Target and its Dependents +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A ``debug``, ``optimized``, or ``general`` keyword indicates that the -library immediately following it is to be used only for the -corresponding build configuration. The ``debug`` keyword corresponds to -the Debug configuration (or to configurations named in the -:prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set). The -``optimized`` keyword corresponds to all other configurations. The -``general`` keyword corresponds to all configurations, and is purely -optional (assumed if omitted). Higher granularity may be achieved for -per-configuration rules by creating and linking to -:ref:`IMPORTED library targets `. +:: + + target_link_libraries( ...) Library dependencies are transitive by default with this signature. When this target is linked into another target then the libraries @@ -45,37 +114,34 @@ by setting the property directly. When :policy:`CMP0022` is not set to of this command may set the property making any libraries linked exclusively by this signature private. -CMake will also propagate :ref:`usage requirements ` -from linked library targets. Usage requirements of dependencies affect -compilation of sources in the ````. - -If an ```` is a library in a Mac OX framework, the ``Headers`` -directory of the framework will also be processed as a -:ref:`usage requirement `. This has the same -effect as passing the framework directory as an include directory. - --------------------------------------------------------------------------- +Libraries for a Target and/or its Dependents (Legacy) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: target_link_libraries( - ... - [ ... ] ...]) + ... + [ ...]...) -The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE`` keywords can be used to -specify both the link dependencies and the link interface in one command. -Libraries and targets following ``PUBLIC`` are linked to, and are made -part of the link interface. Libraries and targets following ``PRIVATE`` -are linked to, but are not made part of the link interface. Libraries -following ``INTERFACE`` are appended to the link interface and are not -used for linking ````. +The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both +the link dependencies and the link interface in one command. --------------------------------------------------------------------------- +This signature is for compatibility only. Prefer the ``PUBLIC`` or +``PRIVATE`` keywords instead. + +Libraries and targets following ``LINK_PUBLIC`` are linked to, and are +made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy +:policy:`CMP0022` is not ``NEW``, they are also made part of the +:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following +``LINK_PRIVATE`` are linked to, but are not made part of the +:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`). + +Libraries for Dependents Only (Legacy) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: - target_link_libraries( LINK_INTERFACE_LIBRARIES - [[debug|optimized|general] ] ...) + target_link_libraries( LINK_INTERFACE_LIBRARIES ...) The ``LINK_INTERFACE_LIBRARIES`` mode appends the libraries to the :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property instead of using them @@ -99,28 +165,8 @@ is not ``NEW``, they are also appended to the ``general`` (or without any keyword) are treated as if specified for both ``debug`` and ``optimized``. --------------------------------------------------------------------------- - -:: - - target_link_libraries( - - [[debug|optimized|general] ] ... - [ - [[debug|optimized|general] ] ...]) - -The ``LINK_PUBLIC`` and ``LINK_PRIVATE`` modes can be used to specify both -the link dependencies and the link interface in one command. - -This signature is for compatibility only. Prefer the ``PUBLIC`` or -``PRIVATE`` keywords instead. - -Libraries and targets following ``LINK_PUBLIC`` are linked to, and are -made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy -:policy:`CMP0022` is not ``NEW``, they are also made part of the -:prop_tgt:`LINK_INTERFACE_LIBRARIES`. Libraries and targets following -``LINK_PRIVATE`` are linked to, but are not made part of the -:prop_tgt:`INTERFACE_LINK_LIBRARIES` (or :prop_tgt:`LINK_INTERFACE_LIBRARIES`). +Cyclic Dependencies of Static Libraries +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The library dependency graph is normally acyclic (a DAG), but in the case of mutually-dependent ``STATIC`` libraries CMake allows the graph to @@ -139,17 +185,11 @@ For example, the code links ``main`` to ``A B A B``. While one repetition is usually sufficient, pathological object file and symbol arrangements can require -more. One may handle such cases by manually repeating the component in -the last ``target_link_libraries`` call. However, if two archives are -really so interdependent they should probably be combined into a single -archive. - -Arguments to target_link_libraries may use "generator expressions" -with the syntax ``$<...>``. Note however, that generator expressions -will not be used in OLD handling of :policy:`CMP0003` or :policy:`CMP0004`. -See the :manual:`cmake-generator-expressions(7)` manual for available -expressions. See the :manual:`cmake-buildsystem(7)` manual for more on -defining buildsystem properties. +more. One may handle such cases by using the +:prop_tgt:`LINK_INTERFACE_MULTIPLICITY` target property or by manually +repeating the component in the last ``target_link_libraries`` call. +However, if two archives are really so interdependent they should probably +be combined into a single archive, perhaps by using :ref:`Object Libraries`. Creating Relocatable Packages ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From c6624cfdc1fe9c7c53ad9ed06da759df803aef71 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 4 Apr 2015 00:01:05 -0400 Subject: [PATCH 0417/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8a931011a..48f02d185 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150403) +set(CMake_VERSION_PATCH 20150404) #set(CMake_VERSION_RC 1) From 9a544f2d987df940625465129a5f00bea01ad4eb Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 2 Apr 2015 17:02:08 +0200 Subject: [PATCH 0418/1029] CTestCoverageCollectGCOV: Support CTEST_CUSTOM_COVERAGE_EXCLUDE --- Modules/CTestCoverageCollectGCOV.cmake | 31 +++++++++++++- Tests/CMakeLists.txt | 3 +- .../TestProject/3rdparty/foo.cpp | 1 + .../TestProject/CMakeLists.txt | 41 +++++++++++++++++++ .../TestProject/extra/extra.cpp | 1 + .../TestProject/fake_compile_time_gcno.cmake | 7 ++++ .../TestProject/fake_run_time_gcda.cmake | 12 ++++++ .../TestProject/main.cpp | 1 + Tests/CTestCoverageCollectGCOV/fakegcov.cmake | 12 ++++-- Tests/CTestCoverageCollectGCOV/test.cmake.in | 37 +++++++++++------ 10 files changed, 128 insertions(+), 18 deletions(-) create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/main.cpp diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index 4519627e3..8659a6916 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -147,8 +147,37 @@ function(ctest_coverage_collect_gcov) \"Binary\": \"${binary_dir}\" }") # collect the gcov files + set(unfiltered_gcov_files) + file(GLOB_RECURSE unfiltered_gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov") + set(gcov_files) - file(GLOB_RECURSE gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov") + foreach(gcov_file ${unfiltered_gcov_files}) + file(STRINGS ${binary_dir}/${gcov_file} first_line LIMIT_COUNT 1 ENCODING UTF-8) + + set(is_excluded false) + if(first_line MATCHES "^ -: 0:Source:(.*)$") + set(source_file ${CMAKE_MATCH_1}) + elseif(NOT GCOV_QUIET) + message(STATUS "Could not determine source file corresponding to: ${gcov_file}") + endif() + + foreach(exclude_entry ${CTEST_CUSTOM_COVERAGE_EXCLUDE}) + if(source_file MATCHES "${exclude_entry}") + set(is_excluded true) + + if(NOT GCOV_QUIET) + message("Excluding coverage for: ${source_file} which matches ${exclude_entry}") + endif() + + break() + endif() + endforeach() + + if(NOT is_excluded) + list(APPEND gcov_files ${gcov_file}) + endif() + endforeach() + # tar up the coverage info with the same date so that the md5 # sum will be the same for the tar file independent of file time # stamps diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5944d081e..d9988b200 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2345,12 +2345,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" @ONLY ESCAPE_QUOTES) add_test(CTestCoverageCollectGCOV ${CMAKE_CTEST_COMMAND} + -C \${CTEST_CONFIGURATION_TYPE} -S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV --output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log" ) set_tests_properties(CTestCoverageCollectGCOV PROPERTIES PASS_REGULAR_EXPRESSION - "PASSED with correct output.*Testing/CoverageInfo/echoargs.gcov") + "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov") configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in" diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp new file mode 100644 index 000000000..85e6cd8c3 --- /dev/null +++ b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp @@ -0,0 +1 @@ +void foo() {} diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt b/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt new file mode 100644 index 000000000..ce6fac435 --- /dev/null +++ b/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.2) + +project(TestProject CXX) + +include(CTest) + +set(SOURCES + main.cpp + 3rdparty/foo.cpp + extra/extra.cpp +) + +add_executable(myexecutable ${SOURCES}) + +set_property(SOURCE main.cpp APPEND PROPERTY LABELS SourceLabel) +set_property(TARGET myexecutable APPEND PROPERTY LABELS TargetLabel) + +set(MYEXECUTABLE_INFO_FILE "${CMAKE_CURRENT_BINARY_DIR}/myexecutable_info.cmake") + +file(WRITE "${MYEXECUTABLE_INFO_FILE}" " + set(TARGET myexecutable) + set(SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\") + set(SOURCES \"${SOURCES}\") +") + +add_custom_command(TARGET myexecutable + POST_BUILD + COMMAND ${CMAKE_COMMAND} + "-DINFO_FILE=${MYEXECUTABLE_INFO_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/fake_compile_time_gcno.cmake" + VERBATIM +) + +add_test(NAME mytest + COMMAND ${CMAKE_COMMAND} + "-DMYEXECUTABLE=$" + "-DTARGETDIR=${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/myexecutable.dir" + -P "${CMAKE_CURRENT_SOURCE_DIR}/fake_run_time_gcda.cmake" +) + +set_property(TEST mytest APPEND PROPERTY LABELS TestLabel) diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp new file mode 100644 index 000000000..c3a2c129d --- /dev/null +++ b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp @@ -0,0 +1 @@ +void extra() {} diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake new file mode 100644 index 000000000..881460b3c --- /dev/null +++ b/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake @@ -0,0 +1,7 @@ +include("${INFO_FILE}") + +foreach(source ${SOURCES}) + file(WRITE "CMakeFiles/${TARGET}.dir/${source}.gcno" + "${SOURCE_DIR}/${source}" + ) +endforeach() diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake new file mode 100644 index 000000000..26ce2bd76 --- /dev/null +++ b/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake @@ -0,0 +1,12 @@ +execute_process(COMMAND ${MYEXECUTABLE} RESULT_VARIABLE RESULT) + +if(NOT RESULT_VARIABLE STREQUAL "0") + message("Test failure") +endif() + +file(GLOB_RECURSE gcno_files "${TARGETDIR}/*.gcno") + +foreach(gcno_file ${gcno_files}) + string(REPLACE ".gcno" ".gcda" gcda_file "${gcno_file}") + configure_file(${gcno_file} ${gcda_file} COPYONLY) +endforeach() diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp @@ -0,0 +1 @@ +int main() {} diff --git a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake index e704f14ca..b0c3a9b9f 100644 --- a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake +++ b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake @@ -3,6 +3,12 @@ foreach(I RANGE 0 ${CMAKE_ARGC}) set(gcda_file "${CMAKE_ARGV${I}}") endif() endforeach() -get_filename_component(gcda_file ${gcda_file} NAME_WE) -file(WRITE "${CMAKE_SOURCE_DIR}/${gcda_file}.gcov" -"fake gcov file") + +get_filename_component(gcda_name ${gcda_file} NAME) +string(REPLACE ".gcda" ".gcov" gcov_name "${gcda_name}") + +file(STRINGS "${gcda_file}" source_file LIMIT_COUNT 1 ENCODING UTF-8) + +file(WRITE "${CMAKE_SOURCE_DIR}/${gcov_name}" + " -: 0:Source:${source_file}" +) diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in index 4bdcb10e4..29f7e7f1a 100644 --- a/Tests/CTestCoverageCollectGCOV/test.cmake.in +++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in @@ -1,16 +1,21 @@ cmake_minimum_required(VERSION 2.8.12) -set(CTEST_PROJECT_NAME "SmallAndFast") -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTest/SmallAndFast") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV") +set(CTEST_PROJECT_NAME "TestProject") +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/TestProject") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV/TestProject") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") + +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + ctest_start(Experimental) ctest_configure() ctest_build() ctest_test() -file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeFiles/echoargs.dir/echoargs.gcda -"dummy -") +list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE + "/foo/something" + "/3rdparty/" + "/bar/somethingelse" +) include(CTestCoverageCollectGCOV) set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar) @@ -22,15 +27,21 @@ ctest_coverage_collect_gcov( GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake") execute_process(COMMAND - ${CMAKE_COMMAND} -E tar tf ${tar_file} - OUTPUT_VARIABLE out - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + ${CMAKE_COMMAND} -E tar tf ${tar_file} + OUTPUT_VARIABLE out + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +string(REPLACE "\n" ";" out "${out}") +list(SORT out) set(expected_out -"Testing/CoverageInfo/echoargs.gcov -Testing/CoverageInfo/data.json -CMakeFiles/echoargs.dir/Labels.json -") + CMakeFiles/myexecutable.dir/Labels.json + Testing/CoverageInfo/data.json + Testing/CoverageInfo/extra.cpp.gcov + Testing/CoverageInfo/main.cpp.gcov +) if("${out}" STREQUAL "${expected_out}") message("PASSED with correct output: ${out}") From dc4f64ab982f0bfb987b1e0a7e3afae8e24ed40a Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 4 Apr 2015 16:01:50 +0200 Subject: [PATCH 0419/1029] Help: Clarify manual reference for generator names --- Help/manual/OPTIONS_BUILD.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 986b541cf..e4c5873bb 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -43,7 +43,7 @@ CMake may support multiple native build systems on certain platforms. A generator is responsible for generating a particular build system. Possible generator names are specified in the - Generators section. + :manual:`cmake-generators(7)` manual. ``-T `` Specify toolset name if supported by generator. From 199b28ac3ab5cc2dc99b352b8653a03f93baf3e5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Mar 2015 21:18:44 +0100 Subject: [PATCH 0420/1029] Remove duplicate tag name. --- Source/cmGeneratorExpressionNode.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 673dcb937..265485176 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1554,7 +1554,6 @@ class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; -class ArtifactNameTag; //---------------------------------------------------------------------------- template From fe17092c20c39761a060508fc6b1979b06e84afe Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 15:30:25 +0200 Subject: [PATCH 0421/1029] cmMakefile: Remove bogus comment. --- Source/cmMakefile.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ebfe50831..e18a4a712 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -776,10 +776,6 @@ public: ///enabled. void EnableLanguage(std::vectorconst& languages, bool optional); - /** - * Set/Get the name of the parent directories CMakeLists file - * given a current CMakeLists file name - */ cmCacheManager *GetCacheManager() const; /** From 257c16495ae0653d8f3630c8d76e6496bc9edd86 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 15:47:24 +0200 Subject: [PATCH 0422/1029] cmListFile: Remove unused member. It is written, but not read since commit v2.4.0~575 (ENH: Since list file cache does not make much sense any more ..., 2006-02-07). --- Source/cmListFileCache.cxx | 6 ------ Source/cmListFileCache.h | 5 ----- 2 files changed, 11 deletions(-) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 3e2634932..ddcea9b13 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -146,18 +146,12 @@ bool cmListFile::ParseFile(const char* filename, } bool parseError = false; - this->ModifiedTime = cmSystemTools::ModifiedTime(filename); { cmListFileParser parser(this, mf, filename); parseError = !parser.ParseFile(); } - if(parseError) - { - this->ModifiedTime = 0; - } - // do we need a cmake_policy(VERSION call? if(topLevel) { diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 2ca9b8ea0..544ff1b4e 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -85,15 +85,10 @@ class cmListFileBacktrace: public std::vector struct cmListFile { - cmListFile() - :ModifiedTime(0) - { - } bool ParseFile(const char* path, bool topLevel, cmMakefile *mf); - long int ModifiedTime; std::vector Functions; }; From a469bf7b98bb2fc82de874383b0538e2d32ab2e1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 15:47:49 +0200 Subject: [PATCH 0423/1029] cmMakefile: Remove one wrong and one insufficiently helpful comment. --- Source/cmMakefile.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e18a4a712..7c2085a0c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -981,9 +981,8 @@ protected: // directories. std::set SystemIncludeDirectories; - std::vector ListFiles; // list of command files loaded - std::vector OutputFiles; // list of command files loaded - + std::vector ListFiles; + std::vector OutputFiles; cmTarget::LinkLibraryVectorType LinkLibraries; From 8fc3a2fbf61bd2686455656201d3de1ceb571145 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 18:54:09 +0200 Subject: [PATCH 0424/1029] Help: Add references to cmake-property sections. --- Help/manual/cmake-properties.7.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 76dd27959..ac38ddee2 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -7,6 +7,8 @@ cmake-properties(7) .. contents:: +.. _`Global Properties`: + Properties of Global Scope ========================== @@ -41,6 +43,8 @@ Properties of Global Scope /prop_gbl/TARGET_SUPPORTS_SHARED_LIBS /prop_gbl/USE_FOLDERS +.. _`Directory Properties`: + Properties on Directories ========================= @@ -72,6 +76,8 @@ Properties on Directories /prop_dir/VS_GLOBAL_SECTION_POST_section /prop_dir/VS_GLOBAL_SECTION_PRE_section +.. _`Target Properties`: + Properties on Targets ===================== @@ -245,6 +251,8 @@ Properties on Targets /prop_tgt/XCODE_ATTRIBUTE_an-attribute /prop_tgt/XCTEST +.. _`Test Properties`: + Properties on Tests =================== @@ -269,6 +277,8 @@ Properties on Tests /prop_test/WILL_FAIL /prop_test/WORKING_DIRECTORY +.. _`Source File Properties`: + Properties on Source Files ========================== @@ -303,6 +313,8 @@ Properties on Source Files /prop_sf/XCODE_EXPLICIT_FILE_TYPE /prop_sf/XCODE_LAST_KNOWN_FILE_TYPE +.. _`Cache Entry Properties`: + Properties on Cache Entries =========================== @@ -316,6 +328,8 @@ Properties on Cache Entries /prop_cache/TYPE /prop_cache/VALUE +.. _`Installed File Properties`: + Properties on Installed Files ============================= From 3b2561736df2c1fd8f69fd9341e1f4c47eb1192d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 18:54:28 +0200 Subject: [PATCH 0425/1029] Help: Shorten too-long title marker. --- Help/manual/cmake-properties.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index ac38ddee2..affa75f2a 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -345,7 +345,7 @@ Properties on Installed Files Deprecated Properties on Directories -===================================== +==================================== .. toctree:: :maxdepth: 1 From f7dd3f7cf05c588b7cbdee7c8b95306d6f1cc05d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 18:56:14 +0200 Subject: [PATCH 0426/1029] Help: Add link in set_source_files_properties command docs. Remove claim about unrecognized properties being ignored. Such properties can be retrieved later by the user. --- Help/command/set_source_files_properties.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst index 8ea02a375..b4904e8d0 100644 --- a/Help/command/set_source_files_properties.rst +++ b/Help/command/set_source_files_properties.rst @@ -10,6 +10,6 @@ Source files can have properties that affect how they are built. [prop2 value2 [...]]) Set properties associated with source files using a key/value paired -list. See properties documentation for those known to CMake. -Unrecognized properties are ignored. Source file properties are -visible only to targets added in the same directory (CMakeLists.txt). +list. See :ref:`Source File Properties` for the list of properties known +to CMake. Source file properties are visible only to targets added +in the same directory (CMakeLists.txt). From 66f5af29f3855c743580821eb73a94f72b709064 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 18:58:55 +0200 Subject: [PATCH 0427/1029] Help: Link to properties in set_directory_properties docs. Remove claim that CMake will report an error for unknown properties. --- Help/command/set_directory_properties.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Help/command/set_directory_properties.rst b/Help/command/set_directory_properties.rst index 834013aab..e485fce0a 100644 --- a/Help/command/set_directory_properties.rst +++ b/Help/command/set_directory_properties.rst @@ -7,9 +7,6 @@ Set a property of the directory. set_directory_properties(PROPERTIES prop1 value1 prop2 value2) -Set a property for the current directory and subdirectories. If the -property is not found, CMake will report an error. The properties -include: INCLUDE_DIRECTORIES, LINK_DIRECTORIES, -INCLUDE_REGULAR_EXPRESSION, and ADDITIONAL_MAKE_CLEAN_FILES. -ADDITIONAL_MAKE_CLEAN_FILES is a list of files that will be cleaned as -a part of "make clean" stage. +Set a property for the current directory and subdirectories. See +:ref:`Directory Properties` for the list of properties known +to CMake. From 6f82b5e81ca9677dc2fde855ba7be8e235baa667 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 19:10:38 +0200 Subject: [PATCH 0428/1029] Help: Link to properties in set_tests_properties. Remove help for specific properties to their own help pages. --- Help/command/set_tests_properties.rst | 30 +++------------------- Help/prop_test/FAIL_REGULAR_EXPRESSION.rst | 11 ++++++-- Help/prop_test/PASS_REGULAR_EXPRESSION.rst | 10 +++++++- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst index afac84746..3efb1653e 100644 --- a/Help/command/set_tests_properties.rst +++ b/Help/command/set_tests_properties.rst @@ -8,29 +8,7 @@ Set a property of the tests. set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2) Set a property for the tests. If the test is not found, CMake -will report an error. Generator expressions will be expanded the same -as supported by the test's add_test call. The properties include: - -WILL_FAIL: If set to true, this will invert the pass/fail flag of the -test. - -PASS_REGULAR_EXPRESSION: If set, the test output will be checked -against the specified regular expressions and at least one of the -regular expressions has to match, otherwise the test will fail. - -:: - - Example: PASS_REGULAR_EXPRESSION "TestPassed;All ok" - -FAIL_REGULAR_EXPRESSION: If set, if the output will match to one of -specified regular expressions, the test will fail. - -:: - - Example: FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed" - -Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a list -of regular expressions. - -TIMEOUT: Setting this will limit the test runtime to the number of -seconds specified. +will report an error. +:manual:`Generator expressions ` will be +expanded the same as supported by the test's :command:`add_test` call. See +:ref:`Test Properties` for the list of properties known to CMake. diff --git a/Help/prop_test/FAIL_REGULAR_EXPRESSION.rst b/Help/prop_test/FAIL_REGULAR_EXPRESSION.rst index b02d17dbb..facf90255 100644 --- a/Help/prop_test/FAIL_REGULAR_EXPRESSION.rst +++ b/Help/prop_test/FAIL_REGULAR_EXPRESSION.rst @@ -4,5 +4,12 @@ FAIL_REGULAR_EXPRESSION If the output matches this regular expression the test will fail. If set, if the output matches one of specified regular expressions, -the test will fail.For example: FAIL_REGULAR_EXPRESSION -"[^a-z]Error;ERROR;Failed" +the test will fail. Example: + +.. code-block:: cmake + + set_tests_properties(mytest PROPERTIES + FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed" + ) + +``FAIL_REGULAR_EXPRESSION`` expects a list of regular expressions. diff --git a/Help/prop_test/PASS_REGULAR_EXPRESSION.rst b/Help/prop_test/PASS_REGULAR_EXPRESSION.rst index bb35f7734..0cd621526 100644 --- a/Help/prop_test/PASS_REGULAR_EXPRESSION.rst +++ b/Help/prop_test/PASS_REGULAR_EXPRESSION.rst @@ -5,4 +5,12 @@ The output must match this regular expression for the test to pass. If set, the test output will be checked against the specified regular expressions and at least one of the regular expressions has to match, -otherwise the test will fail. +otherwise the test will fail. Example: + +.. code-block:: cmake + + set_tests_properties(mytest PROPERTIES + PASS_REGULAR_EXPRESSION "TestPassed;All ok" + ) + +``PASS_REGULAR_EXPRESSION`` expects a list of regular expressions. From dfd6f1f2904ca577743adb5f86f1722359723a0b Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sat, 4 Apr 2015 22:13:45 +0200 Subject: [PATCH 0429/1029] Xcode: Also quote strings containing // (#15487) Otherwise those will be interpreted as start of a comment Signed-off-by: Gregor Jasny --- Source/cmXCodeObject.cxx | 1 + Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 1 + .../XcodeProject/XcodeObjectNeedsQuote-check.cmake | 7 +++++++ Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote.cmake | 3 +++ Tests/RunCMake/XcodeProject/someFileWithoutSpecialChars | 0 5 files changed, 12 insertions(+) create mode 100644 Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote-check.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote.cmake create mode 100644 Tests/RunCMake/XcodeProject/someFileWithoutSpecialChars diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 3302a8de4..5a90fd96f 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -242,6 +242,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) // considered special by the Xcode project file parser. bool needQuote = (String.empty() || + String.find("//") != String.npos || String.find_first_of(" <>.+-=@$[],") != String.npos); const char* quote = needQuote? "\"" : ""; diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 03d3cd3a9..b7de61479 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeObjectNeedsQuote) if (NOT XCODE_VERSION VERSION_LESS 6) run_cmake(XcodePlatformFrameworks) endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote-check.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote-check.cmake new file mode 100644 index 000000000..be7d96ab6 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote-check.cmake @@ -0,0 +1,7 @@ +set(expect "path = \"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeObjectNeedsQuote.xcodeproj/project.pbxproj actual + REGEX "path = [^;]*someFileWithoutSpecialChars[^;]*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote.cmake new file mode 100644 index 000000000..ecc56abb7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsQuote.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_library(some /${CMAKE_CURRENT_SOURCE_DIR}/someFileWithoutSpecialChars) +set_property(SOURCE /${CMAKE_CURRENT_SOURCE_DIR}/someFileWithoutSpecialChars PROPERTY LANGUAGE C) diff --git a/Tests/RunCMake/XcodeProject/someFileWithoutSpecialChars b/Tests/RunCMake/XcodeProject/someFileWithoutSpecialChars new file mode 100644 index 000000000..e69de29bb From a3e2de3a312aa7db516a9127a96dd1d966a7fa47 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 5 Apr 2015 00:01:04 -0400 Subject: [PATCH 0430/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 48f02d185..7d4ef5855 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150404) +set(CMake_VERSION_PATCH 20150405) #set(CMake_VERSION_RC 1) From 47acfe1d1e480bee109efa2de9253cf1a5457a8e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 23:46:14 +0200 Subject: [PATCH 0431/1029] cmake: Remove unused member. --- Source/cmake.cxx | 1 - Source/cmake.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 51df7f2f5..3dc50ab38 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -188,7 +188,6 @@ void cmake::InitializeProperties() { this->Properties.clear(); this->Properties.SetCMakeInstance(this); - this->AccessedProperties.clear(); this->PropertyDefinitions.clear(); // initialize properties diff --git a/Source/cmake.h b/Source/cmake.h index 60ffcd4de..79ccc3359 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -383,7 +383,6 @@ protected: void InitializeProperties(); int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; - std::set > AccessedProperties; std::map PropertyDefinitions; From 364c7ea187d67f702891b201970712806999ad07 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 01:29:45 +0200 Subject: [PATCH 0432/1029] cmake: Remove unused method. --- Source/cmake.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmake.h b/Source/cmake.h index 79ccc3359..c22b329d7 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -287,9 +287,6 @@ class cmake cmProperty::ScopeType scope); bool GetPropertyAsBool(const std::string& prop); - // Get the properties - cmPropertyMap &GetProperties() { return this->Properties; } - ///! Get or create an cmInstalledFile instance and return a pointer to it cmInstalledFile *GetOrCreateInstalledFile( cmMakefile* mf, const std::string& name); From d280bae98f009b56b9c14243981d5aba3e2f8747 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 10:11:30 +0200 Subject: [PATCH 0433/1029] cmake: Be clear that there is no chaining after global properties. --- Source/cmake.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3dc50ab38..338144768 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2273,8 +2273,6 @@ const char *cmake::GetProperty(const std::string& prop) const char *cmake::GetProperty(const std::string& prop, cmProperty::ScopeType scope) { - bool chain = false; - // watch for special properties std::string output = ""; if ( prop == "CACHE_VARIABLES" ) @@ -2332,7 +2330,8 @@ const char *cmake::GetProperty(const std::string& prop, return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; } #undef STRING_LIST_ELEMENT - return this->Properties.GetPropertyValue(prop, scope, chain); + bool dummy = false; + return this->Properties.GetPropertyValue(prop, scope, dummy); } bool cmake::GetPropertyAsBool(const std::string& prop) From 629e94893668c69fccb6954b0fc807c54e9218dd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 01:58:15 +0200 Subject: [PATCH 0434/1029] cmake: Clear member rather than explicit erase. --- Source/cmake.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 338144768..5c52a1a2d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -212,7 +212,7 @@ void cmake::CleanupCommandsAndMacros() delete j->second; } } - this->Commands.erase(this->Commands.begin(), this->Commands.end()); + this->Commands.clear(); std::vector::iterator it; for ( it = commands.begin(); it != commands.end(); ++ it ) From 510562e3e7b9387bebe14060b147ec3022ee58a3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 20:36:06 +0200 Subject: [PATCH 0435/1029] cmGlobalGenerator: Don't fetch the cache manager in a loop. It doesn't change from Makefile to Makefile. --- Source/cmGlobalGenerator.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8123c9941..3c0a0e244 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1537,10 +1537,9 @@ void cmGlobalGenerator::CheckLocalGenerators() std::map notFoundMap; // std::set notFoundMap; // after it is all done do a ConfigureFinalPass - cmCacheManager* manager = 0; + cmCacheManager* manager = this->GetCMakeInstance()->GetCacheManager(); for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager(); this->LocalGenerators[i]->ConfigureFinalPass(); cmTargets &targets = this->LocalGenerators[i]->GetMakefile()->GetTargets(); From 23bb5d225b772f7e18dab16375c7620c99d62814 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 20:24:11 +0200 Subject: [PATCH 0436/1029] cmCacheManager: Remove use of intermediate overload. --- Source/cmCacheManager.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 0c77891e7..30791ff3d 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -84,7 +84,8 @@ bool cmCacheManager::LoadCache(cmMakefile* mf) bool cmCacheManager::LoadCache(const std::string& path) { - return this->LoadCache(path,true); + std::set emptySet; + return this->LoadCache(path, true, emptySet, emptySet); } bool cmCacheManager::LoadCache(const std::string& path, From 64556e3dfa4161b33110daba606439f2c7971b15 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 20:24:34 +0200 Subject: [PATCH 0437/1029] cmCacheManager: Remove unused overloads. --- Source/cmCacheManager.cxx | 19 ------------------- Source/cmCacheManager.h | 5 ----- 2 files changed, 24 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 30791ff3d..002ccd13a 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -76,25 +76,12 @@ bool cmCacheManager::IsType(const char* s) return false; } -bool cmCacheManager::LoadCache(cmMakefile* mf) -{ - return this->LoadCache(mf->GetHomeOutputDirectory()); -} - - bool cmCacheManager::LoadCache(const std::string& path) { std::set emptySet; return this->LoadCache(path, true, emptySet, emptySet); } -bool cmCacheManager::LoadCache(const std::string& path, - bool internal) -{ - std::set emptySet; - return this->LoadCache(path, internal, emptySet, emptySet); -} - static bool ParseEntryWithoutType(const std::string& entry, std::string& var, std::string& value) @@ -419,12 +406,6 @@ void cmCacheManager::WritePropertyEntries(std::ostream& os, } } -bool cmCacheManager::SaveCache(cmMakefile* mf) -{ - return this->SaveCache(mf->GetHomeOutputDirectory()); -} - - bool cmCacheManager::SaveCache(const std::string& path) { std::string cacheFile = path; diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index d9a91123f..659d44a79 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -105,17 +105,12 @@ public: static const char* TypeToString(CacheEntryType); static bool IsType(const char*); - ///! Load a cache for given makefile. Loads from ouput home. - bool LoadCache(cmMakefile*); ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path); - bool LoadCache(const std::string& path, bool internal); bool LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes); - ///! Save cache for given makefile. Saves to ouput home CMakeCache.txt. - bool SaveCache(cmMakefile*) ; ///! Save cache for given makefile. Saves to ouput path/CMakeCache.txt bool SaveCache(const std::string& path) ; From c37cf7fa9e0aa7f7c3a2b32457385a1caf37bc3c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 20:42:28 +0200 Subject: [PATCH 0438/1029] cmCacheManager: Remove unused method --- Source/cmCacheManager.cxx | 18 ------------------ Source/cmCacheManager.h | 1 - Source/cmMakefile.cxx | 5 ----- Source/cmMakefile.h | 3 --- 4 files changed, 27 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 002ccd13a..fa7eff3ce 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -896,21 +896,3 @@ bool cmCacheManager::CacheIterator::PropertyExists( { return this->GetProperty(prop)? true:false; } - -//---------------------------------------------------------------------------- -bool cmCacheManager::NeedCacheCompatibility(int major, int minor) -{ - // Compatibility is not needed if the cache version is zero because - // the cache was created or modified by the user. - if(this->CacheMajorVersion == 0) - { - return false; - } - - // Compatibility is needed if the cache version is equal to or lower - // than the given version. - cmIML_INT_uint64_t actual_compat = - CMake_VERSION_ENCODE(this->CacheMajorVersion, this->CacheMinorVersion, 0); - return (actual_compat && - actual_compat <= CMake_VERSION_ENCODE(major, minor, 0)); -} diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 659d44a79..f7f877606 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -144,7 +144,6 @@ public: { return this->CacheMajorVersion; } unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; } - bool NeedCacheCompatibility(int major, int minor); protected: ///! Add an entry into the cache diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ec1d81411..215ee1614 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -184,11 +184,6 @@ unsigned int cmMakefile::GetCacheMinorVersion() const return this->GetCacheManager()->GetCacheMinorVersion(); } -bool cmMakefile::NeedCacheCompatibility(int major, int minor) const -{ - return this->GetCacheManager()->NeedCacheCompatibility(major, minor); -} - cmMakefile::~cmMakefile() { cmDeleteAll(this->InstallGenerators); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7c2085a0c..920b6b79d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -78,9 +78,6 @@ public: bool VariableInitialized(const std::string& ) const; /* return true if a variable has been used */ bool VariableUsed(const std::string& ) const; - /** Return whether compatibility features needed for a version of - the cache or lower should be enabled. */ - bool NeedCacheCompatibility(int major, int minor) const; /** * Construct an empty makefile. From 0ffd35340e5458882b4b9596a84dd7cdfeaecfbd Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 5 Apr 2015 22:49:19 +0200 Subject: [PATCH 0439/1029] CPack single component packaging RPM, DEB and archive packages were not created in cases when CPACK__COMPONENT_INSTALL was set to ON and a single component existed. Patch also changes CPackRPM test to implicitly test for this case. --- Source/CPack/cmCPackGenerator.cxx | 5 ++++- .../CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 67005ef2b..995eb0d97 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1499,7 +1499,10 @@ bool cmCPackGenerator::SupportsComponentInstallation() const //---------------------------------------------------------------------- bool cmCPackGenerator::WantsComponentInstallation() const { - return (!IsOn("CPACK_MONOLITHIC_INSTALL") & SupportsComponentInstallation()); + return (!IsOn("CPACK_MONOLITHIC_INSTALL") + && SupportsComponentInstallation() + // check that package at least has components + && !(this->ComponentGroups.empty() || this->Components.empty())); } //---------------------------------------------------------------------- diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake index 3ace6a815..31e729bfe 100644 --- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake +++ b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake @@ -1,5 +1,4 @@ install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static) -install(FILES CMakeLists.txt DESTINATION relocatable COMPONENT relocatable) set(CPACK_PACKAGE_RELOCATABLE TRUE) set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") From 03f7a509ef9a0d3d6a9afb5cfc8ab6773428786e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 6 Apr 2015 00:01:04 -0400 Subject: [PATCH 0440/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7d4ef5855..2e9ee685d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150405) +set(CMake_VERSION_PATCH 20150406) #set(CMake_VERSION_RC 1) From c22f6c1504037347d4052a7b441160a2b5c4ce23 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 14:41:05 +0200 Subject: [PATCH 0441/1029] Remove unused includes. --- Source/cmCacheManager.cxx | 1 - Source/cmLocalVisualStudio6Generator.cxx | 1 - 2 files changed, 2 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index fa7eff3ce..b8dfe04c7 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -12,7 +12,6 @@ #include "cmCacheManager.h" #include "cmSystemTools.h" -#include "cmCacheManager.h" #include "cmGeneratedFileStream.h" #include "cmMakefile.h" #include "cmake.h" diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 2b999eb1e..6844fee3f 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -14,7 +14,6 @@ #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmSourceFile.h" -#include "cmCacheManager.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" #include "cmake.h" From 5f686b8a6b5258f6c5aafbb33d7db36b38a3f06d Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 31 Mar 2015 15:04:39 -0400 Subject: [PATCH 0442/1029] Tests: Add case for CPack source package with symlinks --- Tests/RunCMake/CMakeLists.txt | 5 +++++ .../RunCMake/CPackSymlinks/RunCMakeTest.cmake | 20 ++++++++++++++++++ .../CPackSymlinks/SrcSymlinksTar-stdout.txt | 10 +++++++++ Tests/RunCMake/CPackSymlinks/testcpacksym.tar | Bin 0 -> 10240 bytes 4 files changed, 35 insertions(+) create mode 100644 Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt create mode 100644 Tests/RunCMake/CPackSymlinks/testcpacksym.tar diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7b9c81070..12423325d 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -203,6 +203,11 @@ add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(CTestCommandLine) +# Only run this test on unix platforms that support +# symbolic links +if(UNIX) + add_RunCMake_test(CPackSymlinks) +endif() set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) diff --git a/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake new file mode 100644 index 000000000..439d95e61 --- /dev/null +++ b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake @@ -0,0 +1,20 @@ +include(RunCMake) + +function(run_cpack_symlink_test) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/SrcSymlinks-build") + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/SrcSymlinks") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + run_cmake_command(SrcSymlinksTar + ${CMAKE_COMMAND} -E chdir ${RunCMake_TEST_SOURCE_DIR} + ${CMAKE_COMMAND} -E tar xvf ${RunCMake_SOURCE_DIR}/testcpacksym.tar + ) + run_cmake(SrcSymlinksCMake) + run_cmake_command(SrcSymlinksCPack + ${CMAKE_CPACK_COMMAND} --config CPackSourceConfig.cmake + ) +endfunction() + +run_cpack_symlink_test() diff --git a/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt b/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt new file mode 100644 index 000000000..24ad12472 --- /dev/null +++ b/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt @@ -0,0 +1,10 @@ +^x CMakeLists.txt +x cygwin/ +x cygwin/build.sh +x cygwin/setup.patch +x include/ +x include/src.h +x link.h +x real.h +x src/ +x src/src.h$ diff --git a/Tests/RunCMake/CPackSymlinks/testcpacksym.tar b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar new file mode 100644 index 0000000000000000000000000000000000000000..a44c656e899de1b7730f1baab9e3d64e6b185e58 GIT binary patch literal 10240 zcmeHMU2mH(6y-U;f@yn5UcfdGKc|#!s0oQ6>9i+AfHo|FWqfF>rv3L_C#_1eEMY3H z)M28?G1pwoIX?GZ9CH$^<8e}yg;M?~B`yboW2oyAG?*Hw-ZB%?ks)DXAZlQwVX#BT zFeDjqnazRIswjh8mZf!)-7XJo_3k-)ee5gx9j3s)pC(z7R;i!I->M{!qyDw!diK`WbN&@1AyZ_Y;Mm2ZCj@X2=k*=TNl^qs}z!g6K& z*8%VCu_eFzX--C0mTxXx*K+2*H(j`<-Yep(?Wx`a-L~5&{+Pxo2pXEB`iJv-{UZ$0 zC!l|Hk#y_Za^nO`sv@U(>0m|JomvLuGYh+;dDj{wd`32K66Qh`>M4PbHZsiVE{$Uv6`gI$r;=w>f^` z?pMt}@o%vDpAZcCCwUxfcu%h5{J#XmjQ^AQAIRR<{}>SvKE!{FK>uR@=Q&Zg*|kN) zJ~uZ}AzlEQA@+ZbV)>Q#6Yb)Eqx~Ov|EFyK7Yzv#^&f9un1Al|72M-&{IAvjM1%hc qFg95IFXI18tN?Kjfq+0jARrJB2nYlO0s;YnfIvVXAQ0#R0>1$bB`aM3 literal 0 HcmV?d00001 From d224039011f85a1061289b2869c9ff19161fc0a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Apr 2015 09:00:49 -0400 Subject: [PATCH 0443/1029] Help: Add notes for topic 'gcov-module-coverage-exclude' --- Help/release/dev/gcov-module-coverage-exclude.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/gcov-module-coverage-exclude.rst diff --git a/Help/release/dev/gcov-module-coverage-exclude.rst b/Help/release/dev/gcov-module-coverage-exclude.rst new file mode 100644 index 000000000..ee4ebae7d --- /dev/null +++ b/Help/release/dev/gcov-module-coverage-exclude.rst @@ -0,0 +1,6 @@ +gcov-module-coverage-exclude +---------------------------- + +* The :module:`CTestCoverageCollectGCOV` module learned to support + the same ``CTEST_CUSTOM_COVERAGE_EXCLUDE`` option as the + :command:`ctest_coverage` command. From 827309af76fe3f51a2d589148ef98cf91f510c2b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Apr 2015 09:54:52 -0400 Subject: [PATCH 0444/1029] Tests: Fix CompileFeatures cxx_generalized_initializers example The only reason this failed to compile on VS 2013 was because the compiler uses different initializer_list constructor argument types than our dummy implementation. The standard does not specify the non-default constructor argument types for initializer_list. Use a template to match any two-arg constructor a compiler might select (e.g. begin/end or begin/len). Use #error to preserve the error on VS 2013. --- Tests/CompileFeatures/cxx_generalized_initializers.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tests/CompileFeatures/cxx_generalized_initializers.cpp b/Tests/CompileFeatures/cxx_generalized_initializers.cpp index 7bf356b63..13544f32d 100644 --- a/Tests/CompileFeatures/cxx_generalized_initializers.cpp +++ b/Tests/CompileFeatures/cxx_generalized_initializers.cpp @@ -1,3 +1,6 @@ +#if defined(_MSC_VER) && _MSC_VER == 1800 +# error "VS 2013 does not safely support this" +#endif // Dummy implementation. Test only the compiler feature. namespace std { @@ -7,8 +10,9 @@ namespace std { { const _E* __begin_; size_t __size_; - - initializer_list(const int*, long unsigned int) {} + public: + template + initializer_list(T1, T2) {} }; } From ecb1d5b47a75a88653fe508abec1a664cc81595f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Apr 2015 09:59:51 -0400 Subject: [PATCH 0445/1029] Features: VS 2013 Update 3 supports initializer lists (#15494) VS 2013 originally claimed to support initializer lists but a bug was found in which it generated bad code silently. For this reason we previously considered support to not be present. However, Update 3 adds a hard error on cases that previously generated bad code, so it is now safe to use initializer lists with VS 2013 Update 3 or greater. At worst a compiler error will be issued in the cases that do not work, but that is no different from any other compiler-specific workaround a project code may need. --- Modules/Compiler/MSVC-CXX-FeatureTests.cmake | 17 +++++++++++------ .../cxx_generalized_initializers.cpp | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake index c770211ea..fcedf3cd8 100644 --- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -16,12 +16,6 @@ set(_cmake_feature_test_cxx_decltype_auto "${MSVC_2015}") # says they will be available in the RTM. set(_cmake_feature_test_cxx_digit_separators "${MSVC_2015}") set(_cmake_feature_test_cxx_func_identifier "${MSVC_2015}") -# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx -# Note 1. While previous version of VisualStudio said they supported these -# they silently produced bad code, and are now marked as having partial -# support in previous versions. The footnote says the support will be complete -# in MSVC 2015, so support the feature for that version, assuming that is true. -set(_cmake_feature_test_cxx_generalized_initializers "${MSVC_2015}") set(_cmake_feature_test_cxx_nonstatic_member_init "${MSVC_2015}") # Microsoft calls this 'rvalue references v3' set(_cmake_feature_test_cxx_defaulted_move_initializers "${MSVC_2015}") @@ -44,6 +38,16 @@ set(_cmake_feature_test_cxx_reference_qualified_functions "${MSVC_2015}") # lists this as 'partial' in 2013 set(_cmake_feature_test_cxx_deleted_functions "${MSVC_2015}") +set(MSVC_2013_v30723 "_MSC_FULL_VER >= 180030723") +# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx +# Note 1. While previous version of VisualStudio said they supported these +# they silently produced bad code, and are now marked as having partial +# support in previous versions. The footnote says the support will be complete +# in MSVC 2015, so support the feature for that version, assuming that is true. +# The blog post also says that VS 2013 Update 3 generates an error in cases +# that previously produced bad code. +set(_cmake_feature_test_cxx_generalized_initializers "${MSVC_2013_v30723}") + set(MSVC_2013 "_MSC_VER >= 1800") set(_cmake_feature_test_cxx_alias_templates "${MSVC_2013}") # Microsoft now states they support contextual conversions in 2013 and above. @@ -101,6 +105,7 @@ set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}") # Unset all the variables that we don't need exposed. # _cmake_oldestSupported is required by WriteCompilerDetectionHeader set(MSVC_2015) +set(MSVC_2013_v30723) set(MSVC_2013) set(MSVC_2012) set(MSVC_2010) diff --git a/Tests/CompileFeatures/cxx_generalized_initializers.cpp b/Tests/CompileFeatures/cxx_generalized_initializers.cpp index 13544f32d..ad05f1204 100644 --- a/Tests/CompileFeatures/cxx_generalized_initializers.cpp +++ b/Tests/CompileFeatures/cxx_generalized_initializers.cpp @@ -1,5 +1,5 @@ -#if defined(_MSC_VER) && _MSC_VER == 1800 -# error "VS 2013 does not safely support this" +#if defined(_MSC_VER) && _MSC_VER == 1800 && _MSC_FULL_VER < 180030723 +# error "VS 2013 safely supports this only with Update 3 or greater" #endif // Dummy implementation. Test only the compiler feature. From cec8f97e5717fac279d310f3f0b9e849a0e59706 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:30:21 +0200 Subject: [PATCH 0446/1029] cmMakefile: Simplify GetDefinitions implementation. --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 215ee1614..7f44da252 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2501,20 +2501,20 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const std::vector cmMakefile ::GetDefinitions(int cacheonly /* = 0 */) const { - std::set definitions; + std::vector res; if ( !cacheonly ) { - definitions = this->Internal->VarStack.top().ClosureKeys(); + std::set definitions = + this->Internal->VarStack.top().ClosureKeys(); + res.insert(res.end(), definitions.begin(), definitions.end()); } cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) { - definitions.insert(cit.GetName()); + res.push_back(cit.GetName()); } - - std::vector res; - res.insert(res.end(), definitions.begin(), definitions.end()); + std::sort(res.begin(), res.end()); return res; } From 08c642c6ae47fd075fe1060fc0e28d8a24cc3c00 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 13:32:00 +0200 Subject: [PATCH 0447/1029] cmMakefile: Remove cache version accessors. They are only used by legacy code. Inline them there to simplify cmMakefile. --- Source/cmCPluginAPI.cxx | 6 ++++-- Source/cmMakefile.cxx | 10 ---------- Source/cmMakefile.h | 8 -------- Source/cmUtilitySourceCommand.cxx | 6 ++++-- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 691d80d7e..987a7b17d 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -51,12 +51,14 @@ void CCONV cmSetError(void *info, const char *err) unsigned int CCONV cmGetCacheMajorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetCacheMajorVersion(); + cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); + return manager->GetCacheMajorVersion(); } unsigned int CCONV cmGetCacheMinorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetCacheMinorVersion(); + cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); + return manager->GetCacheMinorVersion(); } unsigned int CCONV cmGetMajorVersion(void *) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7f44da252..ad4ad7c91 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -174,16 +174,6 @@ void cmMakefile::Initialize() this->CheckCMP0000 = false; } -unsigned int cmMakefile::GetCacheMajorVersion() const -{ - return this->GetCacheManager()->GetCacheMajorVersion(); -} - -unsigned int cmMakefile::GetCacheMinorVersion() const -{ - return this->GetCacheManager()->GetCacheMinorVersion(); -} - cmMakefile::~cmMakefile() { cmDeleteAll(this->InstallGenerators); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 920b6b79d..5209891d2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -62,14 +62,6 @@ class cmMakefile class Internals; cmsys::auto_ptr Internal; public: - /** - * Return the major and minor version of the cmake that - * was used to write the currently loaded cache, note - * this method will not work before the cache is loaded. - */ - unsigned int GetCacheMajorVersion() const; - unsigned int GetCacheMinorVersion() const; - /* Check for unused variables in this scope */ void CheckForUnusedVariables() const; /* Mark a variable as used */ diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index ee1ff291a..2799a9be5 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -52,11 +52,13 @@ bool cmUtilitySourceCommand } else { + cmCacheManager *manager = + this->Makefile->GetCMakeInstance()->GetCacheManager(); haveCacheValue = (cacheValue && (strstr(cacheValue, "(IntDir)") == 0 || (intDir && strcmp(intDir, "$(IntDir)") == 0)) && - (this->Makefile->GetCacheMajorVersion() != 0 && - this->Makefile->GetCacheMinorVersion() != 0 )); + (manager->GetCacheMajorVersion() != 0 && + manager->GetCacheMinorVersion() != 0 )); } if(haveCacheValue) From 1fe7f24c2b62734d501427750586d8063149ea58 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 00:07:04 +0200 Subject: [PATCH 0448/1029] Add API for cache loading, deleting and saving to the cmake class. Migrate existing users of the CacheManager API to use the new API. The CacheManager will be going away soon. --- Source/CTest/cmCTestBuildAndTestHandler.cxx | 3 +- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/QtDialog/QCMake.cxx | 10 +++--- Source/cmCTest.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 4 +-- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLoadCacheCommand.cxx | 6 ++-- Source/cmake.cxx | 39 ++++++++++++++++++--- Source/cmake.h | 14 +++++++- 9 files changed, 61 insertions(+), 21 deletions(-) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 08270375e..586070b87 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -18,7 +18,6 @@ #include "cmGlobalGenerator.h" #include #include "cmCTestTestHandler.h" -#include "cmCacheManager.h" //---------------------------------------------------------------------- cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() @@ -255,7 +254,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. - cm.GetCacheManager()->LoadCache(this->BinaryDir); + cm.LoadCache(this->BinaryDir); } else { diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index d60062e5b..1217bda19 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -639,7 +639,7 @@ int cmCursesMainForm::Configure(int noconfigure) // always save the current gui values to disk this->FillCacheManagerFromUI(); - this->CMakeInstance->GetCacheManager()->SaveCache( + this->CMakeInstance->SaveCache( this->CMakeInstance->GetHomeOutputDirectory()); this->LoadCache(0); diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 996aa75fe..3df48d177 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -96,7 +96,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) emit this->binaryDirChanged(this->BinaryDirectory); cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); this->setGenerator(QString()); - if(!this->CMakeInstance->GetCacheManager()->LoadCache( + if(!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { QDir testDir(this->BinaryDirectory); @@ -270,7 +270,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) } } - cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); } QCMakePropertyList QCMake::properties() const @@ -397,9 +397,9 @@ QStringList QCMake::availableGenerators() const void QCMake::deleteCache() { // delete cache - this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data()); // reload to make our cache empty - this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit no generator and no properties this->setGenerator(QString()); QCMakePropertyList props = this->properties(); @@ -412,7 +412,7 @@ void QCMake::reloadCache() QCMakePropertyList props; emit this->propertiesChanged(props); // reload - this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit new cache properties props = this->properties(); emit this->propertiesChanged(props); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index df61fe6bf..1db057bd1 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2281,7 +2281,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if (cmCacheManager::ParseEntry(arg, name, value, type)) + if (cmake::ParseCacheEntry(arg, name, value, type)) { this->Definitions[name] = value; return true; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index d64b0d74c..810ec57ee 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -223,7 +223,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); - mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } else if (envVarValue==0 && cacheValue!=0) { @@ -244,7 +244,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); - mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5e584a452..0561a0542 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3703,7 +3703,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, // Since this call may have created new cache entries, save the cache: // - root->GetMakefile()->GetCacheManager()->SaveCache( + root->GetMakefile()->GetCMakeInstance()->SaveCache( root->GetMakefile()->GetHomeOutputDirectory()); } diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 93aec3220..e2ae90111 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -81,8 +81,8 @@ bool cmLoadCacheCommand { break; } - this->Makefile->GetCacheManager()->LoadCache(args[i], false, - excludes, includes); + this->Makefile->GetCMakeInstance()->LoadCache(args[i], false, + excludes, includes); } @@ -173,7 +173,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) std::string var; std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if(cmCacheManager::ParseEntry(line, var, value, type)) + if(cmake::ParseCacheEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. if(this->VariablesToRead.find(var) != this->VariablesToRead.end()) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c52a1a2d..e78141799 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -917,7 +917,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) { cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(cachem->LoadCache(cachePath) && + if(this->LoadCache(cachePath) && it.Find("CMAKE_HOME_DIRECTORY")) { this->SetHomeOutputDirectory(cachePath); @@ -1860,10 +1860,18 @@ void cmake::AddDefaultGenerators() #endif } +bool cmake::ParseCacheEntry(const std::string& entry, + std::string& var, + std::string& value, + cmCacheManager::CacheEntryType& type) +{ + return cmCacheManager::ParseEntry(entry, var, value, type); +} + int cmake::LoadCache() { // could we not read the cache - if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory())) + if (!this->LoadCache(this->GetHomeOutputDirectory())) { // if it does exist, but isn't readable then warn the user std::string cacheFile = this->GetHomeOutputDirectory(); @@ -1886,6 +1894,28 @@ int cmake::LoadCache() return 0; } +bool cmake::LoadCache(const std::string& path) +{ + return this->CacheManager->LoadCache(path); +} + +bool cmake::LoadCache(const std::string& path, bool internal, + std::set& excludes, + std::set& includes) +{ + return this->CacheManager->LoadCache(path, internal, excludes, includes); +} + +bool cmake::SaveCache(const std::string& path) +{ + return this->CacheManager->SaveCache(path); +} + +bool cmake::DeleteCache(const std::string& path) +{ + return this->CacheManager->DeleteCache(path); +} + void cmake::SetProgressCallback(ProgressCallbackType f, void *cd) { this->ProgressCallback = f; @@ -2764,9 +2794,8 @@ int cmake::Build(const std::string& dir, } std::string cachePath = dir; cmSystemTools::ConvertToUnixSlashes(cachePath); - cmCacheManager* cachem = this->GetCacheManager(); - cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(!cachem->LoadCache(cachePath)) + cmCacheManager::CacheIterator it = this->GetCacheManager()->NewIterator(); + if(!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; diff --git a/Source/cmake.h b/Source/cmake.h index c22b329d7..3acf4a82f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -18,11 +18,11 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmInstalledFile.h" +#include "cmCacheManager.h" class cmGlobalGeneratorFactory; class cmGlobalGenerator; class cmLocalGenerator; -class cmCacheManager; class cmMakefile; class cmCommand; class cmVariableWatch; @@ -173,7 +173,19 @@ class cmake int Configure(); int ActualConfigure(); + ///! Break up a line like VAR:type="value" into var, type and value + static bool ParseCacheEntry(const std::string& entry, + std::string& var, + std::string& value, + cmCacheManager::CacheEntryType& type); + int LoadCache(); + bool LoadCache(const std::string& path); + bool LoadCache(const std::string& path, bool internal, + std::set& excludes, + std::set& includes); + bool SaveCache(const std::string& path); + bool DeleteCache(const std::string& path); void PreLoadCMakeFiles(); ///! Create a GlobalGenerator From 9ada4c04335fc070f3f670df72bd9943eabec464 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 10:28:34 +0200 Subject: [PATCH 0449/1029] cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue. Being initialized is a requirement for this method to return something, and is what differentiates it from using GetIterator with it.GetValue. --- Source/QtDialog/QCMake.cxx | 3 +- Source/cmCacheManager.cxx | 16 +++++--- Source/cmCacheManager.h | 2 +- Source/cmCommandArgumentParserHelper.cxx | 3 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 6 +-- Source/cmMakefile.cxx | 9 +++-- Source/cmake.cxx | 47 ++++++++++++++---------- 8 files changed, 51 insertions(+), 37 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 3df48d177..009d06e2c 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -117,7 +117,8 @@ void QCMake::setBinaryDirectory(const QString& _dir) } if ( itm.Find("CMAKE_GENERATOR")) { - const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR"); + const char* extraGen = cachem + ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index fa7eff3ce..f8f2dbd18 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -284,14 +284,16 @@ bool cmCacheManager::LoadCache(const std::string& path, } this->CacheMajorVersion = 0; this->CacheMinorVersion = 0; - if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION")) + if(const char* cmajor = + this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION")) { unsigned int v=0; if(sscanf(cmajor, "%u", &v) == 1) { this->CacheMajorVersion = v; } - if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION")) + if(const char* cminor = + this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION")) { if(sscanf(cminor, "%u", &v) == 1) { @@ -313,10 +315,11 @@ bool cmCacheManager::LoadCache(const std::string& path, } // check to make sure the cache directory has not // been moved - if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") ) + const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR"); + if (internal && oldDir) { std::string currentcwd = path; - std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR"); + std::string oldcwd = oldDir; cmSystemTools::ConvertToUnixSlashes(currentcwd); currentcwd += "/CMakeCache.txt"; oldcwd += "/CMakeCache.txt"; @@ -325,7 +328,7 @@ bool cmCacheManager::LoadCache(const std::string& path, std::string message = std::string("The current CMakeCache.txt directory ") + currentcwd + std::string(" is different than the directory ") + - std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + + std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) + std::string(" where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); @@ -655,7 +658,8 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( return CacheIterator(*this, key); } -const char* cmCacheManager::GetCacheValue(const std::string& key) const +const char* +cmCacheManager::GetInitializedCacheValue(const std::string& key) const { CacheEntryMap::const_iterator i = this->Cache.find(key); if(i != this->Cache.end() && diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index f7f877606..31d302ac9 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -137,7 +137,7 @@ public: CacheEntryType& type); ///! Get a value from the cache given a key - const char* GetCacheValue(const std::string& key) const; + const char* GetInitializedCacheValue(const std::string& key) const; /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 747b7e434..99bf5f55f 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -90,7 +90,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } if ( strcmp(key, "CACHE") == 0 ) { - if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var)) + if(const char* c = this->Makefile->GetCacheManager() + ->GetInitializedCacheValue(var)) { if(this->EscapeQuotes) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 810ec57ee..0d32e4bac 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; cacheEntryName += envVar; - const char* cacheValue = mf->GetCacheManager()->GetCacheValue( + const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue( cacheEntryName); // now we have both, decide which one to use diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3c0a0e244..f23caa6ae 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -179,7 +179,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, return; } const char* cname = this->GetCMakeInstance()-> - GetCacheManager()->GetCacheValue(langComp); + GetCacheManager()->GetInitializedCacheValue(langComp); std::string changeVars; if(cname && !optional) { @@ -1641,7 +1641,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, // and there is a good chance that the try compile stuff will // take the bulk of the time, so try and guess some progress // by getting closer and closer to 100 without actually getting there. - if (!this->CMakeInstance->GetCacheManager()->GetCacheValue + if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) { // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set @@ -1839,7 +1839,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) // update progress // estimate how many lg there will be const char *numGenC = - this->CMakeInstance->GetCacheManager()->GetCacheValue + this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); if (!numGenC) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ad4ad7c91..b6eff3dac 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2432,7 +2432,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const this->Internal->VarUsageStack.top().insert(name); if(!def) { - def = this->GetCacheManager()->GetCacheValue(name); + def = this->GetCacheManager()->GetInitializedCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE if(cmVariableWatch* vv = this->GetVariableWatch()) @@ -2457,7 +2457,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const const char* def = this->Internal->VarStack.top().Get(name); if(!def) { - def = this->GetCacheManager()->GetCacheValue(name); + def = this->GetCacheManager()->GetInitializedCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE cmVariableWatch* vv = this->GetVariableWatch(); @@ -2835,7 +2835,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( value = cmSystemTools::GetEnv(lookup.c_str()); break; case CACHE: - value = this->GetCacheManager()->GetCacheValue(lookup); + value = this->GetCacheManager() + ->GetInitializedCacheValue(lookup); break; } // Get the string we're meant to append to. @@ -4903,7 +4904,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, (status == cmPolicies::WARN || status == cmPolicies::OLD)) { if(!(this->GetCacheManager() - ->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) { // Set it to 2.4 because that is the last version where the // variable had meaning. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e78141799..210c0ef33 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -344,7 +344,8 @@ bool cmake::SetCacheArgs(const std::vector& args) std::string cachedValue; if(this->WarnUnusedCli) { - if(const char *v = this->CacheManager->GetCacheValue(var)) + if(const char *v = this->CacheManager + ->GetInitializedCacheValue(var)) { haveValue = true; cachedValue = v; @@ -357,7 +358,8 @@ bool cmake::SetCacheArgs(const std::vector& args) if(this->WarnUnusedCli) { if (!haveValue || - cachedValue != this->CacheManager->GetCacheValue(var)) + cachedValue != this->CacheManager + ->GetInitializedCacheValue(var)) { this->WatchUnusedCli(var); } @@ -1203,10 +1205,10 @@ int cmake::DoPreConfigureChecks() } // do a sanity check on some values - if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY")) + if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) { std::string cacheStart = - this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); + this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); currentStart += "/CMakeLists.txt"; @@ -1355,9 +1357,9 @@ int cmake::ActualConfigure() if(!this->GlobalGenerator) { const char* genName = - this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); + this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"); const char* extraGenName = - this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR"); + this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); if(genName) { std::string fullName = cmExternalMakefileProjectGenerator:: @@ -1435,7 +1437,8 @@ int cmake::ActualConfigure() } } - const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); + const char* genName = this->CacheManager + ->GetInitializedCacheValue("CMAKE_GENERATOR"); if(genName) { if(!this->GlobalGenerator->MatchesGeneratorName(genName)) @@ -1451,7 +1454,7 @@ int cmake::ActualConfigure() return -2; } } - if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR")) + if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR")) { this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), @@ -1464,7 +1467,7 @@ int cmake::ActualConfigure() } if(const char* platformName = - this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM")) + this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) { if(this->GeneratorPlatform.empty()) { @@ -1492,7 +1495,7 @@ int cmake::ActualConfigure() } if(const char* tsName = - this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET")) + this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) { if(this->GeneratorToolset.empty()) { @@ -1546,16 +1549,18 @@ int cmake::ActualConfigure() // project requires compatibility with CMake 2.4. We detect this // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY // variable created when CMP0001 is not set to NEW. - if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) + if(this->GetCacheManager() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { - if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH")) + if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) { this->CacheManager->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", cmCacheManager::PATH); } - if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH")) + if(!this->CacheManager + ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { this->CacheManager->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", @@ -1563,7 +1568,8 @@ int cmake::ActualConfigure() cmCacheManager::PATH); } } - if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS")) + if(!this->CacheManager + ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) { this->CacheManager->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", @@ -1578,9 +1584,9 @@ int cmake::ActualConfigure() } if(cmSystemTools::GetFatalErrorOccured() && - (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") || + (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") || cmSystemTools::IsOff(this->CacheManager-> - GetCacheValue("CMAKE_MAKE_PROGRAM")))) + GetInitializedCacheValue("CMAKE_MAKE_PROGRAM")))) { // We must have a bad generator selection. Wipe the cache entry so the // user can select another. @@ -1796,7 +1802,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, const char* cmake::GetCacheDefinition(const std::string& name) const { - return this->CacheManager->GetCacheValue(name); + return this->CacheManager->GetInitializedCacheValue(name); } void cmake::AddDefaultCommands() @@ -1956,7 +1962,8 @@ void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: const char* tablepath = - this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE"); + this->CacheManager + ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if(tablepath) { @@ -2190,7 +2197,7 @@ void cmake::TruncateOutputLog(const char* fname) { return; } - if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") ) + if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") ) { cmSystemTools::RemoveFile(fullPath); return; @@ -2469,7 +2476,7 @@ int cmake::GetSystemInformation(std::vector& args) // we have to find the module directory, so we can copy the files this->AddCMakePaths(); std::string modulesPath = - this->CacheManager->GetCacheValue("CMAKE_ROOT"); + this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT"); modulesPath += "/Modules"; std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; From e62243674e7ce9a162b47567ef5893fae44ed153 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 19:50:05 +0200 Subject: [PATCH 0450/1029] cmCacheManager: Add non-iterator-based API. The iterator pattern is an unusual one for CMake, and it hinders refactoring all configuration-time data manipulation into a single class. --- Source/cmCacheManager.h | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 31d302ac9..2d3f6e5fc 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -139,6 +139,81 @@ public: ///! Get a value from the cache given a key const char* GetInitializedCacheValue(const std::string& key) const; + const char* GetCacheEntryValue(const std::string& key) + { + cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str()); + if (it.IsAtEnd()) + { + return 0; + } + return it.GetValue().c_str(); + } + + const char* GetCacheEntryProperty(std::string const& key, + std::string const& propName) + { + return this->GetCacheIterator(key.c_str()).GetProperty(propName); + } + + CacheEntryType GetCacheEntryType(std::string const& key) + { + return this->GetCacheIterator(key.c_str()).GetType(); + } + + bool GetCacheEntryPropertyAsBool(std::string const& key, + std::string const& propName) + { + return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName); + } + + void SetCacheEntryProperty(std::string const& key, + std::string const& propName, + std::string const& value) + { + this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str()); + } + + void SetCacheEntryBoolProperty(std::string const& key, + std::string const& propName, + bool value) + { + this->GetCacheIterator(key.c_str()).SetProperty(propName, value); + } + + void SetCacheEntryValue(std::string const& key, + std::string const& value) + { + this->GetCacheIterator(key.c_str()).SetValue(value.c_str()); + } + + void RemoveCacheEntryProperty(std::string const& key, + std::string const& propName) + { + this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0); + } + + void AppendCacheEntryProperty(std::string const& key, + std::string const& propName, + std::string const& value, + bool asString = false) + { + this->GetCacheIterator(key.c_str()).AppendProperty(propName, + value.c_str(), + asString); + } + + std::vector GetCacheEntryKeys() + { + std::vector definitions; + definitions.reserve(this->GetSize()); + cmCacheManager::CacheIterator cit = this->GetCacheIterator(); + for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) + { + definitions.push_back(cit.GetName()); + } + return definitions; + } + /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const { return this->CacheMajorVersion; } From 2e50f5e7d9269ee1e2e3587a7a4b806df48510d3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 10:46:25 +0200 Subject: [PATCH 0451/1029] cmMakefile: Port away from CacheEntry.Initialized. The API has no other external users. --- Source/cmMakefile.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b6eff3dac..7c1b9c454 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1810,16 +1810,17 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, { bool haveVal = value ? true : false; std::string val = haveVal ? value : ""; - cmCacheManager::CacheIterator it = - this->GetCacheManager()->GetCacheIterator(name.c_str()); - if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && - it.Initialized()) + const char* existingValue = + this->GetCacheManager()->GetInitializedCacheValue(name); + if(existingValue + && (this->GetCacheManager()->GetCacheEntryType(name) + == cmCacheManager::UNINITIALIZED)) { // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in if(!force) { - val = it.GetValue(); + val = existingValue; haveVal = true; } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) @@ -1842,7 +1843,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); - val = it.GetValue(); + val = this->GetCacheManager()->GetInitializedCacheValue(name); haveVal = true; } From 228c629c18d6b5e820376ac87babca0771205b6f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:01:35 +0200 Subject: [PATCH 0452/1029] Port CursesDialog to non-iterator cache API. --- .../cmCursesCacheEntryComposite.cxx | 35 ++-- .../cmCursesCacheEntryComposite.h | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 149 +++++++++++------- 3 files changed, 110 insertions(+), 76 deletions(-) diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 682f95f9e..4f028c42a 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -18,6 +18,9 @@ #include "cmCursesFilePathWidget.h" #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" +#include "../cmake.h" + +#include cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( const std::string& key, @@ -32,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, + const std::string& key, cmake *cm, bool isNew, int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { @@ -47,11 +50,13 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } this->Entry = 0; - switch ( it.GetType() ) + const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); + assert(value); + switch (cm->GetCacheManager()->GetCacheEntryType(key)) { - case cmCacheManager::BOOL: + case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); - if (cmSystemTools::IsOn(it.GetValue().c_str())) + if (cmSystemTools::IsOn(value)) { static_cast(this->Entry)->SetValueAsBool(true); } @@ -62,40 +67,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( break; case cmCacheManager::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString( - it.GetValue()); + static_cast(this->Entry)->SetString(value); break; case cmCacheManager::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString( - it.GetValue()); + static_cast(this->Entry)->SetString(value); break; case cmCacheManager::STRING: - if(it.PropertyExists("STRINGS")) + { + const char* stringsProp = cm->GetCacheManager() + ->GetCacheEntryProperty(key, "STRINGS"); + if(stringsProp) { cmCursesOptionsWidget* ow = new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1); this->Entry = ow; std::vector options; - cmSystemTools::ExpandListArgument( - std::string(it.GetProperty("STRINGS")), options); + cmSystemTools::ExpandListArgument(stringsProp, options); for(std::vector::iterator si = options.begin(); si != options.end(); ++si) { ow->AddOption(*si); } - ow->SetOption(it.GetValue()); + ow->SetOption(value); } else { this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString( - it.GetValue()); + static_cast(this->Entry)->SetString(value); } break; + } case cmCacheManager::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", - it.GetName().c_str()); + key.c_str()); break; default: // TODO : put warning message here diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 7cdf13bad..dc4ee4af0 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -21,7 +21,7 @@ public: cmCursesCacheEntryComposite(const std::string& key, int labelwidth, int entrywidth); cmCursesCacheEntryComposite(const std::string& key, - const cmCacheManager::CacheIterator& it, + cmake *cm, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 1217bda19..833d54038 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -111,13 +111,17 @@ void cmCursesMainForm::InitializeUI() // Count non-internal and non-static entries int count=0; - for(cmCacheManager::CacheIterator i = - this->CMakeInstance->GetCacheManager()->NewIterator(); - !i.IsAtEnd(); i.Next()) + std::vector cacheKeys = + this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys(); + + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - if ( i.GetType() != cmCacheManager::INTERNAL && - i.GetType() != cmCacheManager::STATIC && - i.GetType() != cmCacheManager::UNINITIALIZED) + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(*it); + if (t != cmCacheManager::INTERNAL && + t != cmCacheManager::STATIC && + t != cmCacheManager::UNINITIALIZED) { ++count; } @@ -139,45 +143,49 @@ void cmCursesMainForm::InitializeUI() // Create the composites. // First add entries which are new - for(cmCacheManager::CacheIterator i = - this->CMakeInstance->GetCacheManager()->NewIterator(); - !i.IsAtEnd(); i.Next()) + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - std::string key = i.GetName(); - if ( i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED ) + std::string key = *it; + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(*it); + if (t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC || + t == cmCacheManager::UNINITIALIZED ) { continue; } if (!this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, i, - true, 30, - entrywidth)); + newEntries->push_back(new cmCursesCacheEntryComposite(key, + this->CMakeInstance, + true, 30, + entrywidth)); this->OkToGenerate = false; } } // then add entries which are old - for(cmCacheManager::CacheIterator i = - this->CMakeInstance->GetCacheManager()->NewIterator(); - !i.IsAtEnd(); i.Next()) + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - std::string key = i.GetName(); - if ( i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED ) + std::string key = *it; + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(*it); + if (t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC || + t == cmCacheManager::UNINITIALIZED ) { continue; } if (this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, i, - false, 30, - entrywidth)); + newEntries->push_back(new cmCursesCacheEntryComposite(key, + this->CMakeInstance, + false, 30, + entrywidth)); } } } @@ -216,10 +224,13 @@ void cmCursesMainForm::RePost() std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -245,10 +256,13 @@ void cmCursesMainForm::RePost() std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -314,10 +328,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -334,10 +351,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -495,11 +515,12 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // Get the help string of the current entry // and add it to the help string - cmCacheManager::CacheIterator it = - this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField); - if (!it.IsAtEnd()) + const char* existingValue = + this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField); + if (existingValue) { - const char* hs = it.GetProperty("HELPSTRING"); + const char* hs = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryProperty(curField, "HELPSTRING"); if ( hs ) { strncpy(help, hs, 127); @@ -792,23 +813,28 @@ void cmCursesMainForm::FillCacheManagerFromUI() size_t size = this->Entries->size(); for(size_t i=0; i < size; i++) { - cmCacheManager::CacheIterator it = - this->CMakeInstance->GetCacheManager()->GetCacheIterator( - (*this->Entries)[i]->Key.c_str()); - if (!it.IsAtEnd()) + std::string cacheKey = (*this->Entries)[i]->Key; + const char* existingValue = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue(cacheKey); + if (existingValue) { - std::string oldValue = it.GetValue(); + std::string oldValue = existingValue; std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - this->FixValue(it.GetType(), oldValue, fixedOldValue); - this->FixValue(it.GetType(), newValue, fixedNewValue); + cmCacheManager::CacheEntryType t = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(cacheKey); + this->FixValue(t, oldValue, fixedOldValue); + this->FixValue(t, newValue, fixedNewValue); if(!(fixedOldValue == fixedNewValue)) { // The user has changed the value. Mark it as modified. - it.SetProperty("MODIFIED", true); - it.SetValue(fixedNewValue.c_str()); + this->CMakeInstance->GetCacheManager() + ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true); + this->CMakeInstance->GetCacheManager() + ->SetCacheEntryValue(cacheKey, fixedNewValue); } } } @@ -1017,12 +1043,15 @@ void cmCursesMainForm::HandleInput() cmCursesWidget* lbl = reinterpret_cast(field_userptr( this->Fields[findex-2])); const char* curField = lbl->GetValue(); - const char* helpString=0; - cmCacheManager::CacheIterator it = - this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField); - if (!it.IsAtEnd()) + const char* helpString = 0; + + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue(curField); + if (existingValue) { - helpString = it.GetProperty("HELPSTRING"); + helpString = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryProperty(curField, "HELPSTRING"); } if (helpString) { From 7b7ae3b1a1d1c664eeef48392759883aa4040657 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:14:40 +0200 Subject: [PATCH 0453/1029] Port QtDialog to non-iterator cache API. --- Source/QtDialog/QCMake.cxx | 72 +++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 009d06e2c..08d53ce27 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -110,17 +110,18 @@ void QCMake::setBinaryDirectory(const QString& _dir) QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); - cmCacheManager::CacheIterator itm = cachem->NewIterator(); - if ( itm.Find("CMAKE_HOME_DIRECTORY")) + const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + if (homeDir) { - setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str())); + setSourceDirectory(QString::fromLocal8Bit(homeDir)); } - if ( itm.Find("CMAKE_GENERATOR")) + const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR"); + if (gen) { const char* extraGen = cachem ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : ""); + CreateFullGeneratorName(gen, extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } } @@ -195,33 +196,35 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) // set the value of properties cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - for(cmCacheManager::CacheIterator i = cachem->NewIterator(); - !i.IsAtEnd(); i.Next()) + std::vector cacheKeys = cachem->GetCacheEntryKeys(); + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - - if(i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC) + cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it); + if(t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC) { continue; } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); + prop.Key = QString::fromLocal8Bit(it->c_str()); int idx = props.indexOf(prop); if(idx == -1) { - toremove.append(QString::fromLocal8Bit(i.GetName().c_str())); + toremove.append(QString::fromLocal8Bit(it->c_str())); } else { prop = props[idx]; if(prop.Value.type() == QVariant::Bool) { - i.SetValue(prop.Value.toBool() ? "ON" : "OFF"); + cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF"); } else { - i.SetValue(prop.Value.toString().toLocal8Bit().data()); + cachem->SetCacheEntryValue(*it, + prop.Value.toString().toLocal8Bit().data()); } props.removeAt(idx); } @@ -279,42 +282,47 @@ QCMakePropertyList QCMake::properties() const QCMakePropertyList ret; cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - for(cmCacheManager::CacheIterator i = cachem->NewIterator(); - !i.IsAtEnd(); i.Next()) + std::vector cacheKeys = cachem->GetCacheEntryKeys(); + for (std::vector::const_iterator i = cacheKeys.begin(); + i != cacheKeys.end(); ++i) { - - if(i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED) + cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i); + if(t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC || + t == cmCacheManager::UNINITIALIZED) { continue; } - QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); - prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING")); - prop.Value = QString::fromLocal8Bit(i.GetValue().c_str()); - prop.Advanced = i.GetPropertyAsBool("ADVANCED"); + const char* cachedValue = cachem->GetCacheEntryValue(*i); - if(i.GetType() == cmCacheManager::BOOL) + QCMakeProperty prop; + prop.Key = QString::fromLocal8Bit(i->c_str()); + prop.Help = QString::fromLocal8Bit( + cachem->GetCacheEntryProperty(*i, "HELPSTRING")); + prop.Value = QString::fromLocal8Bit(cachedValue); + prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); + if(t == cmCacheManager::BOOL) { prop.Type = QCMakeProperty::BOOL; - prop.Value = cmSystemTools::IsOn(i.GetValue().c_str()); + prop.Value = cmSystemTools::IsOn(cachedValue); } - else if(i.GetType() == cmCacheManager::PATH) + else if(t == cmCacheManager::PATH) { prop.Type = QCMakeProperty::PATH; } - else if(i.GetType() == cmCacheManager::FILEPATH) + else if(t == cmCacheManager::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; } - else if(i.GetType() == cmCacheManager::STRING) + else if(t == cmCacheManager::STRING) { prop.Type = QCMakeProperty::STRING; - if (i.PropertyExists("STRINGS")) + const char* stringsProperty = + cachem->GetCacheEntryProperty(*i, "STRINGS"); + if (stringsProperty) { - prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";"); + prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";"); } } From 9410e24a4ad3a21b2c27d057798f723e88d14d45 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 10:48:04 +0200 Subject: [PATCH 0454/1029] cmCacheManager: Port consumers to non-iterator API. This simplifies reasoning about the follow-up commit which ports away from cmCacheManager to a class with the same method names. --- Source/cmFindBase.cxx | 13 +++-- Source/cmGetPropertyCommand.cxx | 7 +-- Source/cmGlobalGenerator.cxx | 8 +-- Source/cmMakefile.cxx | 14 ++--- Source/cmMarkAsAdvancedCommand.cxx | 15 ++--- Source/cmOptionCommand.cxx | 12 ++-- Source/cmSetCommand.cxx | 7 ++- Source/cmSetPropertyCommand.cxx | 19 ++++--- Source/cmSetPropertyCommand.h | 2 +- Source/cmTryRunCommand.cxx | 19 ++++--- Source/cmVariableRequiresCommand.cxx | 6 +- Source/cmake.cxx | 84 ++++++++++++++-------------- Source/cmakemain.cxx | 26 +++++---- 13 files changed, 117 insertions(+), 115 deletions(-) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index f63df616d..cc080528d 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -366,18 +366,18 @@ bool cmFindBase::CheckForVariableInCache() if(const char* cacheValue = this->Makefile->GetDefinition(this->VariableName)) { - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()-> - GetCacheIterator(this->VariableName.c_str()); + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName); bool found = !cmSystemTools::IsNOTFOUND(cacheValue); - bool cached = !it.IsAtEnd(); + bool cached = cacheEntry ? true : false; if(found) { // If the user specifies the entry on the command line without a // type we should add the type and docstring but keep the // original value. Tell the subclass implementations to do // this. - if(cached && it.GetType() == cmCacheManager::UNINITIALIZED) + if(cached && manager->GetCacheEntryType(this->VariableName) + == cmCacheManager::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } @@ -385,7 +385,8 @@ bool cmFindBase::CheckForVariableInCache() } else if(cached) { - const char* hs = it.GetProperty("HELPSTRING"); + const char* hs = manager->GetCacheEntryProperty(this->VariableName, + "HELPSTRING"); this->VariableDocumentation = hs?hs:"(none)"; } } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index f0b268685..0e6e0c20e 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -391,11 +391,10 @@ bool cmGetPropertyCommand::HandleCacheMode() } const char* value = 0; - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str()); - if(!it.IsAtEnd()) + if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name)) { - value = it.GetProperty(this->PropertyName); + value = this->Makefile->GetCacheManager() + ->GetCacheEntryProperty(this->Name, this->PropertyName); } this->StoreResult(value); return true; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f23caa6ae..35394b8f9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1559,9 +1559,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(lib->first.c_str())) { std::string varName = lib->first.substr(0, lib->first.size()-9); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(varName.c_str()); - if(it.GetPropertyAsBool("ADVANCED")) + if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) { varName += " (ADVANCED)"; } @@ -1592,9 +1590,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(incDir->c_str())) { std::string varName = incDir->substr(0, incDir->size()-9); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(varName.c_str()); - if(it.GetPropertyAsBool("ADVANCED")) + if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) { varName += " (ADVANCED)"; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c1b9c454..34b46218d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1848,8 +1848,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } } - this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc, - type); + this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, + doc, type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } @@ -2499,12 +2499,10 @@ std::vector cmMakefile this->Internal->VarStack.top().ClosureKeys(); res.insert(res.end(), definitions.begin(), definitions.end()); } - cmCacheManager::CacheIterator cit = - this->GetCacheManager()->GetCacheIterator(); - for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) - { - res.push_back(cit.GetName()); - } + std::vector cacheKeys = + this->GetCacheManager()->GetCacheEntryKeys(); + res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); + std::sort(res.begin(), res.end()); return res; } diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index f6a2c2670..cc094b1bc 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -37,24 +37,19 @@ bool cmMarkAsAdvancedCommand { std::string variable = args[i]; cmCacheManager* manager = this->Makefile->GetCacheManager(); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(variable.c_str()); - if ( it.IsAtEnd() ) + if (!manager->GetCacheEntryValue(variable)) { - this->Makefile->GetCacheManager() - ->AddCacheEntry(variable, 0, 0, - cmCacheManager::UNINITIALIZED); + manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); overwrite = true; } - it.Find(variable); - if ( it.IsAtEnd() ) + if (!manager->GetCacheEntryValue(variable)) { cmSystemTools::Error("This should never happen..."); return false; } - if ( !it.PropertyExists("ADVANCED") || overwrite ) + if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite) { - it.SetProperty("ADVANCED", value); + manager->SetCacheEntryProperty(variable, "ADVANCED", value); } } return true; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 60728eaea..baf5b1e08 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -42,16 +42,16 @@ bool cmOptionCommand std::string initialValue = "Off"; // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str()); - if(!it.IsAtEnd()) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existingValue = manager->GetCacheEntryValue(args[0]); + if(existingValue) { - if ( it.GetType() != cmCacheManager::UNINITIALIZED ) + if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) { - it.SetProperty("HELPSTRING", args[1].c_str()); + manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; } - initialValue = it.GetValue(); + initialValue = existingValue; } if(args.size() == 3) { diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 204d95b1e..e17474bd6 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -136,9 +136,10 @@ bool cmSetCommand } // see if this is already in the cache - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(variable); - if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED)) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existingValue = manager->GetCacheEntryValue(variable); + if(existingValue && + (manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 1150bc7ad..77f9fb90b 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -452,11 +452,11 @@ bool cmSetPropertyCommand::HandleCacheMode() // Get the source file. cmMakefile* mf = this->GetMakefile(); cmake* cm = mf->GetCMakeInstance(); - cmCacheManager::CacheIterator it = - cm->GetCacheManager()->GetCacheIterator(ni->c_str()); - if(!it.IsAtEnd()) + const char* existingValue + = cm->GetCacheManager()->GetCacheEntryValue(*ni); + if(existingValue) { - if(!this->HandleCacheEntry(it)) + if(!this->HandleCacheEntry(*ni)) { return false; } @@ -474,22 +474,25 @@ bool cmSetPropertyCommand::HandleCacheMode() } //---------------------------------------------------------------------------- -bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it) +bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey) { // Set or append the property. const char* name = this->PropertyName.c_str(); const char* value = this->PropertyValue.c_str(); + cmCacheManager* manager = this->Makefile->GetCacheManager(); if (this->Remove) { - value = 0; + manager->RemoveCacheEntryProperty(cacheKey, name); + return true; } if(this->AppendMode) { - it.AppendProperty(name, value, this->AppendAsString); + manager->AppendCacheEntryProperty(cacheKey, name, value, + this->AppendAsString); } else { - it.SetProperty(name, value); + manager->SetCacheEntryProperty(cacheKey, name, value); } return true; diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index b06cb6857..3285e60ab 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -61,7 +61,7 @@ private: bool HandleTestMode(); bool HandleTest(cmTest* test); bool HandleCacheMode(); - bool HandleCacheEntry(cmCacheManager::CacheIterator&); + bool HandleCacheEntry(std::string const&); bool HandleInstallMode(); bool HandleInstall(cmInstalledFile* file); }; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index b5280cfd7..911ade810 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -264,11 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment.c_str(), cmCacheManager::STRING); - cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> - GetCacheIterator(this->RunResultVariable.c_str()); - if ( !it.IsAtEnd() ) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existingValue + = manager->GetCacheEntryValue(this->RunResultVariable); + if (existingValue) { - it.SetProperty("ADVANCED", "1"); + manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1"); } error = true; @@ -290,11 +291,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), cmCacheManager::STRING); - cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> - GetCacheIterator(internalRunOutputName.c_str()); - if ( !it.IsAtEnd() ) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existing = + manager->GetCacheEntryValue(internalRunOutputName); + if (existing) { - it.SetProperty("ADVANCED", "1"); + manager->SetCacheEntryProperty(internalRunOutputName, + "ADVANCED", "1"); } error = true; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 80c128654..dd2a68299 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -41,9 +41,9 @@ bool cmVariableRequiresCommand requirementsMet = false; notSet += args[i]; notSet += "\n"; - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str()); - if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED")) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + if(manager->GetCacheEntryValue(args[i]) && + manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) { hasAdvanced = true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 210c0ef33..64b332ccc 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -403,17 +403,18 @@ bool cmake::SetCacheArgs(const std::vector& args) cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector entriesToDelete; - cmCacheManager::CacheIterator it = - this->CacheManager->GetCacheIterator(); - for ( it.Begin(); !it.IsAtEnd(); it.Next() ) + std::vector cacheKeys = + this->CacheManager->GetCacheEntryKeys(); + for (std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = it.GetType(); + cmCacheManager::CacheEntryType t = + this->CacheManager->GetCacheEntryType(*it); if(t != cmCacheManager::STATIC) { - std::string entryName = it.GetName(); - if (regex.find(entryName.c_str())) + if (regex.find(it->c_str())) { - entriesToDelete.push_back(entryName); + entriesToDelete.push_back(*it); } } } @@ -917,16 +918,18 @@ void cmake::SetDirectoriesFromFile(const char* arg) // If there is a CMakeCache.txt file, use its settings. if(!cachePath.empty()) { - cmCacheManager* cachem = this->GetCacheManager(); - cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(this->LoadCache(cachePath) && - it.Find("CMAKE_HOME_DIRECTORY")) + if(this->LoadCache(cachePath)) { - this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); - this->SetHomeDirectory(it.GetValue()); - this->SetStartDirectory(it.GetValue()); - return; + const char* existingValue = + this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + if (existingValue) + { + this->SetHomeOutputDirectory(cachePath); + this->SetStartOutputDirectory(cachePath); + this->SetHomeDirectory(existingValue); + this->SetStartDirectory(existingValue); + return; + } } } @@ -1575,11 +1578,11 @@ int cmake::ActualConfigure() ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", cmCacheManager::BOOL); - cmCacheManager::CacheIterator it = - this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS"); - if ( !it.PropertyExists("ADVANCED") ) + if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED")) { - it.SetProperty("ADVANCED", "1"); + this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED", "1"); } } @@ -2314,17 +2317,9 @@ const char *cmake::GetProperty(const std::string& prop, std::string output = ""; if ( prop == "CACHE_VARIABLES" ) { - cmCacheManager::CacheIterator cit = - this->GetCacheManager()->GetCacheIterator(); - for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) - { - if (!output.empty()) - { - output += ";"; - } - output += cit.GetName(); - } - this->SetProperty("CACHE_VARIABLES", output.c_str()); + std::vector cacheKeys = + this->CacheManager->GetCacheEntryKeys(); + this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); } else if ( prop == "COMMANDS" ) { @@ -2686,9 +2681,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, if(t == cmake::AUTHOR_WARNING) { // Allow suppression of these warnings. - cmCacheManager::CacheIterator it = this->CacheManager - ->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - if(!it.IsAtEnd() && it.GetValueAsBool()) + const char* suppress = this->CacheManager->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + if(suppress && cmSystemTools::IsOn(suppress)) { return; } @@ -2801,37 +2796,42 @@ int cmake::Build(const std::string& dir, } std::string cachePath = dir; cmSystemTools::ConvertToUnixSlashes(cachePath); - cmCacheManager::CacheIterator it = this->GetCacheManager()->NewIterator(); if(!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; } - if(!it.Find("CMAKE_GENERATOR")) + const char* cachedGenerator = + this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR"); + if(!cachedGenerator) { std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; return 1; } cmsys::auto_ptr gen( - this->CreateGlobalGenerator(it.GetValue())); + this->CreateGlobalGenerator(cachedGenerator)); if(!gen.get()) { std::cerr << "Error: could create CMAKE_GENERATOR \"" - << it.GetValue() << "\"\n"; + << cachedGenerator << "\"\n"; return 1; } std::string output; std::string projName; - if(!it.Find("CMAKE_PROJECT_NAME")) + const char* cachedProjectName = + this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME"); + if(!cachedProjectName) { std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n"; return 1; } - projName = it.GetValue(); + projName = cachedProjectName; bool verbose = false; - if(it.Find("CMAKE_VERBOSE_MAKEFILE")) + const char* cachedVerbose = + this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); + if(cachedVerbose) { - verbose = it.GetValueAsBool(); + verbose = cmSystemTools::IsOn(cachedVerbose); } return gen->Build("", dir, projName, target, diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index ac73ad079..3b518be77 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -328,25 +328,31 @@ int do_cmake(int ac, char const* const* av) int res = cm.Run(args, view_only); if ( list_cached || list_all_cached ) { - cmCacheManager::CacheIterator it = - cm.GetCacheManager()->GetCacheIterator(); std::cout << "-- Cache values" << std::endl; - for ( it.Begin(); !it.IsAtEnd(); it.Next() ) + std::vector keys = + cm.GetCacheManager()->GetCacheEntryKeys(); + for (std::vector::const_iterator it = keys.begin(); + it != keys.end(); ++it) { - cmCacheManager::CacheEntryType t = it.GetType(); + cmCacheManager::CacheEntryType t = + cm.GetCacheManager()->GetCacheEntryType(*it); if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && t != cmCacheManager::UNINITIALIZED ) { - bool advanced = it.PropertyExists("ADVANCED"); - if ( list_all_cached || !advanced) + const char* advancedProp = + cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED"); + if ( list_all_cached || !advancedProp) { if ( list_help ) { - std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl; + std::cout << "// " + << cm.GetCacheManager()->GetCacheEntryProperty(*it, + "HELPSTRING") << std::endl; } - std::cout << it.GetName() << ":" << - cmCacheManager::TypeToString(it.GetType()) - << "=" << it.GetValue() << std::endl; + std::cout << *it << ":" << + cmCacheManager::TypeToString(t) + << "=" << cm.GetCacheManager()->GetCacheEntryValue(*it) + << std::endl; if ( list_help ) { std::cout << std::endl; From 52d5a9b60ba9c375c9381c7afa7441d6dadd9742 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 7 Apr 2015 00:01:05 -0400 Subject: [PATCH 0455/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2e9ee685d..eed106d9c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150406) +set(CMake_VERSION_PATCH 20150407) #set(CMake_VERSION_RC 1) From 7e311773b5386663457bedd39cf2110da04438f2 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Tue, 7 Apr 2015 11:42:02 +0200 Subject: [PATCH 0456/1029] FindMatlab: Look for R2014b and R2015a --- Modules/FindMatlab.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index d08423b36..b4beec3d8 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -228,6 +228,8 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2015a=8.5" + "R2014b=8.4" "R2014a=8.3" "R2013b=8.2" "R2013a=8.1" From 1535dcd894eab9eea023d93aec6a0274babc7fd3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Apr 2015 09:06:51 -0400 Subject: [PATCH 0457/1029] Tests: Teach RunCMake to optionally merge command output to stdout Some tests may need to read "cmake --build" output passed through from native build tools and do not know if it will be on stdout or stderr. Optionally use the same variable for the execute_process output so that it merges them and we can always match using expected stdout. --- Tests/RunCMake/RunCMake.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index abac66e56..6333703a7 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -54,12 +54,18 @@ function(run_cmake test) if(RunCMake_MAKE_PROGRAM) list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() + if(RunCMake_TEST_OUTPUT_MERGE) + set(actual_stderr_var actual_stdout) + set(actual_stderr "") + else() + set(actual_stderr_var actual_stderr) + endif() if(RunCMake_TEST_COMMAND) execute_process( COMMAND ${RunCMake_TEST_COMMAND} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout - ERROR_VARIABLE actual_stderr + ERROR_VARIABLE ${actual_stderr_var} RESULT_VARIABLE actual_result ) else() @@ -73,7 +79,7 @@ function(run_cmake test) ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout - ERROR_VARIABLE actual_stderr + ERROR_VARIABLE ${actual_stderr_var} RESULT_VARIABLE actual_result ) endif() From 318cd37097c724fac13a364fe3beb21055575ae7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Apr 2015 10:06:34 -0400 Subject: [PATCH 0458/1029] Help: Add link target for Find Modules section of cmake-developer.7 --- Help/manual/cmake-developer.7.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 7bffa4253..ab7414074 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -605,6 +605,7 @@ have a .cmake file in this directory NOT show up in the modules documentation, simply leave out the ``Help/module/.rst`` file and the ``Help/manual/cmake-modules.7.rst`` toctree entry. +.. _`Find Modules`: Find Modules ------------ From 579c4bec6e2352448f78d9333f7382ff34a08e5a Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 24 Mar 2015 00:02:50 -0400 Subject: [PATCH 0459/1029] Properties: Add CROSSCOMPILING_EMULATOR target property. Add CROSSCOMPILING_EMULATOR target property for executables. This is used by subsequent patches to run exectuables created for the target system when crosscompiling. The property is initialized by the CMAKE_CROSSCOMPILING_EMULATOR variable when defined. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst | 4 +++ .../CMAKE_CROSSCOMPILING_EMULATOR.rst | 5 ++++ Source/cmTarget.cxx | 1 + Tests/RunCMake/CMakeLists.txt | 4 +++ .../CrosscompilingEmulator/CMakeLists.txt | 3 ++ .../CrosscompilingEmulatorProperty.cmake | 28 +++++++++++++++++++ .../CrosscompilingEmulator/RunCMakeTest.cmake | 6 ++++ .../CrosscompilingEmulator/simple_src.cxx | 4 +++ Tests/RunCMake/pseudo_emulator.c | 15 ++++++++++ 11 files changed, 72 insertions(+) create mode 100644 Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst create mode 100644 Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst create mode 100644 Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt create mode 100644 Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx create mode 100644 Tests/RunCMake/pseudo_emulator.c diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index affa75f2a..02d164b5c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -119,6 +119,7 @@ Properties on Targets /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /prop_tgt/CONFIG_OUTPUT_NAME /prop_tgt/CONFIG_POSTFIX + /prop_tgt/CROSSCOMPILING_EMULATOR /prop_tgt/CXX_EXTENSIONS /prop_tgt/CXX_STANDARD /prop_tgt/CXX_STANDARD_REQUIRED diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index c342dbee1..63f704da5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -25,6 +25,7 @@ Variables that Provide Information /variable/CMAKE_CFG_INTDIR /variable/CMAKE_COMMAND /variable/CMAKE_CROSSCOMPILING + /variable/CMAKE_CROSSCOMPILING_EMULATOR /variable/CMAKE_CTEST_COMMAND /variable/CMAKE_CURRENT_BINARY_DIR /variable/CMAKE_CURRENT_LIST_DIR diff --git a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst new file mode 100644 index 000000000..2b5fd4d3d --- /dev/null +++ b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst @@ -0,0 +1,4 @@ +CROSSCOMPILING_EMULATOR +----------------------- + +Use the given emulator to run executables created when crosscompiling. diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst new file mode 100644 index 000000000..fa6f1b743 --- /dev/null +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -0,0 +1,5 @@ +CMAKE_CROSSCOMPILING_EMULATOR +----------------------------- + +Default value for the :prop_tgt:`CROSSCOMPILING_EMULATOR` target property of +executables. See that target property for additional information. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b3d115543..85e5165b1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -442,6 +442,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) if(this->TargetTypeValue == cmTarget::EXECUTABLE) { this->SetPropertyDefault("ANDROID_GUI", 0); + this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0); } if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY || this->TargetTypeValue == cmTarget::MODULE_LIBRARY) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 60a8a8222..977721de8 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -226,3 +226,7 @@ add_RunCMake_test(COMPILE_LANGUAGE-genex) if(CMake_TEST_FindMatlab) add_RunCMake_test(FindMatlab) endif() + +add_executable(pseudo_emulator pseudo_emulator.c) +add_RunCMake_test(CrosscompilingEmulator + -DPSEUDO_EMULATOR=$) diff --git a/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt b/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt new file mode 100644 index 000000000..2d7598574 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake new file mode 100644 index 000000000..22d537c38 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake @@ -0,0 +1,28 @@ +# This tests setting the CROSSCOMPILING_EMULATOR target property from the +# CMAKE_CROSSCOMPILING_EMULATOR variable. + +# -DCMAKE_CROSSCOMPILING_EMULATOR=/path/to/pseudo_emulator is passed to this +# test +add_executable(target_with_emulator simple_src.cxx) +get_property(emulator TARGET target_with_emulator + PROPERTY CROSSCOMPILING_EMULATOR) +if(NOT "${emulator}" MATCHES "pseudo_emulator") + message(SEND_ERROR "Default CROSSCOMPILING_EMULATOR property not set") +endif() + +set_property(TARGET target_with_emulator + PROPERTY CROSSCOMPILING_EMULATOR "another_emulator") +get_property(emulator TARGET target_with_emulator + PROPERTY CROSSCOMPILING_EMULATOR) +if(NOT "${emulator}" MATCHES "another_emulator") + message(SEND_ERROR + "set_property/get_property CROSSCOMPILING_EMULATOR is not consistent") +endif() + +unset(CMAKE_CROSSCOMPILING_EMULATOR CACHE) +add_executable(target_without_emulator simple_src.cxx) +get_property(emulator TARGET target_without_emulator + PROPERTY CROSSCOMPILING_EMULATOR) +if(NOT "${emulator}" STREQUAL "") + message(SEND_ERROR "Default CROSSCOMPILING_EMULATOR property not set to null") +endif() diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake new file mode 100644 index 000000000..cecc57f86 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS + "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR}") + +run_cmake(CrosscompilingEmulatorProperty) diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx new file mode 100644 index 000000000..630adc6bc --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx @@ -0,0 +1,4 @@ +int main(int, char **) +{ + return 0; +} diff --git a/Tests/RunCMake/pseudo_emulator.c b/Tests/RunCMake/pseudo_emulator.c new file mode 100644 index 000000000..9308f75aa --- /dev/null +++ b/Tests/RunCMake/pseudo_emulator.c @@ -0,0 +1,15 @@ +#include + +int main(int argc, char * argv[] ) +{ + int ii; + + printf("Command:"); + for(ii = 1; ii < argc; ++ii) + { + printf(" \"%s\"", argv[ii]); + } + printf("\n"); + + return 42; +} From 322cdc48252e17501866a7177e89ca20a3cb583b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 7 Apr 2015 14:10:50 -0400 Subject: [PATCH 0460/1029] Help: Document supported compilers in cmake-compile-features.7 Extend sentences in other documentation linking to this manual to say that it has a list of supported compilers. Co-Author: Brad King --- Help/command/target_compile_features.rst | 2 +- Help/manual/cmake-compile-features.7.rst | 14 ++++++++++++++ Help/manual/cmake-generator-expressions.7.rst | 2 +- Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst | 2 +- Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst | 2 +- Help/prop_tgt/COMPILE_FEATURES.rst | 2 +- Help/prop_tgt/CXX_EXTENSIONS.rst | 2 +- Help/prop_tgt/CXX_STANDARD.rst | 2 +- Help/prop_tgt/CXX_STANDARD_REQUIRED.rst | 2 +- Help/prop_tgt/C_EXTENSIONS.rst | 2 +- Help/prop_tgt/C_STANDARD.rst | 2 +- Help/prop_tgt/C_STANDARD_REQUIRED.rst | 2 +- Help/prop_tgt/INTERFACE_COMPILE_FEATURES.rst | 2 +- Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst | 2 +- Help/variable/CMAKE_CXX_EXTENSIONS.rst | 2 +- Help/variable/CMAKE_CXX_STANDARD.rst | 2 +- Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst | 2 +- Help/variable/CMAKE_C_COMPILE_FEATURES.rst | 2 +- Help/variable/CMAKE_C_EXTENSIONS.rst | 2 +- Help/variable/CMAKE_C_STANDARD.rst | 2 +- Help/variable/CMAKE_C_STANDARD_REQUIRED.rst | 2 +- 21 files changed, 34 insertions(+), 20 deletions(-) diff --git a/Help/command/target_compile_features.rst b/Help/command/target_compile_features.rst index 29a8b413c..b66a4ec16 100644 --- a/Help/command/target_compile_features.rst +++ b/Help/command/target_compile_features.rst @@ -29,4 +29,4 @@ Arguments to ``target_compile_features`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-compile-features(7)` manual for -information on compile features. +information on compile features and a list of supported compilers. diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index 7a6c24931..46a5afbf2 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -295,3 +295,17 @@ the feature-appropriate include directory add_executable(consumer_no consumer_no.cpp) target_link_libraries(consumer_no foo) + +Supported Compilers +=================== + +CMake is currently aware of the :prop_tgt:`language standards ` +and :prop_gbl:`compile features ` available from +the following :variable:`compiler ids _COMPILER_ID>` as of the +versions specified for each: + +* ``AppleClang``: Apple Clang for Xcode versions 4.4 though 6.2. +* ``Clang``: Clang compiler versions 2.9 through 3.4. +* ``GNU``: GNU compiler versions 4.4 through 5.0. +* ``MSVC``: Microsoft Visual Studio versions 2010 through 2015. +* ``SunPro``: Oracle SolarisStudio version 12.4. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 477a132d3..189c3ef18 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -88,7 +88,7 @@ Available logical expressions are: increases the required :prop_tgt:`C_STANDARD` or :prop_tgt:`CXX_STANDARD` for the 'head' target, an error is reported. See the :manual:`cmake-compile-features(7)` manual for information on - compile features. + compile features and a list of supported compilers. ``$`` ``1`` when the language used for compilation unit matches ``lang``, otherwise ``0``. This expression used to specify compile options for diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index 163ae3489..3db4f1814 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -9,7 +9,7 @@ be listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable. The features listed here may be used with the :command:`target_compile_features` command. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. The features known to this version of CMake are: diff --git a/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst index 18cd03055..a08af0089 100644 --- a/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst @@ -9,7 +9,7 @@ be listed in the :variable:`CMAKE_C_COMPILE_FEATURES` variable. The features listed here may be used with the :command:`target_compile_features` command. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. The features known to this version of CMake are: diff --git a/Help/prop_tgt/COMPILE_FEATURES.rst b/Help/prop_tgt/COMPILE_FEATURES.rst index 225ffeeca..195215e3c 100644 --- a/Help/prop_tgt/COMPILE_FEATURES.rst +++ b/Help/prop_tgt/COMPILE_FEATURES.rst @@ -9,4 +9,4 @@ in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable. Contents of ``COMPILE_FEATURES`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-compile-features(7)` manual -for information on compile features. +for information on compile features and a list of supported compilers. diff --git a/Help/prop_tgt/CXX_EXTENSIONS.rst b/Help/prop_tgt/CXX_EXTENSIONS.rst index 67c5cb015..0f547e292 100644 --- a/Help/prop_tgt/CXX_EXTENSIONS.rst +++ b/Help/prop_tgt/CXX_EXTENSIONS.rst @@ -9,7 +9,7 @@ as ``-std=gnu++11`` instead of ``-std=c++11`` to the compile line. This property is ``ON`` by default. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. This property is initialized by the value of the :variable:`CMAKE_CXX_EXTENSIONS` variable if it is set when a target diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst index 65b30ec52..edc9ba534 100644 --- a/Help/prop_tgt/CXX_STANDARD.rst +++ b/Help/prop_tgt/CXX_STANDARD.rst @@ -24,7 +24,7 @@ flag will not result in an error or warning, but will instead add the with the :prop_tgt:`CXX_STANDARD_REQUIRED` target property. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. This property is initialized by the value of the :variable:`CMAKE_CXX_STANDARD` variable if it is set when a target diff --git a/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst b/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst index 4e24e5ea0..697d7f60d 100644 --- a/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst +++ b/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst @@ -11,7 +11,7 @@ not available. For compilers that have no notion of a standard level, such as MSVC, this has no effect. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. This property is initialized by the value of the :variable:`CMAKE_CXX_STANDARD_REQUIRED` variable if it is set when a diff --git a/Help/prop_tgt/C_EXTENSIONS.rst b/Help/prop_tgt/C_EXTENSIONS.rst index dc48cc643..fce67f49c 100644 --- a/Help/prop_tgt/C_EXTENSIONS.rst +++ b/Help/prop_tgt/C_EXTENSIONS.rst @@ -9,7 +9,7 @@ as ``-std=gnu11`` instead of ``-std=c11`` to the compile line. This property is ``ON`` by default. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. This property is initialized by the value of the :variable:`CMAKE_C_EXTENSIONS` variable if it is set when a target diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst index 3aa74af49..5e3682186 100644 --- a/Help/prop_tgt/C_STANDARD.rst +++ b/Help/prop_tgt/C_STANDARD.rst @@ -24,7 +24,7 @@ flag will not result in an error or warning, but will instead add the be controlled with the :prop_tgt:`C_STANDARD_REQUIRED` target property. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. This property is initialized by the value of the :variable:`CMAKE_C_STANDARD` variable if it is set when a target diff --git a/Help/prop_tgt/C_STANDARD_REQUIRED.rst b/Help/prop_tgt/C_STANDARD_REQUIRED.rst index 743d568d2..acfad986b 100644 --- a/Help/prop_tgt/C_STANDARD_REQUIRED.rst +++ b/Help/prop_tgt/C_STANDARD_REQUIRED.rst @@ -11,7 +11,7 @@ not available. For compilers that have no notion of a standard level, such as MSVC, this has no effect. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. This property is initialized by the value of the :variable:`CMAKE_C_STANDARD_REQUIRED` variable if it is set when a diff --git a/Help/prop_tgt/INTERFACE_COMPILE_FEATURES.rst b/Help/prop_tgt/INTERFACE_COMPILE_FEATURES.rst index 8dfec5ff1..31b594f82 100644 --- a/Help/prop_tgt/INTERFACE_COMPILE_FEATURES.rst +++ b/Help/prop_tgt/INTERFACE_COMPILE_FEATURES.rst @@ -9,4 +9,4 @@ INTERFACE_COMPILE_FEATURES .. include:: INTERFACE_BUILD_PROPERTY.txt See the :manual:`cmake-compile-features(7)` manual for information on compile -features. +features and a list of supported compilers. diff --git a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst index 460c78ccc..f0032270b 100644 --- a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst @@ -8,4 +8,4 @@ list is a subset of the features listed in the :prop_gbl:`CMAKE_CXX_KNOWN_FEATUR global property. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_CXX_EXTENSIONS.rst b/Help/variable/CMAKE_CXX_EXTENSIONS.rst index 64483713e..b14d7538a 100644 --- a/Help/variable/CMAKE_CXX_EXTENSIONS.rst +++ b/Help/variable/CMAKE_CXX_EXTENSIONS.rst @@ -8,4 +8,4 @@ property on all targets. See that target property for additional information. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_CXX_STANDARD.rst b/Help/variable/CMAKE_CXX_STANDARD.rst index 963a42a40..2bc4525f6 100644 --- a/Help/variable/CMAKE_CXX_STANDARD.rst +++ b/Help/variable/CMAKE_CXX_STANDARD.rst @@ -8,4 +8,4 @@ property on all targets. See that target property for additional information. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst b/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst index f7750fa0e..14ffcd17b 100644 --- a/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst +++ b/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst @@ -8,4 +8,4 @@ property on all targets. See that target property for additional information. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_C_COMPILE_FEATURES.rst b/Help/variable/CMAKE_C_COMPILE_FEATURES.rst index 110624687..df66eaedc 100644 --- a/Help/variable/CMAKE_C_COMPILE_FEATURES.rst +++ b/Help/variable/CMAKE_C_COMPILE_FEATURES.rst @@ -8,4 +8,4 @@ list is a subset of the features listed in the :prop_gbl:`CMAKE_C_KNOWN_FEATURES global property. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_C_EXTENSIONS.rst b/Help/variable/CMAKE_C_EXTENSIONS.rst index 5e935fcc3..25bec12fc 100644 --- a/Help/variable/CMAKE_C_EXTENSIONS.rst +++ b/Help/variable/CMAKE_C_EXTENSIONS.rst @@ -8,4 +8,4 @@ property on all targets. See that target property for additional information. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_C_STANDARD.rst b/Help/variable/CMAKE_C_STANDARD.rst index 3098ce5d4..2eb4e43ea 100644 --- a/Help/variable/CMAKE_C_STANDARD.rst +++ b/Help/variable/CMAKE_C_STANDARD.rst @@ -8,4 +8,4 @@ property on all targets. See that target property for additional information. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst b/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst index c24eea430..5e415dafa 100644 --- a/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst +++ b/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst @@ -8,4 +8,4 @@ property on all targets. See that target property for additional information. See the :manual:`cmake-compile-features(7)` manual for information on -compile features. +compile features and a list of supported compilers. From 1e3843373f8e0dfd550809ec034d535d31276b6b Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Apr 2015 16:33:05 -0400 Subject: [PATCH 0461/1029] cmake: Show in --help how to select VS target platform (#15422) * Re-order VS generators from newest to oldest. * Show how to specify a VS generator with a target platform * Increase the option output indentation to avoid extra wrapping with longer generator names. --- Source/cmDocumentationFormatter.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 7 +++++-- Source/cmGlobalVisualStudio11Generator.cxx | 7 +++++-- Source/cmGlobalVisualStudio12Generator.cxx | 7 +++++-- Source/cmGlobalVisualStudio14Generator.cxx | 7 +++++-- Source/cmGlobalVisualStudio8Generator.cxx | 7 +++++-- Source/cmGlobalVisualStudio9Generator.cxx | 7 +++++-- Source/cmake.cxx | 20 ++++++++++---------- 8 files changed, 41 insertions(+), 23 deletions(-) diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 4de59c042..6869e2fb5 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -204,7 +204,7 @@ void cmDocumentationFormatter if(!op->Name.empty()) { os << " " << op->Name; - this->TextIndent = " "; + this->TextIndent = " "; int align = static_cast(strlen(this->TextIndent))-4; for(int i = static_cast(op->Name.size()); i < align; ++i) { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 18d40e1da..1c6ac8871 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -71,8 +71,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs10generatorName; - entry.Brief = "Generates Visual Studio 10 (VS 2010) project files."; + entry.Name = std::string(vs10generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2010 project files. " + "Optional [arch] can be \"Win64\" or \"IA64\"." + ; } virtual void GetGenerators(std::vector& names) const diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index ed828b64c..5d3ae16ba 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -78,8 +78,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs11generatorName; - entry.Brief = "Generates Visual Studio 11 (VS 2012) project files."; + entry.Name = std::string(vs11generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2012 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." + ; } virtual void GetGenerators(std::vector& names) const diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index c2e6f47a8..e70e08297 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -66,8 +66,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs12generatorName; - entry.Brief = "Generates Visual Studio 12 (VS 2013) project files."; + entry.Name = std::string(vs12generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2013 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." + ; } virtual void GetGenerators(std::vector& names) const diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index b551c6518..7b1dd247f 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -66,8 +66,11 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs14generatorName; - entry.Brief = "Generates Visual Studio 14 (VS 2015) project files."; + entry.Name = std::string(vs14generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2015 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"." + ; } virtual void GetGenerators(std::vector& names) const diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e6ce45d6e..726db0f3a 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -66,8 +66,11 @@ public: } virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs8generatorName; - entry.Brief = "Generates Visual Studio 8 2005 project files."; + entry.Name = std::string(vs8generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2005 project files. " + "Optional [arch] can be \"Win64\"." + ; } virtual void GetGenerators(std::vector& names) const { diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 1d73b5c08..1bc627f3c 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -70,8 +70,11 @@ public: } virtual void GetDocumentation(cmDocumentationEntry& entry) const { - entry.Name = vs9generatorName; - entry.Brief = "Generates Visual Studio 9 2008 project files."; + entry.Name = std::string(vs9generatorName) + " [arch]"; + entry.Brief = + "Generates Visual Studio 2008 project files. " + "Optional [arch] can be \"Win64\" or \"IA64\"." + ; } virtual void GetGenerators(std::vector& names) const { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c52a1a2d..05cfea8f5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1817,23 +1817,23 @@ void cmake::AddDefaultGenerators() #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) this->Generators.push_back( - cmGlobalVisualStudio6Generator::NewFactory()); - this->Generators.push_back( - cmGlobalVisualStudio7Generator::NewFactory()); - this->Generators.push_back( - cmGlobalVisualStudio10Generator::NewFactory()); - this->Generators.push_back( - cmGlobalVisualStudio11Generator::NewFactory()); + cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back( cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio14Generator::NewFactory()); + cmGlobalVisualStudio11Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio71Generator::NewFactory()); + cmGlobalVisualStudio10Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio9Generator::NewFactory()); this->Generators.push_back( cmGlobalVisualStudio8Generator::NewFactory()); this->Generators.push_back( - cmGlobalVisualStudio9Generator::NewFactory()); + cmGlobalVisualStudio71Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio7Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio6Generator::NewFactory()); this->Generators.push_back( cmGlobalBorlandMakefileGenerator::NewFactory()); this->Generators.push_back( From 3347c5e4f9fcdd36c06067d6c7cd5a985a9c5d94 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Apr 2015 17:14:41 -0400 Subject: [PATCH 0462/1029] Revert topic 'refactor-cache-api' This topic was never tested without some follow-up commits. The GetCacheEntryValue API returns a pointer to memory freed on return. It will have to be revised along with the rest of the original topic. --- Source/CTest/cmCTestBuildAndTestHandler.cxx | 3 +- .../cmCursesCacheEntryComposite.cxx | 35 ++-- .../cmCursesCacheEntryComposite.h | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 151 +++++++--------- Source/QtDialog/QCMake.cxx | 85 ++++----- Source/cmCPluginAPI.cxx | 6 +- Source/cmCTest.cxx | 2 +- Source/cmCacheManager.cxx | 16 +- Source/cmCacheManager.h | 77 +------- Source/cmCommandArgumentParserHelper.cxx | 3 +- Source/cmExtraEclipseCDT4Generator.cxx | 6 +- Source/cmFindBase.cxx | 13 +- Source/cmGetPropertyCommand.cxx | 7 +- Source/cmGlobalGenerator.cxx | 14 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLoadCacheCommand.cxx | 6 +- Source/cmMakefile.cxx | 54 +++--- Source/cmMakefile.h | 8 + Source/cmMarkAsAdvancedCommand.cxx | 15 +- Source/cmOptionCommand.cxx | 12 +- Source/cmSetCommand.cxx | 7 +- Source/cmSetPropertyCommand.cxx | 19 +- Source/cmSetPropertyCommand.h | 2 +- Source/cmTryRunCommand.cxx | 19 +- Source/cmUtilitySourceCommand.cxx | 6 +- Source/cmVariableRequiresCommand.cxx | 6 +- Source/cmake.cxx | 166 +++++++----------- Source/cmake.h | 14 +- Source/cmakemain.cxx | 26 ++- 29 files changed, 311 insertions(+), 471 deletions(-) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 586070b87..08270375e 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -18,6 +18,7 @@ #include "cmGlobalGenerator.h" #include #include "cmCTestTestHandler.h" +#include "cmCacheManager.h" //---------------------------------------------------------------------- cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() @@ -254,7 +255,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. - cm.LoadCache(this->BinaryDir); + cm.GetCacheManager()->LoadCache(this->BinaryDir); } else { diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 4f028c42a..682f95f9e 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -18,9 +18,6 @@ #include "cmCursesFilePathWidget.h" #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" -#include "../cmake.h" - -#include cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( const std::string& key, @@ -35,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const std::string& key, cmake *cm, bool isNew, + const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { @@ -50,13 +47,11 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } this->Entry = 0; - const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); - assert(value); - switch (cm->GetCacheManager()->GetCacheEntryType(key)) + switch ( it.GetType() ) { - case cmCacheManager::BOOL: + case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); - if (cmSystemTools::IsOn(value)) + if (cmSystemTools::IsOn(it.GetValue().c_str())) { static_cast(this->Entry)->SetValueAsBool(true); } @@ -67,40 +62,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( break; case cmCacheManager::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString(value); + static_cast(this->Entry)->SetString( + it.GetValue()); break; case cmCacheManager::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString(value); + static_cast(this->Entry)->SetString( + it.GetValue()); break; case cmCacheManager::STRING: - { - const char* stringsProp = cm->GetCacheManager() - ->GetCacheEntryProperty(key, "STRINGS"); - if(stringsProp) + if(it.PropertyExists("STRINGS")) { cmCursesOptionsWidget* ow = new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1); this->Entry = ow; std::vector options; - cmSystemTools::ExpandListArgument(stringsProp, options); + cmSystemTools::ExpandListArgument( + std::string(it.GetProperty("STRINGS")), options); for(std::vector::iterator si = options.begin(); si != options.end(); ++si) { ow->AddOption(*si); } - ow->SetOption(value); + ow->SetOption(it.GetValue()); } else { this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString(value); + static_cast(this->Entry)->SetString( + it.GetValue()); } break; - } case cmCacheManager::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", - key.c_str()); + it.GetName().c_str()); break; default: // TODO : put warning message here diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index dc4ee4af0..7cdf13bad 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -21,7 +21,7 @@ public: cmCursesCacheEntryComposite(const std::string& key, int labelwidth, int entrywidth); cmCursesCacheEntryComposite(const std::string& key, - cmake *cm, + const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 833d54038..d60062e5b 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -111,17 +111,13 @@ void cmCursesMainForm::InitializeUI() // Count non-internal and non-static entries int count=0; - std::vector cacheKeys = - this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys(); - - for(std::vector::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) + for(cmCacheManager::CacheIterator i = + this->CMakeInstance->GetCacheManager()->NewIterator(); + !i.IsAtEnd(); i.Next()) { - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() - ->GetCacheEntryType(*it); - if (t != cmCacheManager::INTERNAL && - t != cmCacheManager::STATIC && - t != cmCacheManager::UNINITIALIZED) + if ( i.GetType() != cmCacheManager::INTERNAL && + i.GetType() != cmCacheManager::STATIC && + i.GetType() != cmCacheManager::UNINITIALIZED) { ++count; } @@ -143,49 +139,45 @@ void cmCursesMainForm::InitializeUI() // Create the composites. // First add entries which are new - for(std::vector::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) + for(cmCacheManager::CacheIterator i = + this->CMakeInstance->GetCacheManager()->NewIterator(); + !i.IsAtEnd(); i.Next()) { - std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() - ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + std::string key = i.GetName(); + if ( i.GetType() == cmCacheManager::INTERNAL || + i.GetType() == cmCacheManager::STATIC || + i.GetType() == cmCacheManager::UNINITIALIZED ) { continue; } if (!this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, - this->CMakeInstance, - true, 30, - entrywidth)); + newEntries->push_back(new cmCursesCacheEntryComposite(key, i, + true, 30, + entrywidth)); this->OkToGenerate = false; } } // then add entries which are old - for(std::vector::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) + for(cmCacheManager::CacheIterator i = + this->CMakeInstance->GetCacheManager()->NewIterator(); + !i.IsAtEnd(); i.Next()) { - std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() - ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + std::string key = i.GetName(); + if ( i.GetType() == cmCacheManager::INTERNAL || + i.GetType() == cmCacheManager::STATIC || + i.GetType() == cmCacheManager::UNINITIALIZED ) { continue; } if (this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, - this->CMakeInstance, - false, 30, - entrywidth)); + newEntries->push_back(new cmCursesCacheEntryComposite(key, i, + false, 30, + entrywidth)); } } } @@ -224,13 +216,10 @@ void cmCursesMainForm::RePost() std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - const char* existingValue = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryValue((*it)->GetValue()); - bool advanced = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); - if (!existingValue || (!this->AdvancedMode && advanced)) + cmCacheManager::CacheIterator mit = + this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || + (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) { continue; } @@ -256,13 +245,10 @@ void cmCursesMainForm::RePost() std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - const char* existingValue = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryValue((*it)->GetValue()); - bool advanced = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); - if (!existingValue || (!this->AdvancedMode && advanced)) + cmCacheManager::CacheIterator mit = + this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || + (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) { continue; } @@ -328,13 +314,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - const char* existingValue = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryValue((*it)->GetValue()); - bool advanced = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); - if (!existingValue || (!this->AdvancedMode && advanced)) + cmCacheManager::CacheIterator mit = + this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || + (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) { continue; } @@ -351,13 +334,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - const char* existingValue = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryValue((*it)->GetValue()); - bool advanced = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); - if (!existingValue || (!this->AdvancedMode && advanced)) + cmCacheManager::CacheIterator mit = + this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); + if (mit.IsAtEnd() || + (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) { continue; } @@ -515,12 +495,11 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // Get the help string of the current entry // and add it to the help string - const char* existingValue = - this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField); - if (existingValue) + cmCacheManager::CacheIterator it = + this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField); + if (!it.IsAtEnd()) { - const char* hs = this->CMakeInstance->GetCacheManager() - ->GetCacheEntryProperty(curField, "HELPSTRING"); + const char* hs = it.GetProperty("HELPSTRING"); if ( hs ) { strncpy(help, hs, 127); @@ -660,7 +639,7 @@ int cmCursesMainForm::Configure(int noconfigure) // always save the current gui values to disk this->FillCacheManagerFromUI(); - this->CMakeInstance->SaveCache( + this->CMakeInstance->GetCacheManager()->SaveCache( this->CMakeInstance->GetHomeOutputDirectory()); this->LoadCache(0); @@ -813,28 +792,23 @@ void cmCursesMainForm::FillCacheManagerFromUI() size_t size = this->Entries->size(); for(size_t i=0; i < size; i++) { - std::string cacheKey = (*this->Entries)[i]->Key; - const char* existingValue = this->CMakeInstance->GetCacheManager() - ->GetCacheEntryValue(cacheKey); - if (existingValue) + cmCacheManager::CacheIterator it = + this->CMakeInstance->GetCacheManager()->GetCacheIterator( + (*this->Entries)[i]->Key.c_str()); + if (!it.IsAtEnd()) { - std::string oldValue = existingValue; + std::string oldValue = it.GetValue(); std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - cmCacheManager::CacheEntryType t = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryType(cacheKey); - this->FixValue(t, oldValue, fixedOldValue); - this->FixValue(t, newValue, fixedNewValue); + this->FixValue(it.GetType(), oldValue, fixedOldValue); + this->FixValue(it.GetType(), newValue, fixedNewValue); if(!(fixedOldValue == fixedNewValue)) { // The user has changed the value. Mark it as modified. - this->CMakeInstance->GetCacheManager() - ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true); - this->CMakeInstance->GetCacheManager() - ->SetCacheEntryValue(cacheKey, fixedNewValue); + it.SetProperty("MODIFIED", true); + it.SetValue(fixedNewValue.c_str()); } } } @@ -1043,15 +1017,12 @@ void cmCursesMainForm::HandleInput() cmCursesWidget* lbl = reinterpret_cast(field_userptr( this->Fields[findex-2])); const char* curField = lbl->GetValue(); - const char* helpString = 0; - - const char* existingValue = - this->CMakeInstance->GetCacheManager() - ->GetCacheEntryValue(curField); - if (existingValue) + const char* helpString=0; + cmCacheManager::CacheIterator it = + this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField); + if (!it.IsAtEnd()) { - helpString = this->CMakeInstance->GetCacheManager() - ->GetCacheEntryProperty(curField, "HELPSTRING"); + helpString = it.GetProperty("HELPSTRING"); } if (helpString) { diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 08d53ce27..996aa75fe 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -96,7 +96,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) emit this->binaryDirChanged(this->BinaryDirectory); cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); this->setGenerator(QString()); - if(!this->CMakeInstance->LoadCache( + if(!this->CMakeInstance->GetCacheManager()->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { QDir testDir(this->BinaryDirectory); @@ -110,18 +110,16 @@ void QCMake::setBinaryDirectory(const QString& _dir) QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); - const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); - if (homeDir) + cmCacheManager::CacheIterator itm = cachem->NewIterator(); + if ( itm.Find("CMAKE_HOME_DIRECTORY")) { - setSourceDirectory(QString::fromLocal8Bit(homeDir)); + setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str())); } - const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR"); - if (gen) + if ( itm.Find("CMAKE_GENERATOR")) { - const char* extraGen = cachem - ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); + const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(gen, extraGen? extraGen : ""); + CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } } @@ -196,35 +194,33 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) // set the value of properties cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - std::vector cacheKeys = cachem->GetCacheEntryKeys(); - for(std::vector::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) + for(cmCacheManager::CacheIterator i = cachem->NewIterator(); + !i.IsAtEnd(); i.Next()) { - cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it); - if(t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC) + + if(i.GetType() == cmCacheManager::INTERNAL || + i.GetType() == cmCacheManager::STATIC) { continue; } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(it->c_str()); + prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); int idx = props.indexOf(prop); if(idx == -1) { - toremove.append(QString::fromLocal8Bit(it->c_str())); + toremove.append(QString::fromLocal8Bit(i.GetName().c_str())); } else { prop = props[idx]; if(prop.Value.type() == QVariant::Bool) { - cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF"); + i.SetValue(prop.Value.toBool() ? "ON" : "OFF"); } else { - cachem->SetCacheEntryValue(*it, - prop.Value.toString().toLocal8Bit().data()); + i.SetValue(prop.Value.toString().toLocal8Bit().data()); } props.removeAt(idx); } @@ -274,7 +270,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) } } - this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); + cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); } QCMakePropertyList QCMake::properties() const @@ -282,47 +278,42 @@ QCMakePropertyList QCMake::properties() const QCMakePropertyList ret; cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - std::vector cacheKeys = cachem->GetCacheEntryKeys(); - for (std::vector::const_iterator i = cacheKeys.begin(); - i != cacheKeys.end(); ++i) + for(cmCacheManager::CacheIterator i = cachem->NewIterator(); + !i.IsAtEnd(); i.Next()) { - cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i); - if(t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED) + + if(i.GetType() == cmCacheManager::INTERNAL || + i.GetType() == cmCacheManager::STATIC || + i.GetType() == cmCacheManager::UNINITIALIZED) { continue; } - const char* cachedValue = cachem->GetCacheEntryValue(*i); - QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i->c_str()); - prop.Help = QString::fromLocal8Bit( - cachem->GetCacheEntryProperty(*i, "HELPSTRING")); - prop.Value = QString::fromLocal8Bit(cachedValue); - prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); - if(t == cmCacheManager::BOOL) + prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); + prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING")); + prop.Value = QString::fromLocal8Bit(i.GetValue().c_str()); + prop.Advanced = i.GetPropertyAsBool("ADVANCED"); + + if(i.GetType() == cmCacheManager::BOOL) { prop.Type = QCMakeProperty::BOOL; - prop.Value = cmSystemTools::IsOn(cachedValue); + prop.Value = cmSystemTools::IsOn(i.GetValue().c_str()); } - else if(t == cmCacheManager::PATH) + else if(i.GetType() == cmCacheManager::PATH) { prop.Type = QCMakeProperty::PATH; } - else if(t == cmCacheManager::FILEPATH) + else if(i.GetType() == cmCacheManager::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; } - else if(t == cmCacheManager::STRING) + else if(i.GetType() == cmCacheManager::STRING) { prop.Type = QCMakeProperty::STRING; - const char* stringsProperty = - cachem->GetCacheEntryProperty(*i, "STRINGS"); - if (stringsProperty) + if (i.PropertyExists("STRINGS")) { - prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";"); + prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";"); } } @@ -406,9 +397,9 @@ QStringList QCMake::availableGenerators() const void QCMake::deleteCache() { // delete cache - this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toLocal8Bit().data()); // reload to make our cache empty - this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit no generator and no properties this->setGenerator(QString()); QCMakePropertyList props = this->properties(); @@ -421,7 +412,7 @@ void QCMake::reloadCache() QCMakePropertyList props; emit this->propertiesChanged(props); // reload - this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit new cache properties props = this->properties(); emit this->propertiesChanged(props); diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 987a7b17d..691d80d7e 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -51,14 +51,12 @@ void CCONV cmSetError(void *info, const char *err) unsigned int CCONV cmGetCacheMajorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); - return manager->GetCacheMajorVersion(); + return mf->GetCacheMajorVersion(); } unsigned int CCONV cmGetCacheMinorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); - return manager->GetCacheMinorVersion(); + return mf->GetCacheMinorVersion(); } unsigned int CCONV cmGetMajorVersion(void *) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1db057bd1..df61fe6bf 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2281,7 +2281,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if (cmake::ParseCacheEntry(arg, name, value, type)) + if (cmCacheManager::ParseEntry(arg, name, value, type)) { this->Definitions[name] = value; return true; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index f8f2dbd18..fa7eff3ce 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -284,16 +284,14 @@ bool cmCacheManager::LoadCache(const std::string& path, } this->CacheMajorVersion = 0; this->CacheMinorVersion = 0; - if(const char* cmajor = - this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION")) + if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION")) { unsigned int v=0; if(sscanf(cmajor, "%u", &v) == 1) { this->CacheMajorVersion = v; } - if(const char* cminor = - this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION")) + if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION")) { if(sscanf(cminor, "%u", &v) == 1) { @@ -315,11 +313,10 @@ bool cmCacheManager::LoadCache(const std::string& path, } // check to make sure the cache directory has not // been moved - const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR"); - if (internal && oldDir) + if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") ) { std::string currentcwd = path; - std::string oldcwd = oldDir; + std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR"); cmSystemTools::ConvertToUnixSlashes(currentcwd); currentcwd += "/CMakeCache.txt"; oldcwd += "/CMakeCache.txt"; @@ -328,7 +325,7 @@ bool cmCacheManager::LoadCache(const std::string& path, std::string message = std::string("The current CMakeCache.txt directory ") + currentcwd + std::string(" is different than the directory ") + - std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) + + std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + std::string(" where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); @@ -658,8 +655,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( return CacheIterator(*this, key); } -const char* -cmCacheManager::GetInitializedCacheValue(const std::string& key) const +const char* cmCacheManager::GetCacheValue(const std::string& key) const { CacheEntryMap::const_iterator i = this->Cache.find(key); if(i != this->Cache.end() && diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 2d3f6e5fc..f7f877606 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -137,82 +137,7 @@ public: CacheEntryType& type); ///! Get a value from the cache given a key - const char* GetInitializedCacheValue(const std::string& key) const; - - const char* GetCacheEntryValue(const std::string& key) - { - cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str()); - if (it.IsAtEnd()) - { - return 0; - } - return it.GetValue().c_str(); - } - - const char* GetCacheEntryProperty(std::string const& key, - std::string const& propName) - { - return this->GetCacheIterator(key.c_str()).GetProperty(propName); - } - - CacheEntryType GetCacheEntryType(std::string const& key) - { - return this->GetCacheIterator(key.c_str()).GetType(); - } - - bool GetCacheEntryPropertyAsBool(std::string const& key, - std::string const& propName) - { - return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName); - } - - void SetCacheEntryProperty(std::string const& key, - std::string const& propName, - std::string const& value) - { - this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str()); - } - - void SetCacheEntryBoolProperty(std::string const& key, - std::string const& propName, - bool value) - { - this->GetCacheIterator(key.c_str()).SetProperty(propName, value); - } - - void SetCacheEntryValue(std::string const& key, - std::string const& value) - { - this->GetCacheIterator(key.c_str()).SetValue(value.c_str()); - } - - void RemoveCacheEntryProperty(std::string const& key, - std::string const& propName) - { - this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0); - } - - void AppendCacheEntryProperty(std::string const& key, - std::string const& propName, - std::string const& value, - bool asString = false) - { - this->GetCacheIterator(key.c_str()).AppendProperty(propName, - value.c_str(), - asString); - } - - std::vector GetCacheEntryKeys() - { - std::vector definitions; - definitions.reserve(this->GetSize()); - cmCacheManager::CacheIterator cit = this->GetCacheIterator(); - for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) - { - definitions.push_back(cit.GetName()); - } - return definitions; - } + const char* GetCacheValue(const std::string& key) const; /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 99bf5f55f..747b7e434 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -90,8 +90,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } if ( strcmp(key, "CACHE") == 0 ) { - if(const char* c = this->Makefile->GetCacheManager() - ->GetInitializedCacheValue(var)) + if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var)) { if(this->EscapeQuotes) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 0d32e4bac..d64b0d74c 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; cacheEntryName += envVar; - const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue( + const char* cacheValue = mf->GetCacheManager()->GetCacheValue( cacheEntryName); // now we have both, decide which one to use @@ -223,7 +223,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); - mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); } else if (envVarValue==0 && cacheValue!=0) { @@ -244,7 +244,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); - mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); } } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index cc080528d..f63df616d 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -366,18 +366,18 @@ bool cmFindBase::CheckForVariableInCache() if(const char* cacheValue = this->Makefile->GetDefinition(this->VariableName)) { - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName); + cmCacheManager::CacheIterator it = + this->Makefile->GetCacheManager()-> + GetCacheIterator(this->VariableName.c_str()); bool found = !cmSystemTools::IsNOTFOUND(cacheValue); - bool cached = cacheEntry ? true : false; + bool cached = !it.IsAtEnd(); if(found) { // If the user specifies the entry on the command line without a // type we should add the type and docstring but keep the // original value. Tell the subclass implementations to do // this. - if(cached && manager->GetCacheEntryType(this->VariableName) - == cmCacheManager::UNINITIALIZED) + if(cached && it.GetType() == cmCacheManager::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } @@ -385,8 +385,7 @@ bool cmFindBase::CheckForVariableInCache() } else if(cached) { - const char* hs = manager->GetCacheEntryProperty(this->VariableName, - "HELPSTRING"); + const char* hs = it.GetProperty("HELPSTRING"); this->VariableDocumentation = hs?hs:"(none)"; } } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 0e6e0c20e..f0b268685 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -391,10 +391,11 @@ bool cmGetPropertyCommand::HandleCacheMode() } const char* value = 0; - if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name)) + cmCacheManager::CacheIterator it = + this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str()); + if(!it.IsAtEnd()) { - value = this->Makefile->GetCacheManager() - ->GetCacheEntryProperty(this->Name, this->PropertyName); + value = it.GetProperty(this->PropertyName); } this->StoreResult(value); return true; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35394b8f9..3c0a0e244 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -179,7 +179,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, return; } const char* cname = this->GetCMakeInstance()-> - GetCacheManager()->GetInitializedCacheValue(langComp); + GetCacheManager()->GetCacheValue(langComp); std::string changeVars; if(cname && !optional) { @@ -1559,7 +1559,9 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(lib->first.c_str())) { std::string varName = lib->first.substr(0, lib->first.size()-9); - if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) + cmCacheManager::CacheIterator it = + manager->GetCacheIterator(varName.c_str()); + if(it.GetPropertyAsBool("ADVANCED")) { varName += " (ADVANCED)"; } @@ -1590,7 +1592,9 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(incDir->c_str())) { std::string varName = incDir->substr(0, incDir->size()-9); - if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) + cmCacheManager::CacheIterator it = + manager->GetCacheIterator(varName.c_str()); + if(it.GetPropertyAsBool("ADVANCED")) { varName += " (ADVANCED)"; } @@ -1637,7 +1641,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, // and there is a good chance that the try compile stuff will // take the bulk of the time, so try and guess some progress // by getting closer and closer to 100 without actually getting there. - if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue + if (!this->CMakeInstance->GetCacheManager()->GetCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) { // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set @@ -1835,7 +1839,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) // update progress // estimate how many lg there will be const char *numGenC = - this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue + this->CMakeInstance->GetCacheManager()->GetCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); if (!numGenC) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0561a0542..5e584a452 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3703,7 +3703,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, // Since this call may have created new cache entries, save the cache: // - root->GetMakefile()->GetCMakeInstance()->SaveCache( + root->GetMakefile()->GetCacheManager()->SaveCache( root->GetMakefile()->GetHomeOutputDirectory()); } diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index e2ae90111..93aec3220 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -81,8 +81,8 @@ bool cmLoadCacheCommand { break; } - this->Makefile->GetCMakeInstance()->LoadCache(args[i], false, - excludes, includes); + this->Makefile->GetCacheManager()->LoadCache(args[i], false, + excludes, includes); } @@ -173,7 +173,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) std::string var; std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if(cmake::ParseCacheEntry(line, var, value, type)) + if(cmCacheManager::ParseEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. if(this->VariablesToRead.find(var) != this->VariablesToRead.end()) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 34b46218d..215ee1614 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -174,6 +174,16 @@ void cmMakefile::Initialize() this->CheckCMP0000 = false; } +unsigned int cmMakefile::GetCacheMajorVersion() const +{ + return this->GetCacheManager()->GetCacheMajorVersion(); +} + +unsigned int cmMakefile::GetCacheMinorVersion() const +{ + return this->GetCacheManager()->GetCacheMinorVersion(); +} + cmMakefile::~cmMakefile() { cmDeleteAll(this->InstallGenerators); @@ -1810,17 +1820,16 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, { bool haveVal = value ? true : false; std::string val = haveVal ? value : ""; - const char* existingValue = - this->GetCacheManager()->GetInitializedCacheValue(name); - if(existingValue - && (this->GetCacheManager()->GetCacheEntryType(name) - == cmCacheManager::UNINITIALIZED)) + cmCacheManager::CacheIterator it = + this->GetCacheManager()->GetCacheIterator(name.c_str()); + if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && + it.Initialized()) { // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in if(!force) { - val = existingValue; + val = it.GetValue(); haveVal = true; } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) @@ -1843,13 +1852,13 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); - val = this->GetCacheManager()->GetInitializedCacheValue(name); + val = it.GetValue(); haveVal = true; } } - this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, - doc, type); + this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc, + type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } @@ -2433,7 +2442,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const this->Internal->VarUsageStack.top().insert(name); if(!def) { - def = this->GetCacheManager()->GetInitializedCacheValue(name); + def = this->GetCacheManager()->GetCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE if(cmVariableWatch* vv = this->GetVariableWatch()) @@ -2458,7 +2467,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const const char* def = this->Internal->VarStack.top().Get(name); if(!def) { - def = this->GetCacheManager()->GetInitializedCacheValue(name); + def = this->GetCacheManager()->GetCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE cmVariableWatch* vv = this->GetVariableWatch(); @@ -2492,18 +2501,20 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const std::vector cmMakefile ::GetDefinitions(int cacheonly /* = 0 */) const { - std::vector res; + std::set definitions; if ( !cacheonly ) { - std::set definitions = - this->Internal->VarStack.top().ClosureKeys(); - res.insert(res.end(), definitions.begin(), definitions.end()); + definitions = this->Internal->VarStack.top().ClosureKeys(); + } + cmCacheManager::CacheIterator cit = + this->GetCacheManager()->GetCacheIterator(); + for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) + { + definitions.insert(cit.GetName()); } - std::vector cacheKeys = - this->GetCacheManager()->GetCacheEntryKeys(); - res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); - std::sort(res.begin(), res.end()); + std::vector res; + res.insert(res.end(), definitions.begin(), definitions.end()); return res; } @@ -2834,8 +2845,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( value = cmSystemTools::GetEnv(lookup.c_str()); break; case CACHE: - value = this->GetCacheManager() - ->GetInitializedCacheValue(lookup); + value = this->GetCacheManager()->GetCacheValue(lookup); break; } // Get the string we're meant to append to. @@ -4903,7 +4913,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, (status == cmPolicies::WARN || status == cmPolicies::OLD)) { if(!(this->GetCacheManager() - ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + ->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) { // Set it to 2.4 because that is the last version where the // variable had meaning. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5209891d2..920b6b79d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -62,6 +62,14 @@ class cmMakefile class Internals; cmsys::auto_ptr Internal; public: + /** + * Return the major and minor version of the cmake that + * was used to write the currently loaded cache, note + * this method will not work before the cache is loaded. + */ + unsigned int GetCacheMajorVersion() const; + unsigned int GetCacheMinorVersion() const; + /* Check for unused variables in this scope */ void CheckForUnusedVariables() const; /* Mark a variable as used */ diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index cc094b1bc..f6a2c2670 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -37,19 +37,24 @@ bool cmMarkAsAdvancedCommand { std::string variable = args[i]; cmCacheManager* manager = this->Makefile->GetCacheManager(); - if (!manager->GetCacheEntryValue(variable)) + cmCacheManager::CacheIterator it = + manager->GetCacheIterator(variable.c_str()); + if ( it.IsAtEnd() ) { - manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); + this->Makefile->GetCacheManager() + ->AddCacheEntry(variable, 0, 0, + cmCacheManager::UNINITIALIZED); overwrite = true; } - if (!manager->GetCacheEntryValue(variable)) + it.Find(variable); + if ( it.IsAtEnd() ) { cmSystemTools::Error("This should never happen..."); return false; } - if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite) + if ( !it.PropertyExists("ADVANCED") || overwrite ) { - manager->SetCacheEntryProperty(variable, "ADVANCED", value); + it.SetProperty("ADVANCED", value); } } return true; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index baf5b1e08..60728eaea 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -42,16 +42,16 @@ bool cmOptionCommand std::string initialValue = "Off"; // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* existingValue = manager->GetCacheEntryValue(args[0]); - if(existingValue) + cmCacheManager::CacheIterator it = + this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str()); + if(!it.IsAtEnd()) { - if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) + if ( it.GetType() != cmCacheManager::UNINITIALIZED ) { - manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); + it.SetProperty("HELPSTRING", args[1].c_str()); return true; } - initialValue = existingValue; + initialValue = it.GetValue(); } if(args.size() == 3) { diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index e17474bd6..204d95b1e 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -136,10 +136,9 @@ bool cmSetCommand } // see if this is already in the cache - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* existingValue = manager->GetCacheEntryValue(variable); - if(existingValue && - (manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) + cmCacheManager::CacheIterator it = + this->Makefile->GetCacheManager()->GetCacheIterator(variable); + if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 77f9fb90b..1150bc7ad 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -452,11 +452,11 @@ bool cmSetPropertyCommand::HandleCacheMode() // Get the source file. cmMakefile* mf = this->GetMakefile(); cmake* cm = mf->GetCMakeInstance(); - const char* existingValue - = cm->GetCacheManager()->GetCacheEntryValue(*ni); - if(existingValue) + cmCacheManager::CacheIterator it = + cm->GetCacheManager()->GetCacheIterator(ni->c_str()); + if(!it.IsAtEnd()) { - if(!this->HandleCacheEntry(*ni)) + if(!this->HandleCacheEntry(it)) { return false; } @@ -474,25 +474,22 @@ bool cmSetPropertyCommand::HandleCacheMode() } //---------------------------------------------------------------------------- -bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey) +bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it) { // Set or append the property. const char* name = this->PropertyName.c_str(); const char* value = this->PropertyValue.c_str(); - cmCacheManager* manager = this->Makefile->GetCacheManager(); if (this->Remove) { - manager->RemoveCacheEntryProperty(cacheKey, name); - return true; + value = 0; } if(this->AppendMode) { - manager->AppendCacheEntryProperty(cacheKey, name, value, - this->AppendAsString); + it.AppendProperty(name, value, this->AppendAsString); } else { - manager->SetCacheEntryProperty(cacheKey, name, value); + it.SetProperty(name, value); } return true; diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 3285e60ab..b06cb6857 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -61,7 +61,7 @@ private: bool HandleTestMode(); bool HandleTest(cmTest* test); bool HandleCacheMode(); - bool HandleCacheEntry(std::string const&); + bool HandleCacheEntry(cmCacheManager::CacheIterator&); bool HandleInstallMode(); bool HandleInstall(cmInstalledFile* file); }; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 911ade810..b5280cfd7 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -264,12 +264,11 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment.c_str(), cmCacheManager::STRING); - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* existingValue - = manager->GetCacheEntryValue(this->RunResultVariable); - if (existingValue) + cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> + GetCacheIterator(this->RunResultVariable.c_str()); + if ( !it.IsAtEnd() ) { - manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1"); + it.SetProperty("ADVANCED", "1"); } error = true; @@ -291,13 +290,11 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), cmCacheManager::STRING); - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* existing = - manager->GetCacheEntryValue(internalRunOutputName); - if (existing) + cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> + GetCacheIterator(internalRunOutputName.c_str()); + if ( !it.IsAtEnd() ) { - manager->SetCacheEntryProperty(internalRunOutputName, - "ADVANCED", "1"); + it.SetProperty("ADVANCED", "1"); } error = true; diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 2799a9be5..ee1ff291a 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -52,13 +52,11 @@ bool cmUtilitySourceCommand } else { - cmCacheManager *manager = - this->Makefile->GetCMakeInstance()->GetCacheManager(); haveCacheValue = (cacheValue && (strstr(cacheValue, "(IntDir)") == 0 || (intDir && strcmp(intDir, "$(IntDir)") == 0)) && - (manager->GetCacheMajorVersion() != 0 && - manager->GetCacheMinorVersion() != 0 )); + (this->Makefile->GetCacheMajorVersion() != 0 && + this->Makefile->GetCacheMinorVersion() != 0 )); } if(haveCacheValue) diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index dd2a68299..80c128654 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -41,9 +41,9 @@ bool cmVariableRequiresCommand requirementsMet = false; notSet += args[i]; notSet += "\n"; - cmCacheManager* manager = this->Makefile->GetCacheManager(); - if(manager->GetCacheEntryValue(args[i]) && - manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) + cmCacheManager::CacheIterator it = + this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str()); + if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED")) { hasAdvanced = true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 64b332ccc..5c52a1a2d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -344,8 +344,7 @@ bool cmake::SetCacheArgs(const std::vector& args) std::string cachedValue; if(this->WarnUnusedCli) { - if(const char *v = this->CacheManager - ->GetInitializedCacheValue(var)) + if(const char *v = this->CacheManager->GetCacheValue(var)) { haveValue = true; cachedValue = v; @@ -358,8 +357,7 @@ bool cmake::SetCacheArgs(const std::vector& args) if(this->WarnUnusedCli) { if (!haveValue || - cachedValue != this->CacheManager - ->GetInitializedCacheValue(var)) + cachedValue != this->CacheManager->GetCacheValue(var)) { this->WatchUnusedCli(var); } @@ -403,18 +401,17 @@ bool cmake::SetCacheArgs(const std::vector& args) cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector entriesToDelete; - std::vector cacheKeys = - this->CacheManager->GetCacheEntryKeys(); - for (std::vector::const_iterator it = cacheKeys.begin(); - it != cacheKeys.end(); ++it) + cmCacheManager::CacheIterator it = + this->CacheManager->GetCacheIterator(); + for ( it.Begin(); !it.IsAtEnd(); it.Next() ) { - cmCacheManager::CacheEntryType t = - this->CacheManager->GetCacheEntryType(*it); + cmCacheManager::CacheEntryType t = it.GetType(); if(t != cmCacheManager::STATIC) { - if (regex.find(it->c_str())) + std::string entryName = it.GetName(); + if (regex.find(entryName.c_str())) { - entriesToDelete.push_back(*it); + entriesToDelete.push_back(entryName); } } } @@ -918,18 +915,16 @@ void cmake::SetDirectoriesFromFile(const char* arg) // If there is a CMakeCache.txt file, use its settings. if(!cachePath.empty()) { - if(this->LoadCache(cachePath)) + cmCacheManager* cachem = this->GetCacheManager(); + cmCacheManager::CacheIterator it = cachem->NewIterator(); + if(cachem->LoadCache(cachePath) && + it.Find("CMAKE_HOME_DIRECTORY")) { - const char* existingValue = - this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); - if (existingValue) - { - this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); - this->SetHomeDirectory(existingValue); - this->SetStartDirectory(existingValue); - return; - } + this->SetHomeOutputDirectory(cachePath); + this->SetStartOutputDirectory(cachePath); + this->SetHomeDirectory(it.GetValue()); + this->SetStartDirectory(it.GetValue()); + return; } } @@ -1208,10 +1203,10 @@ int cmake::DoPreConfigureChecks() } // do a sanity check on some values - if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) + if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY")) { std::string cacheStart = - this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); + this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); currentStart += "/CMakeLists.txt"; @@ -1360,9 +1355,9 @@ int cmake::ActualConfigure() if(!this->GlobalGenerator) { const char* genName = - this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"); + this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); const char* extraGenName = - this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); + this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR"); if(genName) { std::string fullName = cmExternalMakefileProjectGenerator:: @@ -1440,8 +1435,7 @@ int cmake::ActualConfigure() } } - const char* genName = this->CacheManager - ->GetInitializedCacheValue("CMAKE_GENERATOR"); + const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); if(genName) { if(!this->GlobalGenerator->MatchesGeneratorName(genName)) @@ -1457,7 +1451,7 @@ int cmake::ActualConfigure() return -2; } } - if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR")) + if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR")) { this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), @@ -1470,7 +1464,7 @@ int cmake::ActualConfigure() } if(const char* platformName = - this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) + this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM")) { if(this->GeneratorPlatform.empty()) { @@ -1498,7 +1492,7 @@ int cmake::ActualConfigure() } if(const char* tsName = - this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) + this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET")) { if(this->GeneratorToolset.empty()) { @@ -1552,18 +1546,16 @@ int cmake::ActualConfigure() // project requires compatibility with CMake 2.4. We detect this // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY // variable created when CMP0001 is not set to NEW. - if(this->GetCacheManager() - ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) + if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { - if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) + if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH")) { this->CacheManager->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", cmCacheManager::PATH); } - if(!this->CacheManager - ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) + if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH")) { this->CacheManager->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", @@ -1571,25 +1563,24 @@ int cmake::ActualConfigure() cmCacheManager::PATH); } } - if(!this->CacheManager - ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) + if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS")) { this->CacheManager->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", cmCacheManager::BOOL); - if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED")) + cmCacheManager::CacheIterator it = + this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS"); + if ( !it.PropertyExists("ADVANCED") ) { - this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED", "1"); + it.SetProperty("ADVANCED", "1"); } } if(cmSystemTools::GetFatalErrorOccured() && - (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") || + (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") || cmSystemTools::IsOff(this->CacheManager-> - GetInitializedCacheValue("CMAKE_MAKE_PROGRAM")))) + GetCacheValue("CMAKE_MAKE_PROGRAM")))) { // We must have a bad generator selection. Wipe the cache entry so the // user can select another. @@ -1805,7 +1796,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, const char* cmake::GetCacheDefinition(const std::string& name) const { - return this->CacheManager->GetInitializedCacheValue(name); + return this->CacheManager->GetCacheValue(name); } void cmake::AddDefaultCommands() @@ -1869,18 +1860,10 @@ void cmake::AddDefaultGenerators() #endif } -bool cmake::ParseCacheEntry(const std::string& entry, - std::string& var, - std::string& value, - cmCacheManager::CacheEntryType& type) -{ - return cmCacheManager::ParseEntry(entry, var, value, type); -} - int cmake::LoadCache() { // could we not read the cache - if (!this->LoadCache(this->GetHomeOutputDirectory())) + if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory())) { // if it does exist, but isn't readable then warn the user std::string cacheFile = this->GetHomeOutputDirectory(); @@ -1903,28 +1886,6 @@ int cmake::LoadCache() return 0; } -bool cmake::LoadCache(const std::string& path) -{ - return this->CacheManager->LoadCache(path); -} - -bool cmake::LoadCache(const std::string& path, bool internal, - std::set& excludes, - std::set& includes) -{ - return this->CacheManager->LoadCache(path, internal, excludes, includes); -} - -bool cmake::SaveCache(const std::string& path) -{ - return this->CacheManager->SaveCache(path); -} - -bool cmake::DeleteCache(const std::string& path) -{ - return this->CacheManager->DeleteCache(path); -} - void cmake::SetProgressCallback(ProgressCallbackType f, void *cd) { this->ProgressCallback = f; @@ -1965,8 +1926,7 @@ void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: const char* tablepath = - this->CacheManager - ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE"); + this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if(tablepath) { @@ -2200,7 +2160,7 @@ void cmake::TruncateOutputLog(const char* fname) { return; } - if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") ) + if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") ) { cmSystemTools::RemoveFile(fullPath); return; @@ -2317,9 +2277,17 @@ const char *cmake::GetProperty(const std::string& prop, std::string output = ""; if ( prop == "CACHE_VARIABLES" ) { - std::vector cacheKeys = - this->CacheManager->GetCacheEntryKeys(); - this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); + cmCacheManager::CacheIterator cit = + this->GetCacheManager()->GetCacheIterator(); + for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) + { + if (!output.empty()) + { + output += ";"; + } + output += cit.GetName(); + } + this->SetProperty("CACHE_VARIABLES", output.c_str()); } else if ( prop == "COMMANDS" ) { @@ -2471,7 +2439,7 @@ int cmake::GetSystemInformation(std::vector& args) // we have to find the module directory, so we can copy the files this->AddCMakePaths(); std::string modulesPath = - this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT"); + this->CacheManager->GetCacheValue("CMAKE_ROOT"); modulesPath += "/Modules"; std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; @@ -2681,9 +2649,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, if(t == cmake::AUTHOR_WARNING) { // Allow suppression of these warnings. - const char* suppress = this->CacheManager->GetCacheEntryValue( - "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - if(suppress && cmSystemTools::IsOn(suppress)) + cmCacheManager::CacheIterator it = this->CacheManager + ->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + if(!it.IsAtEnd() && it.GetValueAsBool()) { return; } @@ -2796,42 +2764,38 @@ int cmake::Build(const std::string& dir, } std::string cachePath = dir; cmSystemTools::ConvertToUnixSlashes(cachePath); - if(!this->LoadCache(cachePath)) + cmCacheManager* cachem = this->GetCacheManager(); + cmCacheManager::CacheIterator it = cachem->NewIterator(); + if(!cachem->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; } - const char* cachedGenerator = - this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR"); - if(!cachedGenerator) + if(!it.Find("CMAKE_GENERATOR")) { std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; return 1; } cmsys::auto_ptr gen( - this->CreateGlobalGenerator(cachedGenerator)); + this->CreateGlobalGenerator(it.GetValue())); if(!gen.get()) { std::cerr << "Error: could create CMAKE_GENERATOR \"" - << cachedGenerator << "\"\n"; + << it.GetValue() << "\"\n"; return 1; } std::string output; std::string projName; - const char* cachedProjectName = - this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME"); - if(!cachedProjectName) + if(!it.Find("CMAKE_PROJECT_NAME")) { std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n"; return 1; } - projName = cachedProjectName; + projName = it.GetValue(); bool verbose = false; - const char* cachedVerbose = - this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); - if(cachedVerbose) + if(it.Find("CMAKE_VERBOSE_MAKEFILE")) { - verbose = cmSystemTools::IsOn(cachedVerbose); + verbose = it.GetValueAsBool(); } return gen->Build("", dir, projName, target, diff --git a/Source/cmake.h b/Source/cmake.h index 3acf4a82f..c22b329d7 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -18,11 +18,11 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmInstalledFile.h" -#include "cmCacheManager.h" class cmGlobalGeneratorFactory; class cmGlobalGenerator; class cmLocalGenerator; +class cmCacheManager; class cmMakefile; class cmCommand; class cmVariableWatch; @@ -173,19 +173,7 @@ class cmake int Configure(); int ActualConfigure(); - ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseCacheEntry(const std::string& entry, - std::string& var, - std::string& value, - cmCacheManager::CacheEntryType& type); - int LoadCache(); - bool LoadCache(const std::string& path); - bool LoadCache(const std::string& path, bool internal, - std::set& excludes, - std::set& includes); - bool SaveCache(const std::string& path); - bool DeleteCache(const std::string& path); void PreLoadCMakeFiles(); ///! Create a GlobalGenerator diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 3b518be77..ac73ad079 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -328,31 +328,25 @@ int do_cmake(int ac, char const* const* av) int res = cm.Run(args, view_only); if ( list_cached || list_all_cached ) { + cmCacheManager::CacheIterator it = + cm.GetCacheManager()->GetCacheIterator(); std::cout << "-- Cache values" << std::endl; - std::vector keys = - cm.GetCacheManager()->GetCacheEntryKeys(); - for (std::vector::const_iterator it = keys.begin(); - it != keys.end(); ++it) + for ( it.Begin(); !it.IsAtEnd(); it.Next() ) { - cmCacheManager::CacheEntryType t = - cm.GetCacheManager()->GetCacheEntryType(*it); + cmCacheManager::CacheEntryType t = it.GetType(); if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && t != cmCacheManager::UNINITIALIZED ) { - const char* advancedProp = - cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED"); - if ( list_all_cached || !advancedProp) + bool advanced = it.PropertyExists("ADVANCED"); + if ( list_all_cached || !advanced) { if ( list_help ) { - std::cout << "// " - << cm.GetCacheManager()->GetCacheEntryProperty(*it, - "HELPSTRING") << std::endl; + std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl; } - std::cout << *it << ":" << - cmCacheManager::TypeToString(t) - << "=" << cm.GetCacheManager()->GetCacheEntryValue(*it) - << std::endl; + std::cout << it.GetName() << ":" << + cmCacheManager::TypeToString(it.GetType()) + << "=" << it.GetValue() << std::endl; if ( list_help ) { std::cout << std::endl; From 97c50a8dbd9f1ca5026f60e4a224e9a087e01f0e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:30:21 +0200 Subject: [PATCH 0463/1029] cmMakefile: Simplify GetDefinitions implementation. --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 215ee1614..7f44da252 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2501,20 +2501,20 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const std::vector cmMakefile ::GetDefinitions(int cacheonly /* = 0 */) const { - std::set definitions; + std::vector res; if ( !cacheonly ) { - definitions = this->Internal->VarStack.top().ClosureKeys(); + std::set definitions = + this->Internal->VarStack.top().ClosureKeys(); + res.insert(res.end(), definitions.begin(), definitions.end()); } cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) { - definitions.insert(cit.GetName()); + res.push_back(cit.GetName()); } - - std::vector res; - res.insert(res.end(), definitions.begin(), definitions.end()); + std::sort(res.begin(), res.end()); return res; } From 1f2c12ebd196f3d23aa40d85c965654dbc36d0ad Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 13:32:00 +0200 Subject: [PATCH 0464/1029] cmMakefile: Remove cache version accessors. They are only used by legacy code. Inline them there to simplify cmMakefile. --- Source/cmCPluginAPI.cxx | 6 ++++-- Source/cmMakefile.cxx | 10 ---------- Source/cmMakefile.h | 8 -------- Source/cmUtilitySourceCommand.cxx | 6 ++++-- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 691d80d7e..987a7b17d 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -51,12 +51,14 @@ void CCONV cmSetError(void *info, const char *err) unsigned int CCONV cmGetCacheMajorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetCacheMajorVersion(); + cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); + return manager->GetCacheMajorVersion(); } unsigned int CCONV cmGetCacheMinorVersion(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetCacheMinorVersion(); + cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager(); + return manager->GetCacheMinorVersion(); } unsigned int CCONV cmGetMajorVersion(void *) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7f44da252..ad4ad7c91 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -174,16 +174,6 @@ void cmMakefile::Initialize() this->CheckCMP0000 = false; } -unsigned int cmMakefile::GetCacheMajorVersion() const -{ - return this->GetCacheManager()->GetCacheMajorVersion(); -} - -unsigned int cmMakefile::GetCacheMinorVersion() const -{ - return this->GetCacheManager()->GetCacheMinorVersion(); -} - cmMakefile::~cmMakefile() { cmDeleteAll(this->InstallGenerators); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 920b6b79d..5209891d2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -62,14 +62,6 @@ class cmMakefile class Internals; cmsys::auto_ptr Internal; public: - /** - * Return the major and minor version of the cmake that - * was used to write the currently loaded cache, note - * this method will not work before the cache is loaded. - */ - unsigned int GetCacheMajorVersion() const; - unsigned int GetCacheMinorVersion() const; - /* Check for unused variables in this scope */ void CheckForUnusedVariables() const; /* Mark a variable as used */ diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index ee1ff291a..2799a9be5 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -52,11 +52,13 @@ bool cmUtilitySourceCommand } else { + cmCacheManager *manager = + this->Makefile->GetCMakeInstance()->GetCacheManager(); haveCacheValue = (cacheValue && (strstr(cacheValue, "(IntDir)") == 0 || (intDir && strcmp(intDir, "$(IntDir)") == 0)) && - (this->Makefile->GetCacheMajorVersion() != 0 && - this->Makefile->GetCacheMinorVersion() != 0 )); + (manager->GetCacheMajorVersion() != 0 && + manager->GetCacheMinorVersion() != 0 )); } if(haveCacheValue) From 14973054a2f3954111789cda5e54c2e2e2175521 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 00:07:04 +0200 Subject: [PATCH 0465/1029] Add API for cache loading, deleting and saving to the cmake class. Migrate existing users of the CacheManager API to use the new API. The CacheManager will be going away soon. --- Source/CTest/cmCTestBuildAndTestHandler.cxx | 3 +- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/QtDialog/QCMake.cxx | 10 +++--- Source/cmCTest.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 4 +-- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLoadCacheCommand.cxx | 6 ++-- Source/cmake.cxx | 39 ++++++++++++++++++--- Source/cmake.h | 14 +++++++- 9 files changed, 61 insertions(+), 21 deletions(-) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 08270375e..586070b87 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -18,7 +18,6 @@ #include "cmGlobalGenerator.h" #include #include "cmCTestTestHandler.h" -#include "cmCacheManager.h" //---------------------------------------------------------------------- cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() @@ -255,7 +254,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. - cm.GetCacheManager()->LoadCache(this->BinaryDir); + cm.LoadCache(this->BinaryDir); } else { diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index d60062e5b..1217bda19 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -639,7 +639,7 @@ int cmCursesMainForm::Configure(int noconfigure) // always save the current gui values to disk this->FillCacheManagerFromUI(); - this->CMakeInstance->GetCacheManager()->SaveCache( + this->CMakeInstance->SaveCache( this->CMakeInstance->GetHomeOutputDirectory()); this->LoadCache(0); diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 996aa75fe..3df48d177 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -96,7 +96,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) emit this->binaryDirChanged(this->BinaryDirectory); cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); this->setGenerator(QString()); - if(!this->CMakeInstance->GetCacheManager()->LoadCache( + if(!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { QDir testDir(this->BinaryDirectory); @@ -270,7 +270,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) } } - cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data()); } QCMakePropertyList QCMake::properties() const @@ -397,9 +397,9 @@ QStringList QCMake::availableGenerators() const void QCMake::deleteCache() { // delete cache - this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data()); // reload to make our cache empty - this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit no generator and no properties this->setGenerator(QString()); QCMakePropertyList props = this->properties(); @@ -412,7 +412,7 @@ void QCMake::reloadCache() QCMakePropertyList props; emit this->propertiesChanged(props); // reload - this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); + this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data()); // emit new cache properties props = this->properties(); emit this->propertiesChanged(props); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index df61fe6bf..1db057bd1 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2281,7 +2281,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if (cmCacheManager::ParseEntry(arg, name, value, type)) + if (cmake::ParseCacheEntry(arg, name, value, type)) { this->Definitions[name] = value; return true; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index d64b0d74c..810ec57ee 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -223,7 +223,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); - mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } else if (envVarValue==0 && cacheValue!=0) { @@ -244,7 +244,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); - mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5e584a452..0561a0542 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3703,7 +3703,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, // Since this call may have created new cache entries, save the cache: // - root->GetMakefile()->GetCacheManager()->SaveCache( + root->GetMakefile()->GetCMakeInstance()->SaveCache( root->GetMakefile()->GetHomeOutputDirectory()); } diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 93aec3220..e2ae90111 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -81,8 +81,8 @@ bool cmLoadCacheCommand { break; } - this->Makefile->GetCacheManager()->LoadCache(args[i], false, - excludes, includes); + this->Makefile->GetCMakeInstance()->LoadCache(args[i], false, + excludes, includes); } @@ -173,7 +173,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) std::string var; std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if(cmCacheManager::ParseEntry(line, var, value, type)) + if(cmake::ParseCacheEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. if(this->VariablesToRead.find(var) != this->VariablesToRead.end()) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c52a1a2d..e78141799 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -917,7 +917,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) { cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(cachem->LoadCache(cachePath) && + if(this->LoadCache(cachePath) && it.Find("CMAKE_HOME_DIRECTORY")) { this->SetHomeOutputDirectory(cachePath); @@ -1860,10 +1860,18 @@ void cmake::AddDefaultGenerators() #endif } +bool cmake::ParseCacheEntry(const std::string& entry, + std::string& var, + std::string& value, + cmCacheManager::CacheEntryType& type) +{ + return cmCacheManager::ParseEntry(entry, var, value, type); +} + int cmake::LoadCache() { // could we not read the cache - if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory())) + if (!this->LoadCache(this->GetHomeOutputDirectory())) { // if it does exist, but isn't readable then warn the user std::string cacheFile = this->GetHomeOutputDirectory(); @@ -1886,6 +1894,28 @@ int cmake::LoadCache() return 0; } +bool cmake::LoadCache(const std::string& path) +{ + return this->CacheManager->LoadCache(path); +} + +bool cmake::LoadCache(const std::string& path, bool internal, + std::set& excludes, + std::set& includes) +{ + return this->CacheManager->LoadCache(path, internal, excludes, includes); +} + +bool cmake::SaveCache(const std::string& path) +{ + return this->CacheManager->SaveCache(path); +} + +bool cmake::DeleteCache(const std::string& path) +{ + return this->CacheManager->DeleteCache(path); +} + void cmake::SetProgressCallback(ProgressCallbackType f, void *cd) { this->ProgressCallback = f; @@ -2764,9 +2794,8 @@ int cmake::Build(const std::string& dir, } std::string cachePath = dir; cmSystemTools::ConvertToUnixSlashes(cachePath); - cmCacheManager* cachem = this->GetCacheManager(); - cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(!cachem->LoadCache(cachePath)) + cmCacheManager::CacheIterator it = this->GetCacheManager()->NewIterator(); + if(!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; diff --git a/Source/cmake.h b/Source/cmake.h index c22b329d7..3acf4a82f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -18,11 +18,11 @@ #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmInstalledFile.h" +#include "cmCacheManager.h" class cmGlobalGeneratorFactory; class cmGlobalGenerator; class cmLocalGenerator; -class cmCacheManager; class cmMakefile; class cmCommand; class cmVariableWatch; @@ -173,7 +173,19 @@ class cmake int Configure(); int ActualConfigure(); + ///! Break up a line like VAR:type="value" into var, type and value + static bool ParseCacheEntry(const std::string& entry, + std::string& var, + std::string& value, + cmCacheManager::CacheEntryType& type); + int LoadCache(); + bool LoadCache(const std::string& path); + bool LoadCache(const std::string& path, bool internal, + std::set& excludes, + std::set& includes); + bool SaveCache(const std::string& path); + bool DeleteCache(const std::string& path); void PreLoadCMakeFiles(); ///! Create a GlobalGenerator From 77f2807ce56491fab7637327564c7fb1033dadb1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 10:28:34 +0200 Subject: [PATCH 0466/1029] cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue. Being initialized is a requirement for this method to return something, and is what differentiates it from using GetIterator with it.GetValue. --- Source/QtDialog/QCMake.cxx | 3 +- Source/cmCacheManager.cxx | 16 +++++--- Source/cmCacheManager.h | 2 +- Source/cmCommandArgumentParserHelper.cxx | 3 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 6 +-- Source/cmMakefile.cxx | 9 +++-- Source/cmake.cxx | 47 ++++++++++++++---------- 8 files changed, 51 insertions(+), 37 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 3df48d177..009d06e2c 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -117,7 +117,8 @@ void QCMake::setBinaryDirectory(const QString& _dir) } if ( itm.Find("CMAKE_GENERATOR")) { - const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR"); + const char* extraGen = cachem + ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index b8dfe04c7..5387d0c81 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -283,14 +283,16 @@ bool cmCacheManager::LoadCache(const std::string& path, } this->CacheMajorVersion = 0; this->CacheMinorVersion = 0; - if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION")) + if(const char* cmajor = + this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION")) { unsigned int v=0; if(sscanf(cmajor, "%u", &v) == 1) { this->CacheMajorVersion = v; } - if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION")) + if(const char* cminor = + this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION")) { if(sscanf(cminor, "%u", &v) == 1) { @@ -312,10 +314,11 @@ bool cmCacheManager::LoadCache(const std::string& path, } // check to make sure the cache directory has not // been moved - if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") ) + const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR"); + if (internal && oldDir) { std::string currentcwd = path; - std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR"); + std::string oldcwd = oldDir; cmSystemTools::ConvertToUnixSlashes(currentcwd); currentcwd += "/CMakeCache.txt"; oldcwd += "/CMakeCache.txt"; @@ -324,7 +327,7 @@ bool cmCacheManager::LoadCache(const std::string& path, std::string message = std::string("The current CMakeCache.txt directory ") + currentcwd + std::string(" is different than the directory ") + - std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + + std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) + std::string(" where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); @@ -654,7 +657,8 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( return CacheIterator(*this, key); } -const char* cmCacheManager::GetCacheValue(const std::string& key) const +const char* +cmCacheManager::GetInitializedCacheValue(const std::string& key) const { CacheEntryMap::const_iterator i = this->Cache.find(key); if(i != this->Cache.end() && diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index f7f877606..31d302ac9 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -137,7 +137,7 @@ public: CacheEntryType& type); ///! Get a value from the cache given a key - const char* GetCacheValue(const std::string& key) const; + const char* GetInitializedCacheValue(const std::string& key) const; /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 747b7e434..99bf5f55f 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -90,7 +90,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } if ( strcmp(key, "CACHE") == 0 ) { - if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var)) + if(const char* c = this->Makefile->GetCacheManager() + ->GetInitializedCacheValue(var)) { if(this->EscapeQuotes) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 810ec57ee..0d32e4bac 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; cacheEntryName += envVar; - const char* cacheValue = mf->GetCacheManager()->GetCacheValue( + const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue( cacheEntryName); // now we have both, decide which one to use diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3c0a0e244..f23caa6ae 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -179,7 +179,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, return; } const char* cname = this->GetCMakeInstance()-> - GetCacheManager()->GetCacheValue(langComp); + GetCacheManager()->GetInitializedCacheValue(langComp); std::string changeVars; if(cname && !optional) { @@ -1641,7 +1641,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, // and there is a good chance that the try compile stuff will // take the bulk of the time, so try and guess some progress // by getting closer and closer to 100 without actually getting there. - if (!this->CMakeInstance->GetCacheManager()->GetCacheValue + if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) { // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set @@ -1839,7 +1839,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) // update progress // estimate how many lg there will be const char *numGenC = - this->CMakeInstance->GetCacheManager()->GetCacheValue + this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); if (!numGenC) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ad4ad7c91..b6eff3dac 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2432,7 +2432,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const this->Internal->VarUsageStack.top().insert(name); if(!def) { - def = this->GetCacheManager()->GetCacheValue(name); + def = this->GetCacheManager()->GetInitializedCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE if(cmVariableWatch* vv = this->GetVariableWatch()) @@ -2457,7 +2457,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const const char* def = this->Internal->VarStack.top().Get(name); if(!def) { - def = this->GetCacheManager()->GetCacheValue(name); + def = this->GetCacheManager()->GetInitializedCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE cmVariableWatch* vv = this->GetVariableWatch(); @@ -2835,7 +2835,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( value = cmSystemTools::GetEnv(lookup.c_str()); break; case CACHE: - value = this->GetCacheManager()->GetCacheValue(lookup); + value = this->GetCacheManager() + ->GetInitializedCacheValue(lookup); break; } // Get the string we're meant to append to. @@ -4903,7 +4904,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, (status == cmPolicies::WARN || status == cmPolicies::OLD)) { if(!(this->GetCacheManager() - ->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) { // Set it to 2.4 because that is the last version where the // variable had meaning. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e78141799..210c0ef33 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -344,7 +344,8 @@ bool cmake::SetCacheArgs(const std::vector& args) std::string cachedValue; if(this->WarnUnusedCli) { - if(const char *v = this->CacheManager->GetCacheValue(var)) + if(const char *v = this->CacheManager + ->GetInitializedCacheValue(var)) { haveValue = true; cachedValue = v; @@ -357,7 +358,8 @@ bool cmake::SetCacheArgs(const std::vector& args) if(this->WarnUnusedCli) { if (!haveValue || - cachedValue != this->CacheManager->GetCacheValue(var)) + cachedValue != this->CacheManager + ->GetInitializedCacheValue(var)) { this->WatchUnusedCli(var); } @@ -1203,10 +1205,10 @@ int cmake::DoPreConfigureChecks() } // do a sanity check on some values - if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY")) + if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) { std::string cacheStart = - this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); + this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); currentStart += "/CMakeLists.txt"; @@ -1355,9 +1357,9 @@ int cmake::ActualConfigure() if(!this->GlobalGenerator) { const char* genName = - this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); + this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"); const char* extraGenName = - this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR"); + this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); if(genName) { std::string fullName = cmExternalMakefileProjectGenerator:: @@ -1435,7 +1437,8 @@ int cmake::ActualConfigure() } } - const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR"); + const char* genName = this->CacheManager + ->GetInitializedCacheValue("CMAKE_GENERATOR"); if(genName) { if(!this->GlobalGenerator->MatchesGeneratorName(genName)) @@ -1451,7 +1454,7 @@ int cmake::ActualConfigure() return -2; } } - if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR")) + if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR")) { this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), @@ -1464,7 +1467,7 @@ int cmake::ActualConfigure() } if(const char* platformName = - this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM")) + this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) { if(this->GeneratorPlatform.empty()) { @@ -1492,7 +1495,7 @@ int cmake::ActualConfigure() } if(const char* tsName = - this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET")) + this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) { if(this->GeneratorToolset.empty()) { @@ -1546,16 +1549,18 @@ int cmake::ActualConfigure() // project requires compatibility with CMake 2.4. We detect this // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY // variable created when CMP0001 is not set to NEW. - if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) + if(this->GetCacheManager() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { - if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH")) + if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) { this->CacheManager->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", cmCacheManager::PATH); } - if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH")) + if(!this->CacheManager + ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { this->CacheManager->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", @@ -1563,7 +1568,8 @@ int cmake::ActualConfigure() cmCacheManager::PATH); } } - if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS")) + if(!this->CacheManager + ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) { this->CacheManager->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", @@ -1578,9 +1584,9 @@ int cmake::ActualConfigure() } if(cmSystemTools::GetFatalErrorOccured() && - (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") || + (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") || cmSystemTools::IsOff(this->CacheManager-> - GetCacheValue("CMAKE_MAKE_PROGRAM")))) + GetInitializedCacheValue("CMAKE_MAKE_PROGRAM")))) { // We must have a bad generator selection. Wipe the cache entry so the // user can select another. @@ -1796,7 +1802,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, const char* cmake::GetCacheDefinition(const std::string& name) const { - return this->CacheManager->GetCacheValue(name); + return this->CacheManager->GetInitializedCacheValue(name); } void cmake::AddDefaultCommands() @@ -1956,7 +1962,8 @@ void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: const char* tablepath = - this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE"); + this->CacheManager + ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if(tablepath) { @@ -2190,7 +2197,7 @@ void cmake::TruncateOutputLog(const char* fname) { return; } - if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") ) + if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") ) { cmSystemTools::RemoveFile(fullPath); return; @@ -2469,7 +2476,7 @@ int cmake::GetSystemInformation(std::vector& args) // we have to find the module directory, so we can copy the files this->AddCMakePaths(); std::string modulesPath = - this->CacheManager->GetCacheValue("CMAKE_ROOT"); + this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT"); modulesPath += "/Modules"; std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; From bddd8c055104d7c66b01799a4c99a2bbb6da8f00 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 8 Apr 2015 00:01:05 -0400 Subject: [PATCH 0467/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eed106d9c..5214832aa 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150407) +set(CMake_VERSION_PATCH 20150408) #set(CMake_VERSION_RC 1) From e942526b3d9e886da4ce832d9d3adb99cc5ede2f Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sat, 28 Mar 2015 14:18:38 -0400 Subject: [PATCH 0468/1029] try_run: Use CMAKE_CROSSCOMPILING_EMULATOR. If the CMAKE_CROSSCOMPILING_EMULATOR variable is defined, and CMAKE_CROSSCOMPILING is TRUE, then use CMAKE_CROSSCOMPILING_EMULATOR to run the try_run executables. This prevents the need to populate TryRunResults.cmake when cross compiling. --- Help/command/try_run.rst | 3 ++- .../CMAKE_CROSSCOMPILING_EMULATOR.rst | 11 ++++++-- Source/cmTryRunCommand.cxx | 26 +++++++++++++++++-- .../CrosscompilingEmulator/RunCMakeTest.cmake | 1 + .../CrosscompilingEmulator/TryRun-stdout.txt | 1 + .../CrosscompilingEmulator/TryRun.cmake | 18 +++++++++++++ .../CrosscompilingEmulator/simple_src.cxx | 2 +- 7 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 Tests/RunCMake/CrosscompilingEmulator/TryRun-stdout.txt create mode 100644 Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index 43ee21960..e3bd57d50 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -73,7 +73,8 @@ When cross compiling, the executable compiled in the first step usually cannot be run on the build host. The ``try_run`` command checks the :variable:`CMAKE_CROSSCOMPILING` variable to detect whether CMake is in cross-compiling mode. If that is the case, it will still try to compile -the executable, but it will not try to run the executable. Instead it +the executable, but it will not try to run the executable unless the +:variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable is set. Instead it will create cache variables which must be filled by the user or by presetting them in some CMake script file to the values the executable would have produced if it had been run on its actual target platform. diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst index fa6f1b743..95d2c7ffc 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -1,5 +1,12 @@ CMAKE_CROSSCOMPILING_EMULATOR ----------------------------- -Default value for the :prop_tgt:`CROSSCOMPILING_EMULATOR` target property of -executables. See that target property for additional information. +This variable is only used when :variable:`CMAKE_CROSSCOMPILING` is on. It +should point to a command on the host system that can run executable built +for the target system. + +The command will be used to run :command:`try_run` generated executables, +which avoids manual population of the TryRunResults.cmake file. + +It is also used as the default value for the +:prop_tgt:`CROSSCOMPILING_EMULATOR` target property of executables. diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index b5280cfd7..8b68d64c1 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -149,7 +149,8 @@ bool cmTryRunCommand { // "run" it and capture the output std::string runOutputContents; - if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING")) + if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") && + !this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR")) { this->DoNotRunExecutable(runArgs, argv[3], @@ -195,7 +196,28 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, std::string* out) { int retVal = -1; - std::string finalCommand = cmSystemTools::ConvertToRunCommandPath( + + std::string finalCommand; + const std::string emulator = + this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR"); + if (!emulator.empty()) + { + std::vector emulatorWithArgs; + cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); + finalCommand += cmSystemTools::ConvertToRunCommandPath( + emulatorWithArgs[0].c_str()); + finalCommand += " "; + for (std::vector::const_iterator ei = + emulatorWithArgs.begin()+1; + ei != emulatorWithArgs.end(); ++ei) + { + finalCommand += "\""; + finalCommand += *ei; + finalCommand += "\""; + finalCommand += " "; + } + } + finalCommand += cmSystemTools::ConvertToRunCommandPath( this->OutputFile.c_str()); if (!runArgs.empty()) { diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index cecc57f86..04fb7db84 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -4,3 +4,4 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR}") run_cmake(CrosscompilingEmulatorProperty) +run_cmake(TryRun) diff --git a/Tests/RunCMake/CrosscompilingEmulator/TryRun-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/TryRun-stdout.txt new file mode 100644 index 000000000..d012974b5 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/TryRun-stdout.txt @@ -0,0 +1 @@ +run_result: 42 diff --git a/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake b/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake new file mode 100644 index 000000000..4851cc778 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake @@ -0,0 +1,18 @@ +set(CMAKE_CROSSCOMPILING 1) + +try_run(run_result compile_result + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/simple_src.cxx + RUN_OUTPUT_VARIABLE run_output) + +message(STATUS "run_output: ${run_output}") +message(STATUS "run_result: ${run_result}") + +set(CMAKE_CROSSCOMPILING_EMULATOR ${CMAKE_CROSSCOMPILING_EMULATOR} + --flag + "multi arg") +try_run(run_result compile_result + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/simple_src.cxx + RUN_OUTPUT_VARIABLE run_output) +message(STATUS "Emulator with arguments run_output: ${run_output}") diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx index 630adc6bc..e5e94f27e 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx +++ b/Tests/RunCMake/CrosscompilingEmulator/simple_src.cxx @@ -1,4 +1,4 @@ int main(int, char **) { - return 0; + return 13; } From 9160d6c241adaeacc106d5b2ce4530f223345f22 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sat, 28 Mar 2015 22:05:35 -0400 Subject: [PATCH 0469/1029] TestGenerator: Add CROSSCOMPILING_EMULATOR support. Prefix test commands with the CROSSCOMPILING_EMULATOR property for target executables. This allows test suites to be run on the host when crosscompiling. --- Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst | 4 +++- Source/cmTestGenerator.cxx | 21 ++++++++++++++++++- .../AddTest-check.cmake | 12 +++++++++++ .../CrosscompilingEmulator/AddTest.cmake | 8 +++++++ .../InitialCache.txt.in | 1 + .../CrosscompilingEmulator/RunCMakeTest.cmake | 1 + 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake create mode 100644 Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in diff --git a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst index 2b5fd4d3d..3ef8e0308 100644 --- a/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst +++ b/Help/prop_tgt/CROSSCOMPILING_EMULATOR.rst @@ -1,4 +1,6 @@ CROSSCOMPILING_EMULATOR ----------------------- -Use the given emulator to run executables created when crosscompiling. +Use the given emulator to run executables created when crosscompiling. This +command will be added as a prefix to :command:`add_test` test commands for +built target system executables. diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index f87a5353f..add80fa68 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -82,11 +82,31 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // be translated. std::string exe = command[0]; cmMakefile* mf = this->Test->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); cmTarget* target = mf->FindTargetToUse(exe); if(target && target->GetType() == cmTarget::EXECUTABLE) { // Use the target file on disk. exe = target->GetFullPath(config); + + // Prepend with the emulator when cross compiling if required. + const char * emulator = + target->GetProperty("CROSSCOMPILING_EMULATOR"); + if (emulator != 0) + { + std::vector emulatorWithArgs; + cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); + std::string emulatorExe(emulatorWithArgs[0]); + cmSystemTools::ConvertToUnixSlashes(emulatorExe); + os << lg->EscapeForCMake(emulatorExe) << " "; + for(std::vector::const_iterator ei = + emulatorWithArgs.begin()+1; + ei != emulatorWithArgs.end(); + ++ei) + { + os << lg->EscapeForCMake(*ei) << " "; + } + } } else { @@ -96,7 +116,6 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } // Generate the command line with full escapes. - cmLocalGenerator* lg = mf->GetLocalGenerator(); os << lg->EscapeForCMake(exe); for(std::vector::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake new file mode 100644 index 000000000..0aae06cc7 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake @@ -0,0 +1,12 @@ +set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake") +if(EXISTS "${testfile}") + file(READ "${testfile}" testfile_contents) +else() + message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.") +endif() +if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator ^(pseudo_emulator)+$") + message(SEND_ERROR "Used emulator when it should not be used.") +endif() +if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator .+pseudo_emulator.+$") + message(SEND_ERROR "Did not use emulator when it should be used.") +endif() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake new file mode 100644 index 000000000..41850f267 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake @@ -0,0 +1,8 @@ +set(CMAKE_CROSSCOMPILING 1) +enable_testing() +add_test(NAME DoesNotUseEmulator + COMMAND ${CMAKE_COMMAND} -E echo "Hi") + +add_executable(generated_exe simple_src.cxx) +add_test(NAME UsesEmulator + COMMAND generated_exe) diff --git a/Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in b/Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in new file mode 100644 index 000000000..c95fd8bb1 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in @@ -0,0 +1 @@ +CMAKE_EMULATOR:STRING=@PSEUDO_EMULATOR@ diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index 04fb7db84..2581cfcc2 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -5,3 +5,4 @@ set(RunCMake_TEST_OPTIONS run_cmake(CrosscompilingEmulatorProperty) run_cmake(TryRun) +run_cmake(AddTest) From 1975d53ae19c46ee4f7384cc96be355f7e94df61 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Apr 2015 09:03:45 -0400 Subject: [PATCH 0470/1029] Help: Add notes for topic 'emulator-property' --- Help/release/dev/emulator-property.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/emulator-property.rst diff --git a/Help/release/dev/emulator-property.rst b/Help/release/dev/emulator-property.rst new file mode 100644 index 000000000..1bc2f2d97 --- /dev/null +++ b/Help/release/dev/emulator-property.rst @@ -0,0 +1,7 @@ +emulator-property +----------------- + +* A :prop_tgt:`CROSSCOMPILING_EMULATOR` target property and supporting + :variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable were introduced + to allow target platform binaries to run on the host during cross + compiling. From 60a62a91c4c67859d8e8f51aafcf0eb929edc036 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Apr 2015 18:43:46 +0200 Subject: [PATCH 0471/1029] cmCacheManager: Return a C string from GetValue. This is for consistency with other CMake access interfaces such as definitions and properties which use a null value as a 'not present' value. It is source compatible with existing callers, and it returns a pointer into actual real cache entry storage. --- Source/cmCacheManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 31d302ac9..d2712bb5e 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -65,7 +65,7 @@ public: void AppendProperty(const std::string& property, const char* value, bool asString=false); void SetProperty(const std::string& property, bool value); - std::string GetValue() const { return this->GetEntry().Value; } + const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); CacheEntryType GetType() const { return this->GetEntry().Type; } From 1e2dbfce37acd1b7e7dc5bb1b45d71c5ac0c3599 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 19:50:05 +0200 Subject: [PATCH 0472/1029] cmCacheManager: Add non-iterator-based API. The iterator pattern is an unusual one for CMake, and it hinders refactoring all configuration-time data manipulation into a single class. --- Source/cmCacheManager.h | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index d2712bb5e..3b02fa6c5 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -139,6 +139,81 @@ public: ///! Get a value from the cache given a key const char* GetInitializedCacheValue(const std::string& key) const; + const char* GetCacheEntryValue(const std::string& key) + { + cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str()); + if (it.IsAtEnd()) + { + return 0; + } + return it.GetValue(); + } + + const char* GetCacheEntryProperty(std::string const& key, + std::string const& propName) + { + return this->GetCacheIterator(key.c_str()).GetProperty(propName); + } + + CacheEntryType GetCacheEntryType(std::string const& key) + { + return this->GetCacheIterator(key.c_str()).GetType(); + } + + bool GetCacheEntryPropertyAsBool(std::string const& key, + std::string const& propName) + { + return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName); + } + + void SetCacheEntryProperty(std::string const& key, + std::string const& propName, + std::string const& value) + { + this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str()); + } + + void SetCacheEntryBoolProperty(std::string const& key, + std::string const& propName, + bool value) + { + this->GetCacheIterator(key.c_str()).SetProperty(propName, value); + } + + void SetCacheEntryValue(std::string const& key, + std::string const& value) + { + this->GetCacheIterator(key.c_str()).SetValue(value.c_str()); + } + + void RemoveCacheEntryProperty(std::string const& key, + std::string const& propName) + { + this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0); + } + + void AppendCacheEntryProperty(std::string const& key, + std::string const& propName, + std::string const& value, + bool asString = false) + { + this->GetCacheIterator(key.c_str()).AppendProperty(propName, + value.c_str(), + asString); + } + + std::vector GetCacheEntryKeys() + { + std::vector definitions; + definitions.reserve(this->GetSize()); + cmCacheManager::CacheIterator cit = this->GetCacheIterator(); + for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) + { + definitions.push_back(cit.GetName()); + } + return definitions; + } + /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const { return this->CacheMajorVersion; } From 9e64156725e431ae15ce92be4e470cae6edf5bd6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 10:46:25 +0200 Subject: [PATCH 0473/1029] cmMakefile: Port away from CacheEntry.Initialized. The API has no other external users. --- Source/cmMakefile.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b6eff3dac..7c1b9c454 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1810,16 +1810,17 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, { bool haveVal = value ? true : false; std::string val = haveVal ? value : ""; - cmCacheManager::CacheIterator it = - this->GetCacheManager()->GetCacheIterator(name.c_str()); - if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && - it.Initialized()) + const char* existingValue = + this->GetCacheManager()->GetInitializedCacheValue(name); + if(existingValue + && (this->GetCacheManager()->GetCacheEntryType(name) + == cmCacheManager::UNINITIALIZED)) { // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in if(!force) { - val = it.GetValue(); + val = existingValue; haveVal = true; } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) @@ -1842,7 +1843,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); - val = it.GetValue(); + val = this->GetCacheManager()->GetInitializedCacheValue(name); haveVal = true; } From 3e6a76e48b93b2756cd3e1f28941c79c5a8f9709 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:01:35 +0200 Subject: [PATCH 0474/1029] Port CursesDialog to non-iterator cache API. --- .../cmCursesCacheEntryComposite.cxx | 35 ++-- .../cmCursesCacheEntryComposite.h | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 149 +++++++++++------- 3 files changed, 110 insertions(+), 76 deletions(-) diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 682f95f9e..4f028c42a 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -18,6 +18,9 @@ #include "cmCursesFilePathWidget.h" #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" +#include "../cmake.h" + +#include cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( const std::string& key, @@ -32,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, + const std::string& key, cmake *cm, bool isNew, int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { @@ -47,11 +50,13 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } this->Entry = 0; - switch ( it.GetType() ) + const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); + assert(value); + switch (cm->GetCacheManager()->GetCacheEntryType(key)) { - case cmCacheManager::BOOL: + case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); - if (cmSystemTools::IsOn(it.GetValue().c_str())) + if (cmSystemTools::IsOn(value)) { static_cast(this->Entry)->SetValueAsBool(true); } @@ -62,40 +67,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( break; case cmCacheManager::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString( - it.GetValue()); + static_cast(this->Entry)->SetString(value); break; case cmCacheManager::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString( - it.GetValue()); + static_cast(this->Entry)->SetString(value); break; case cmCacheManager::STRING: - if(it.PropertyExists("STRINGS")) + { + const char* stringsProp = cm->GetCacheManager() + ->GetCacheEntryProperty(key, "STRINGS"); + if(stringsProp) { cmCursesOptionsWidget* ow = new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1); this->Entry = ow; std::vector options; - cmSystemTools::ExpandListArgument( - std::string(it.GetProperty("STRINGS")), options); + cmSystemTools::ExpandListArgument(stringsProp, options); for(std::vector::iterator si = options.begin(); si != options.end(); ++si) { ow->AddOption(*si); } - ow->SetOption(it.GetValue()); + ow->SetOption(value); } else { this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); - static_cast(this->Entry)->SetString( - it.GetValue()); + static_cast(this->Entry)->SetString(value); } break; + } case cmCacheManager::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", - it.GetName().c_str()); + key.c_str()); break; default: // TODO : put warning message here diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 7cdf13bad..dc4ee4af0 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -21,7 +21,7 @@ public: cmCursesCacheEntryComposite(const std::string& key, int labelwidth, int entrywidth); cmCursesCacheEntryComposite(const std::string& key, - const cmCacheManager::CacheIterator& it, + cmake *cm, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 1217bda19..833d54038 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -111,13 +111,17 @@ void cmCursesMainForm::InitializeUI() // Count non-internal and non-static entries int count=0; - for(cmCacheManager::CacheIterator i = - this->CMakeInstance->GetCacheManager()->NewIterator(); - !i.IsAtEnd(); i.Next()) + std::vector cacheKeys = + this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys(); + + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - if ( i.GetType() != cmCacheManager::INTERNAL && - i.GetType() != cmCacheManager::STATIC && - i.GetType() != cmCacheManager::UNINITIALIZED) + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(*it); + if (t != cmCacheManager::INTERNAL && + t != cmCacheManager::STATIC && + t != cmCacheManager::UNINITIALIZED) { ++count; } @@ -139,45 +143,49 @@ void cmCursesMainForm::InitializeUI() // Create the composites. // First add entries which are new - for(cmCacheManager::CacheIterator i = - this->CMakeInstance->GetCacheManager()->NewIterator(); - !i.IsAtEnd(); i.Next()) + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - std::string key = i.GetName(); - if ( i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED ) + std::string key = *it; + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(*it); + if (t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC || + t == cmCacheManager::UNINITIALIZED ) { continue; } if (!this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, i, - true, 30, - entrywidth)); + newEntries->push_back(new cmCursesCacheEntryComposite(key, + this->CMakeInstance, + true, 30, + entrywidth)); this->OkToGenerate = false; } } // then add entries which are old - for(cmCacheManager::CacheIterator i = - this->CMakeInstance->GetCacheManager()->NewIterator(); - !i.IsAtEnd(); i.Next()) + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - std::string key = i.GetName(); - if ( i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED ) + std::string key = *it; + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(*it); + if (t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC || + t == cmCacheManager::UNINITIALIZED ) { continue; } if (this->LookForCacheEntry(key)) { - newEntries->push_back(new cmCursesCacheEntryComposite(key, i, - false, 30, - entrywidth)); + newEntries->push_back(new cmCursesCacheEntryComposite(key, + this->CMakeInstance, + false, 30, + entrywidth)); } } } @@ -216,10 +224,13 @@ void cmCursesMainForm::RePost() std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -245,10 +256,13 @@ void cmCursesMainForm::RePost() std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -314,10 +328,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -334,10 +351,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - cmCacheManager::CacheIterator mit = - this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); - if (mit.IsAtEnd() || - (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue((*it)->GetValue()); + bool advanced = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); + if (!existingValue || (!this->AdvancedMode && advanced)) { continue; } @@ -495,11 +515,12 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // Get the help string of the current entry // and add it to the help string - cmCacheManager::CacheIterator it = - this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField); - if (!it.IsAtEnd()) + const char* existingValue = + this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField); + if (existingValue) { - const char* hs = it.GetProperty("HELPSTRING"); + const char* hs = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryProperty(curField, "HELPSTRING"); if ( hs ) { strncpy(help, hs, 127); @@ -792,23 +813,28 @@ void cmCursesMainForm::FillCacheManagerFromUI() size_t size = this->Entries->size(); for(size_t i=0; i < size; i++) { - cmCacheManager::CacheIterator it = - this->CMakeInstance->GetCacheManager()->GetCacheIterator( - (*this->Entries)[i]->Key.c_str()); - if (!it.IsAtEnd()) + std::string cacheKey = (*this->Entries)[i]->Key; + const char* existingValue = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue(cacheKey); + if (existingValue) { - std::string oldValue = it.GetValue(); + std::string oldValue = existingValue; std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - this->FixValue(it.GetType(), oldValue, fixedOldValue); - this->FixValue(it.GetType(), newValue, fixedNewValue); + cmCacheManager::CacheEntryType t = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryType(cacheKey); + this->FixValue(t, oldValue, fixedOldValue); + this->FixValue(t, newValue, fixedNewValue); if(!(fixedOldValue == fixedNewValue)) { // The user has changed the value. Mark it as modified. - it.SetProperty("MODIFIED", true); - it.SetValue(fixedNewValue.c_str()); + this->CMakeInstance->GetCacheManager() + ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true); + this->CMakeInstance->GetCacheManager() + ->SetCacheEntryValue(cacheKey, fixedNewValue); } } } @@ -1017,12 +1043,15 @@ void cmCursesMainForm::HandleInput() cmCursesWidget* lbl = reinterpret_cast(field_userptr( this->Fields[findex-2])); const char* curField = lbl->GetValue(); - const char* helpString=0; - cmCacheManager::CacheIterator it = - this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField); - if (!it.IsAtEnd()) + const char* helpString = 0; + + const char* existingValue = + this->CMakeInstance->GetCacheManager() + ->GetCacheEntryValue(curField); + if (existingValue) { - helpString = it.GetProperty("HELPSTRING"); + helpString = this->CMakeInstance->GetCacheManager() + ->GetCacheEntryProperty(curField, "HELPSTRING"); } if (helpString) { From f3922a9a5b463420db5f7fae08efdf1b4abdfe5e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:14:40 +0200 Subject: [PATCH 0475/1029] Port QtDialog to non-iterator cache API. --- Source/QtDialog/QCMake.cxx | 72 +++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 009d06e2c..08d53ce27 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -110,17 +110,18 @@ void QCMake::setBinaryDirectory(const QString& _dir) QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); - cmCacheManager::CacheIterator itm = cachem->NewIterator(); - if ( itm.Find("CMAKE_HOME_DIRECTORY")) + const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + if (homeDir) { - setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str())); + setSourceDirectory(QString::fromLocal8Bit(homeDir)); } - if ( itm.Find("CMAKE_GENERATOR")) + const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR"); + if (gen) { const char* extraGen = cachem ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : ""); + CreateFullGeneratorName(gen, extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } } @@ -195,33 +196,35 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) // set the value of properties cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - for(cmCacheManager::CacheIterator i = cachem->NewIterator(); - !i.IsAtEnd(); i.Next()) + std::vector cacheKeys = cachem->GetCacheEntryKeys(); + for(std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - - if(i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC) + cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it); + if(t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC) { continue; } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); + prop.Key = QString::fromLocal8Bit(it->c_str()); int idx = props.indexOf(prop); if(idx == -1) { - toremove.append(QString::fromLocal8Bit(i.GetName().c_str())); + toremove.append(QString::fromLocal8Bit(it->c_str())); } else { prop = props[idx]; if(prop.Value.type() == QVariant::Bool) { - i.SetValue(prop.Value.toBool() ? "ON" : "OFF"); + cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF"); } else { - i.SetValue(prop.Value.toString().toLocal8Bit().data()); + cachem->SetCacheEntryValue(*it, + prop.Value.toString().toLocal8Bit().data()); } props.removeAt(idx); } @@ -279,42 +282,47 @@ QCMakePropertyList QCMake::properties() const QCMakePropertyList ret; cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - for(cmCacheManager::CacheIterator i = cachem->NewIterator(); - !i.IsAtEnd(); i.Next()) + std::vector cacheKeys = cachem->GetCacheEntryKeys(); + for (std::vector::const_iterator i = cacheKeys.begin(); + i != cacheKeys.end(); ++i) { - - if(i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED) + cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i); + if(t == cmCacheManager::INTERNAL || + t == cmCacheManager::STATIC || + t == cmCacheManager::UNINITIALIZED) { continue; } - QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); - prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING")); - prop.Value = QString::fromLocal8Bit(i.GetValue().c_str()); - prop.Advanced = i.GetPropertyAsBool("ADVANCED"); + const char* cachedValue = cachem->GetCacheEntryValue(*i); - if(i.GetType() == cmCacheManager::BOOL) + QCMakeProperty prop; + prop.Key = QString::fromLocal8Bit(i->c_str()); + prop.Help = QString::fromLocal8Bit( + cachem->GetCacheEntryProperty(*i, "HELPSTRING")); + prop.Value = QString::fromLocal8Bit(cachedValue); + prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); + if(t == cmCacheManager::BOOL) { prop.Type = QCMakeProperty::BOOL; - prop.Value = cmSystemTools::IsOn(i.GetValue().c_str()); + prop.Value = cmSystemTools::IsOn(cachedValue); } - else if(i.GetType() == cmCacheManager::PATH) + else if(t == cmCacheManager::PATH) { prop.Type = QCMakeProperty::PATH; } - else if(i.GetType() == cmCacheManager::FILEPATH) + else if(t == cmCacheManager::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; } - else if(i.GetType() == cmCacheManager::STRING) + else if(t == cmCacheManager::STRING) { prop.Type = QCMakeProperty::STRING; - if (i.PropertyExists("STRINGS")) + const char* stringsProperty = + cachem->GetCacheEntryProperty(*i, "STRINGS"); + if (stringsProperty) { - prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";"); + prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";"); } } From ba404938a202b51bb82bff8692ed08e53b061ad4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 5 Apr 2015 10:48:04 +0200 Subject: [PATCH 0476/1029] cmCacheManager: Port consumers to non-iterator API. This simplifies reasoning about the follow-up commit which ports away from cmCacheManager to a class with the same method names. --- Source/cmFindBase.cxx | 13 +++-- Source/cmGetPropertyCommand.cxx | 7 +-- Source/cmGlobalGenerator.cxx | 8 +-- Source/cmMakefile.cxx | 14 ++--- Source/cmMarkAsAdvancedCommand.cxx | 15 ++--- Source/cmOptionCommand.cxx | 12 ++-- Source/cmSetCommand.cxx | 7 ++- Source/cmSetPropertyCommand.cxx | 19 ++++--- Source/cmSetPropertyCommand.h | 2 +- Source/cmTryRunCommand.cxx | 19 ++++--- Source/cmVariableRequiresCommand.cxx | 6 +- Source/cmake.cxx | 84 ++++++++++++++-------------- Source/cmakemain.cxx | 26 +++++---- 13 files changed, 117 insertions(+), 115 deletions(-) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index f63df616d..cc080528d 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -366,18 +366,18 @@ bool cmFindBase::CheckForVariableInCache() if(const char* cacheValue = this->Makefile->GetDefinition(this->VariableName)) { - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()-> - GetCacheIterator(this->VariableName.c_str()); + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName); bool found = !cmSystemTools::IsNOTFOUND(cacheValue); - bool cached = !it.IsAtEnd(); + bool cached = cacheEntry ? true : false; if(found) { // If the user specifies the entry on the command line without a // type we should add the type and docstring but keep the // original value. Tell the subclass implementations to do // this. - if(cached && it.GetType() == cmCacheManager::UNINITIALIZED) + if(cached && manager->GetCacheEntryType(this->VariableName) + == cmCacheManager::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } @@ -385,7 +385,8 @@ bool cmFindBase::CheckForVariableInCache() } else if(cached) { - const char* hs = it.GetProperty("HELPSTRING"); + const char* hs = manager->GetCacheEntryProperty(this->VariableName, + "HELPSTRING"); this->VariableDocumentation = hs?hs:"(none)"; } } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index f0b268685..0e6e0c20e 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -391,11 +391,10 @@ bool cmGetPropertyCommand::HandleCacheMode() } const char* value = 0; - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str()); - if(!it.IsAtEnd()) + if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name)) { - value = it.GetProperty(this->PropertyName); + value = this->Makefile->GetCacheManager() + ->GetCacheEntryProperty(this->Name, this->PropertyName); } this->StoreResult(value); return true; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f23caa6ae..35394b8f9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1559,9 +1559,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(lib->first.c_str())) { std::string varName = lib->first.substr(0, lib->first.size()-9); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(varName.c_str()); - if(it.GetPropertyAsBool("ADVANCED")) + if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) { varName += " (ADVANCED)"; } @@ -1592,9 +1590,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(incDir->c_str())) { std::string varName = incDir->substr(0, incDir->size()-9); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(varName.c_str()); - if(it.GetPropertyAsBool("ADVANCED")) + if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) { varName += " (ADVANCED)"; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c1b9c454..34b46218d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1848,8 +1848,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } } - this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc, - type); + this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, + doc, type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } @@ -2499,12 +2499,10 @@ std::vector cmMakefile this->Internal->VarStack.top().ClosureKeys(); res.insert(res.end(), definitions.begin(), definitions.end()); } - cmCacheManager::CacheIterator cit = - this->GetCacheManager()->GetCacheIterator(); - for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) - { - res.push_back(cit.GetName()); - } + std::vector cacheKeys = + this->GetCacheManager()->GetCacheEntryKeys(); + res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); + std::sort(res.begin(), res.end()); return res; } diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index f6a2c2670..cc094b1bc 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -37,24 +37,19 @@ bool cmMarkAsAdvancedCommand { std::string variable = args[i]; cmCacheManager* manager = this->Makefile->GetCacheManager(); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(variable.c_str()); - if ( it.IsAtEnd() ) + if (!manager->GetCacheEntryValue(variable)) { - this->Makefile->GetCacheManager() - ->AddCacheEntry(variable, 0, 0, - cmCacheManager::UNINITIALIZED); + manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); overwrite = true; } - it.Find(variable); - if ( it.IsAtEnd() ) + if (!manager->GetCacheEntryValue(variable)) { cmSystemTools::Error("This should never happen..."); return false; } - if ( !it.PropertyExists("ADVANCED") || overwrite ) + if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite) { - it.SetProperty("ADVANCED", value); + manager->SetCacheEntryProperty(variable, "ADVANCED", value); } } return true; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 60728eaea..baf5b1e08 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -42,16 +42,16 @@ bool cmOptionCommand std::string initialValue = "Off"; // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str()); - if(!it.IsAtEnd()) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existingValue = manager->GetCacheEntryValue(args[0]); + if(existingValue) { - if ( it.GetType() != cmCacheManager::UNINITIALIZED ) + if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) { - it.SetProperty("HELPSTRING", args[1].c_str()); + manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; } - initialValue = it.GetValue(); + initialValue = existingValue; } if(args.size() == 3) { diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 204d95b1e..e17474bd6 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -136,9 +136,10 @@ bool cmSetCommand } // see if this is already in the cache - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(variable); - if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED)) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existingValue = manager->GetCacheEntryValue(variable); + if(existingValue && + (manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 1150bc7ad..77f9fb90b 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -452,11 +452,11 @@ bool cmSetPropertyCommand::HandleCacheMode() // Get the source file. cmMakefile* mf = this->GetMakefile(); cmake* cm = mf->GetCMakeInstance(); - cmCacheManager::CacheIterator it = - cm->GetCacheManager()->GetCacheIterator(ni->c_str()); - if(!it.IsAtEnd()) + const char* existingValue + = cm->GetCacheManager()->GetCacheEntryValue(*ni); + if(existingValue) { - if(!this->HandleCacheEntry(it)) + if(!this->HandleCacheEntry(*ni)) { return false; } @@ -474,22 +474,25 @@ bool cmSetPropertyCommand::HandleCacheMode() } //---------------------------------------------------------------------------- -bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it) +bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey) { // Set or append the property. const char* name = this->PropertyName.c_str(); const char* value = this->PropertyValue.c_str(); + cmCacheManager* manager = this->Makefile->GetCacheManager(); if (this->Remove) { - value = 0; + manager->RemoveCacheEntryProperty(cacheKey, name); + return true; } if(this->AppendMode) { - it.AppendProperty(name, value, this->AppendAsString); + manager->AppendCacheEntryProperty(cacheKey, name, value, + this->AppendAsString); } else { - it.SetProperty(name, value); + manager->SetCacheEntryProperty(cacheKey, name, value); } return true; diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index b06cb6857..3285e60ab 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -61,7 +61,7 @@ private: bool HandleTestMode(); bool HandleTest(cmTest* test); bool HandleCacheMode(); - bool HandleCacheEntry(cmCacheManager::CacheIterator&); + bool HandleCacheEntry(std::string const&); bool HandleInstallMode(); bool HandleInstall(cmInstalledFile* file); }; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index b5280cfd7..911ade810 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -264,11 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment.c_str(), cmCacheManager::STRING); - cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> - GetCacheIterator(this->RunResultVariable.c_str()); - if ( !it.IsAtEnd() ) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existingValue + = manager->GetCacheEntryValue(this->RunResultVariable); + if (existingValue) { - it.SetProperty("ADVANCED", "1"); + manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1"); } error = true; @@ -290,11 +291,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), cmCacheManager::STRING); - cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> - GetCacheIterator(internalRunOutputName.c_str()); - if ( !it.IsAtEnd() ) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + const char* existing = + manager->GetCacheEntryValue(internalRunOutputName); + if (existing) { - it.SetProperty("ADVANCED", "1"); + manager->SetCacheEntryProperty(internalRunOutputName, + "ADVANCED", "1"); } error = true; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 80c128654..dd2a68299 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -41,9 +41,9 @@ bool cmVariableRequiresCommand requirementsMet = false; notSet += args[i]; notSet += "\n"; - cmCacheManager::CacheIterator it = - this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str()); - if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED")) + cmCacheManager* manager = this->Makefile->GetCacheManager(); + if(manager->GetCacheEntryValue(args[i]) && + manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) { hasAdvanced = true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 210c0ef33..64b332ccc 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -403,17 +403,18 @@ bool cmake::SetCacheArgs(const std::vector& args) cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector entriesToDelete; - cmCacheManager::CacheIterator it = - this->CacheManager->GetCacheIterator(); - for ( it.Begin(); !it.IsAtEnd(); it.Next() ) + std::vector cacheKeys = + this->CacheManager->GetCacheEntryKeys(); + for (std::vector::const_iterator it = cacheKeys.begin(); + it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = it.GetType(); + cmCacheManager::CacheEntryType t = + this->CacheManager->GetCacheEntryType(*it); if(t != cmCacheManager::STATIC) { - std::string entryName = it.GetName(); - if (regex.find(entryName.c_str())) + if (regex.find(it->c_str())) { - entriesToDelete.push_back(entryName); + entriesToDelete.push_back(*it); } } } @@ -917,16 +918,18 @@ void cmake::SetDirectoriesFromFile(const char* arg) // If there is a CMakeCache.txt file, use its settings. if(!cachePath.empty()) { - cmCacheManager* cachem = this->GetCacheManager(); - cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(this->LoadCache(cachePath) && - it.Find("CMAKE_HOME_DIRECTORY")) + if(this->LoadCache(cachePath)) { - this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); - this->SetHomeDirectory(it.GetValue()); - this->SetStartDirectory(it.GetValue()); - return; + const char* existingValue = + this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + if (existingValue) + { + this->SetHomeOutputDirectory(cachePath); + this->SetStartOutputDirectory(cachePath); + this->SetHomeDirectory(existingValue); + this->SetStartDirectory(existingValue); + return; + } } } @@ -1575,11 +1578,11 @@ int cmake::ActualConfigure() ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", cmCacheManager::BOOL); - cmCacheManager::CacheIterator it = - this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS"); - if ( !it.PropertyExists("ADVANCED") ) + if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED")) { - it.SetProperty("ADVANCED", "1"); + this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED", "1"); } } @@ -2314,17 +2317,9 @@ const char *cmake::GetProperty(const std::string& prop, std::string output = ""; if ( prop == "CACHE_VARIABLES" ) { - cmCacheManager::CacheIterator cit = - this->GetCacheManager()->GetCacheIterator(); - for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) - { - if (!output.empty()) - { - output += ";"; - } - output += cit.GetName(); - } - this->SetProperty("CACHE_VARIABLES", output.c_str()); + std::vector cacheKeys = + this->CacheManager->GetCacheEntryKeys(); + this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); } else if ( prop == "COMMANDS" ) { @@ -2686,9 +2681,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, if(t == cmake::AUTHOR_WARNING) { // Allow suppression of these warnings. - cmCacheManager::CacheIterator it = this->CacheManager - ->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - if(!it.IsAtEnd() && it.GetValueAsBool()) + const char* suppress = this->CacheManager->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + if(suppress && cmSystemTools::IsOn(suppress)) { return; } @@ -2801,37 +2796,42 @@ int cmake::Build(const std::string& dir, } std::string cachePath = dir; cmSystemTools::ConvertToUnixSlashes(cachePath); - cmCacheManager::CacheIterator it = this->GetCacheManager()->NewIterator(); if(!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; } - if(!it.Find("CMAKE_GENERATOR")) + const char* cachedGenerator = + this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR"); + if(!cachedGenerator) { std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; return 1; } cmsys::auto_ptr gen( - this->CreateGlobalGenerator(it.GetValue())); + this->CreateGlobalGenerator(cachedGenerator)); if(!gen.get()) { std::cerr << "Error: could create CMAKE_GENERATOR \"" - << it.GetValue() << "\"\n"; + << cachedGenerator << "\"\n"; return 1; } std::string output; std::string projName; - if(!it.Find("CMAKE_PROJECT_NAME")) + const char* cachedProjectName = + this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME"); + if(!cachedProjectName) { std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n"; return 1; } - projName = it.GetValue(); + projName = cachedProjectName; bool verbose = false; - if(it.Find("CMAKE_VERBOSE_MAKEFILE")) + const char* cachedVerbose = + this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); + if(cachedVerbose) { - verbose = it.GetValueAsBool(); + verbose = cmSystemTools::IsOn(cachedVerbose); } return gen->Build("", dir, projName, target, diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index ac73ad079..3b518be77 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -328,25 +328,31 @@ int do_cmake(int ac, char const* const* av) int res = cm.Run(args, view_only); if ( list_cached || list_all_cached ) { - cmCacheManager::CacheIterator it = - cm.GetCacheManager()->GetCacheIterator(); std::cout << "-- Cache values" << std::endl; - for ( it.Begin(); !it.IsAtEnd(); it.Next() ) + std::vector keys = + cm.GetCacheManager()->GetCacheEntryKeys(); + for (std::vector::const_iterator it = keys.begin(); + it != keys.end(); ++it) { - cmCacheManager::CacheEntryType t = it.GetType(); + cmCacheManager::CacheEntryType t = + cm.GetCacheManager()->GetCacheEntryType(*it); if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && t != cmCacheManager::UNINITIALIZED ) { - bool advanced = it.PropertyExists("ADVANCED"); - if ( list_all_cached || !advanced) + const char* advancedProp = + cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED"); + if ( list_all_cached || !advancedProp) { if ( list_help ) { - std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl; + std::cout << "// " + << cm.GetCacheManager()->GetCacheEntryProperty(*it, + "HELPSTRING") << std::endl; } - std::cout << it.GetName() << ":" << - cmCacheManager::TypeToString(it.GetType()) - << "=" << it.GetValue() << std::endl; + std::cout << *it << ":" << + cmCacheManager::TypeToString(t) + << "=" << cm.GetCacheManager()->GetCacheEntryValue(*it) + << std::endl; if ( list_help ) { std::cout << std::endl; From a2df4a3f769a63822144c874660eb9461f233c22 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Apr 2015 13:07:44 -0400 Subject: [PATCH 0477/1029] liblzma: Disable XL compiler optimizations altogether Revert commit 82c51a8a (liblzma: Disable XL compiler optimizations in one source to avoid crash, 2015-04-02) and instead add a compiler flag to disable optimizations in every source of liblzma. Somehow the XL compiler optimizations create incorrect behavior in liblzma and lead to crashes or truncated output during compression. --- Utilities/cmliblzma/CMakeLists.txt | 6 ++++++ .../cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index d991438d6..991c699e6 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -211,4 +211,10 @@ ENDIF() ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) +IF(CMAKE_C_COMPILER_ID STREQUAL "XL") + # Disable the XL compiler optimizer because it causes crashes + # and other bad behavior in liblzma code. + SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-qnooptimize") +ENDIF() + INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index fc54d8d31..d3a63485c 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -8,9 +8,6 @@ // You can do whatever you want with this file. // /////////////////////////////////////////////////////////////////////////////// -#if defined(__IBMC__) -# pragma options optimize=0 -#endif #include "lzma_encoder_private.h" #include "fastpos.h" From e5d336beb27ea06a0f5058d0ae87c7cd84b8b4b4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Apr 2015 13:52:02 -0400 Subject: [PATCH 0478/1029] liblzma: Disable GNU 3.3 compiler optimizations The GNU 3.3 optimizer causes bad behavior in liblzma, so disable it. --- Utilities/cmliblzma/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 991c699e6..89205366f 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -215,6 +215,10 @@ IF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Disable the XL compiler optimizer because it causes crashes # and other bad behavior in liblzma code. SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-qnooptimize") +ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND + CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) + # Disable the old GNU compiler optimizer. + SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-O0") ENDIF() INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) From 99abebdea01b9ef73e091db5594553f7b1694a1b Mon Sep 17 00:00:00 2001 From: James Bigler Date: Sat, 21 Mar 2015 23:01:24 -0600 Subject: [PATCH 0479/1029] FindCUDA: Handle c++11 host flag If the host flags contain a c++11 flag (at least for gcc), then we can't automatically propagate to nvcc it using -Xcompiler. This is because nvcc can't use any C++ only flags. Instead we find this flag and add it to nvcc's flags (it has a special flag for dealing with c++11 code) and remove it from the host flags. Co-Author: Guillermo Marcus --- Modules/FindCUDA.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 81e1cad5f..7d9f7724a 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1184,6 +1184,19 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") endforeach() + # Process the C++11 flag. If the host sets the flag, we need to add it to nvcc and + # remove it from the host. This is because -Xcompile -std=c++ will choke nvcc (it uses + # the C preprocessor). In order to get this to work correctly, we need to use nvcc's + # specific c++11 flag. + if( "${_cuda_host_flags}" MATCHES "-std=c\\+\\+11") + # Add the c++11 flag to nvcc if it isn't already present. Note that we only look at + # the main flag instead of the configuration specific flags. + if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std;c\\+\\+11" ) + list(APPEND nvcc_flags --std c++11) + endif() + string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}") + endif() + # Get the list of definitions from the directory property get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS) if(CUDA_NVCC_DEFINITIONS) From 3049951b6293486053da2d304737fad42de3b3d8 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 9 Apr 2015 00:01:05 -0400 Subject: [PATCH 0480/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5214832aa..1e4302e70 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150408) +set(CMake_VERSION_PATCH 20150409) #set(CMake_VERSION_RC 1) From fd5cbbe0008c53ebfd666fe34be958d5b5456880 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Apr 2015 07:47:36 -0400 Subject: [PATCH 0481/1029] CTestCustom: Suppress more OS X universal binary link arch warnings --- CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index d716498ac..15f83ad43 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -53,6 +53,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" + "ld: warning: ignoring file .*/libgcc.a, file was built for archive which is not the architecture being linked" "ld: warning: in .*/libgcc.a, file is not of required architecture" "warning.*This version of Mac OS X is unsupported" "clang.*: warning: argument unused during compilation: .-g" From 73dcba5181e6dd7937aa83958a54cabaea8c3576 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Apr 2015 08:02:40 -0400 Subject: [PATCH 0482/1029] Simplify logic to compute install prefix in OS X CMake.app Also avoid explicitly dereferencing a variable in an if() condition. --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d86ae96cc..e979d4f38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -543,10 +543,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") # make sure CMAKE_INSTALL_PREFIX ends in / - string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) - math(EXPR LEN "${LEN} -1" ) - string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) - if(NOT "${ENDCH}" STREQUAL "/") + if(NOT CMAKE_INSTALL_PREFIX MATCHES "/$") set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") endif() set(CMAKE_INSTALL_PREFIX From 051d8be17f1b36d52041bfe61856b926e36dfb8c Mon Sep 17 00:00:00 2001 From: Geoff Viola Date: Sun, 29 Mar 2015 20:56:21 -0600 Subject: [PATCH 0483/1029] cmLocalGenerator: Constify some cmTarget and cmGeneratorTarget arguments --- Source/cmLocalGenerator.cxx | 14 ++++++++------ Source/cmLocalGenerator.h | 9 +++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1998e420..81854f316 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2004,7 +2004,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, //---------------------------------------------------------------------------- void cmLocalGenerator::AddArchitectureFlags(std::string& flags, - cmGeneratorTarget* target, + cmGeneratorTarget const* target, const std::string& lang, const std::string& config) { @@ -2191,7 +2191,7 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator:: -AddCompilerRequirementFlag(std::string &flags, cmTarget* target, +AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, const std::string& lang) { if (lang.empty()) @@ -2313,7 +2313,8 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, } } -static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, +static void AddVisibilityCompileOption(std::string &flags, + cmTarget const* target, cmLocalGenerator *lg, const std::string& lang) { @@ -2347,7 +2348,7 @@ static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, } static void AddInlineVisibilityCompileOption(std::string &flags, - cmTarget* target, + cmTarget const* target, cmLocalGenerator *lg) { std::string compileOption @@ -2368,7 +2369,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags, //---------------------------------------------------------------------------- void cmLocalGenerator -::AddVisibilityPresetFlags(std::string &flags, cmTarget* target, +::AddVisibilityPresetFlags(std::string &flags, cmTarget const* target, const std::string& lang) { int targetType = target->GetType(); @@ -2394,7 +2395,8 @@ void cmLocalGenerator } //---------------------------------------------------------------------------- -void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, +void cmLocalGenerator::AddCMP0018Flags(std::string &flags, + cmTarget const* target, std::string const& lang, const std::string& config) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 6cdee42c9..a005f5ffc 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -138,18 +138,19 @@ public: std::vector& GetChildren() { return this->Children; } - void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, + void AddArchitectureFlags(std::string& flags, + cmGeneratorTarget const* target, const std::string&lang, const std::string& config); void AddLanguageFlags(std::string& flags, const std::string& lang, const std::string& config); - void AddCMP0018Flags(std::string &flags, cmTarget* target, + void AddCMP0018Flags(std::string &flags, cmTarget const* target, std::string const& lang, const std::string& config); - void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, + void AddVisibilityPresetFlags(std::string &flags, cmTarget const* target, const std::string& lang); void AddConfigVariableFlags(std::string& flags, const std::string& var, const std::string& config); - void AddCompilerRequirementFlag(std::string &flags, cmTarget* target, + void AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, const std::string& lang); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const std::string& newFlags); From 882f48e5ba335a1dbc1750c23e6dea5fa92a3adc Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Apr 2015 10:43:47 -0400 Subject: [PATCH 0484/1029] Link libraries by full path even in implicit directories When CMP0003 was first introduced we wanted to link all libraries by full path. However, some projects had problems on platforms where find_library would find /usr/lib/libfoo.so when the project really wanted to link to /usr/lib//libfoo.so and had been working by accident because pre-CMP0003 behavior used -lfoo to link. We first tried to address that in commit v2.6.0~440 (Teach find_library to avoid returning library paths in system directories, 2008-01-23) by returning just "foo" for libraries in implicit link directories. This caused problems for projects expecting find_library to always return a full path. We ended up using the solution in commit v2.6.0~366 (... switch library paths found in implicit link directories to use -l, 2008-01-31). However, the special case for libraries in implicit link directories has also proven problematic and confusing. Introduce policy CMP0060 to switch to linking all libraries by full path even if they are in implicit link directories. Explain in the policy documentation the factors that led to the original approach and now to this approach. --- Help/command/target_link_libraries.rst | 16 +++-- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0060.rst | 63 +++++++++++++++++++ .../dev/link-implicit-libs-full-path.rst | 6 ++ .../variable/CMAKE_POLICY_WARNING_CMPNNNN.rst | 2 + Source/cmComputeLinkInformation.cxx | 42 +++++++++++++ Source/cmComputeLinkInformation.h | 4 ++ Source/cmPolicies.cxx | 5 ++ Source/cmPolicies.h | 1 + Source/cmTarget.h | 3 +- Tests/RunCMake/CMP0060/CMP0060-Common.cmake | 35 +++++++++++ Tests/RunCMake/CMP0060/CMP0060-NEW.cmake | 2 + .../CMP0060/CMP0060-OLD-Build-result.txt | 1 + .../CMP0060/CMP0060-OLD-Build-stdout.txt | 1 + Tests/RunCMake/CMP0060/CMP0060-OLD.cmake | 2 + .../CMP0060/CMP0060-WARN-OFF-Build-result.txt | 1 + .../CMP0060/CMP0060-WARN-OFF-Build-stdout.txt | 1 + Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake | 1 + .../CMP0060/CMP0060-WARN-ON-Build-result.txt | 1 + .../CMP0060/CMP0060-WARN-ON-Build-stdout.txt | 1 + .../CMP0060/CMP0060-WARN-ON-stderr.txt | 16 +++++ Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake | 2 + Tests/RunCMake/CMP0060/CMakeLists.txt | 3 + Tests/RunCMake/CMP0060/RunCMakeTest.cmake | 19 ++++++ Tests/RunCMake/CMP0060/cmp0060.c | 4 ++ Tests/RunCMake/CMP0060/main.c | 5 ++ Tests/RunCMake/CMakeLists.txt | 1 + .../TargetPolicies/PolicyList-stderr.txt | 1 + 28 files changed, 234 insertions(+), 6 deletions(-) create mode 100644 Help/policy/CMP0060.rst create mode 100644 Help/release/dev/link-implicit-libs-full-path.rst create mode 100644 Tests/RunCMake/CMP0060/CMP0060-Common.cmake create mode 100644 Tests/RunCMake/CMP0060/CMP0060-NEW.cmake create mode 100644 Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-OLD.cmake create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt create mode 100644 Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake create mode 100644 Tests/RunCMake/CMP0060/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0060/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CMP0060/cmp0060.c create mode 100644 Tests/RunCMake/CMP0060/main.c diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 393c8b454..d903d0566 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -34,14 +34,20 @@ Each ```` may be: automatically be added in the build system to make sure the named library target is up-to-date before the ```` links. + If an imported library has the :prop_tgt:`IMPORTED_NO_SONAME` + target property set, CMake may ask the linker to search for + the library instead of using the full path + (e.g. ``/usr/lib/libfoo.so`` becomes ``-lfoo``). + * **A full path to a library file**: The generated link line will - normally preserve the full path to the file. However, there are - some cases where CMake must ask the linker to search for the library - (e.g. ``/usr/lib/libfoo.so`` becomes ``-lfoo``), such as when it - appears in a system library directory that the compiler front-end - may replace with an alternative. Either way, the buildsystem will + normally preserve the full path to the file. The buildsystem will have a dependency to re-link ```` if the library file changes. + There are some cases where CMake may ask the linker to search for + the library (e.g. ``/usr/lib/libfoo.so`` becomes ``-lfoo``), such + as when a shared library is detected to have no ``SONAME`` field. + See policy :policy:`CMP0060` for discussion of another case. + If the library file is in a Mac OSX framework, the ``Headers`` directory of the framework will also be processed as a :ref:`usage requirement `. This has the same diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index d2960de23..aff696dfb 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -117,3 +117,4 @@ All Policies /policy/CMP0057 /policy/CMP0058 /policy/CMP0059 + /policy/CMP0060 diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst new file mode 100644 index 000000000..cc37b1bd8 --- /dev/null +++ b/Help/policy/CMP0060.rst @@ -0,0 +1,63 @@ +CMP0060 +------- + +Link libraries by full path even in implicit directories. + +Policy :policy:`CMP0003` was introduced with the intention of always +linking library files by full path when a full path is given to the +:command:`target_link_libraries` command. However, on some platforms +(e.g. HP-UX) the compiler front-end adds alternative library search paths +for the current architecture (e.g. ``/usr/lib/`` has alternatives +to libraries in ``/usr/lib`` for the current architecture). +On such platforms the :command:`find_library` may find a library such as +``/usr/lib/libfoo.so`` that does not belong to the current architecture. + +Prior to policy :policy:`CMP0003` projects would still build in such +cases because the incorrect library path would be converted to ``-lfoo`` +on the link line and the linker would find the proper library in the +arch-specific search path provided by the compiler front-end implicitly. +At the time we chose to remain compatible with such projects by always +converting library files found in implicit link directories to ``-lfoo`` +flags to ask the linker to search for them. This approach allowed existing +projects to continue to build while still linking to libraries outside +implicit link directories via full path (such as those in the build tree). + +CMake does allow projects to override this behavior by using an +:ref:`IMPORTED library target ` with its +:prop_tgt:`IMPORTED_LOCATION` property set to the desired full path to +a library file. In fact, many :ref:`Find Modules` are learning to provide +:ref:`Imported Targets` instead of just the traditional ``Foo_LIBRARIES`` +variable listing library files. However, this makes the link line +generated for a library found by a Find Module depend on whether it +is linked through an imported target or not, which is inconsistent. +Furthermore, this behavior has been a source of confusion because the +generated link line for a library file depends on its location. It is +also problematic for projects trying to link statically because flags +like ``-Wl,-Bstatic -lfoo -Wl,-Bdynamic`` may be used to help the linker +select ``libfoo.a`` instead of ``libfoo.so`` but then leak dynamic linking +to following libraries. (See the :prop_tgt:`LINK_SEARCH_END_STATIC` +target property for a solution typically used for that problem.) + +When the special case for libraries in implicit link directories was first +introduced the list of implicit link directories was simply hard-coded +(e.g. ``/lib``, ``/usr/lib``, and a few others). Since that time, CMake +has learned to detect the implicit link directories used by the compiler +front-end. If necessary, the :command:`find_library` command could be +taught to use this information to help find libraries of the proper +architecture. + +For these reasons, CMake 3.3 and above prefer to drop the special case +and link libraries by full path even when they are in implicit link +directories. Policy ``CMP0060`` provides compatibility for existing +projects. + +The OLD behavior for this policy is to ask the linker to search for +libraries whose full paths are known to be in implicit link directories. +The NEW behavior for this policy is to link libraries by full path even +if they are in implicit link directories. + +This policy was introduced in CMake version 3.3. Unlike most policies, +CMake version |release| does *not* warn by default when this policy +is not set and simply uses OLD behavior. See documentation of the +:variable:`CMAKE_POLICY_WARNING_CMP0060 >` +variable to control the warning. diff --git a/Help/release/dev/link-implicit-libs-full-path.rst b/Help/release/dev/link-implicit-libs-full-path.rst new file mode 100644 index 000000000..7ed724525 --- /dev/null +++ b/Help/release/dev/link-implicit-libs-full-path.rst @@ -0,0 +1,6 @@ +link-implicit-libs-full-path +---------------------------- + +* Linking to library files by a full path in an implicit linker search + directory (e.g. ``/usr/lib/libfoo.a``) no longer asks the linker to + search for the library (e.g. ``-lfoo``). See policy :policy:`CMP0060`. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index a83c80756..092fe3eb6 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -11,6 +11,8 @@ warn by default: policy :policy:`CMP0047`. * ``CMAKE_POLICY_WARNING_CMP0056`` controls the warning for policy :policy:`CMP0056`. +* ``CMAKE_POLICY_WARNING_CMP0060`` controls the warning for + policy :policy:`CMP0060`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b0e0f36c3..888066732 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -411,6 +411,10 @@ cmComputeLinkInformation std::vector const& dirs = this->Target->GetLinkDirectories(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); } + + this->CMP0060Warn = + this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0060"); } //---------------------------------------------------------------------------- @@ -548,6 +552,22 @@ bool cmComputeLinkInformation::Compute() // Add implicit language runtime libraries and directories. this->AddImplicitLinkInfo(); + if (!this->CMP0060WarnItems.empty()) + { + std::ostringstream w; + w << (this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n" + "Some library files are in directories implicitly searched by " + "the linker when invoked for " << this->LinkLanguage << ":\n" + " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n" + "For compatibility with older versions of CMake, the generated " + "link line will ask the linker to search for these by library " + "name." + ; + this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + this->Target->GetBacktrace()); + } + return true; } @@ -1190,6 +1210,28 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) return false; } + // Check the policy for whether we should use the approach below. + switch (this->Target->GetPolicyStatusCMP0060()) + { + case cmPolicies::WARN: + if (this->CMP0060Warn) + { + // Print the warning at most once for this item. + std::string const& wid = "CMP0060-WARNING-GIVEN-" + item; + if (!this->CMakeInstance->GetPropertyAsBool(wid)) + { + this->CMakeInstance->SetProperty(wid, "1"); + this->CMP0060WarnItems.insert(item); + } + } + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + return false; + } + // Many system linkers support multiple architectures by // automatically selecting the implicit linker search path for the // current architecture. If the library appears in an implicit link diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e5d674abf..88471413c 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -175,6 +175,10 @@ private: std::vector OldUserFlagItems; bool OldLinkDirMode; + // CMP0060 warnings. + bool CMP0060Warn; + std::set CMP0060WarnItems; + // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; void AddLibraryRuntimeInfo(std::string const& fullPath, diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0a61bcaf3..e7678cbdf 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -390,6 +390,11 @@ cmPolicies::cmPolicies() CMP0059, "CMP0059", "Do no treat DEFINITIONS as a built-in directory property.", 3,3,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0060, "CMP0060", + "Link libraries by full path even in implicit directories.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ced9d8ce9..1d108c146 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -118,6 +118,7 @@ public: CMP0058, ///< Ninja requires custom command byproducts to be explicit CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory /// property. + CMP0060, ///< Link libraries by full path even in implicit directories. /** \brief Always the last entry. * diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a4ef9775a..55bf234b2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -34,7 +34,8 @@ F(CMP0041) \ F(CMP0042) \ F(CMP0046) \ - F(CMP0052) + F(CMP0052) \ + F(CMP0060) class cmake; class cmMakefile; diff --git a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake new file mode 100644 index 000000000..e0a56e68c --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake @@ -0,0 +1,35 @@ +# Always build in a predictable configuration. For multi-config +# generators we depend on RunCMakeTest.cmake to do this for us. +if(NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Debug) +endif() + +# Convince CMake that it can instruct the linker to search for the +# library of the proper linkage type, but do not really pass flags. +set(CMAKE_EXE_LINK_STATIC_C_FLAGS " ") +set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS " ") + +# Make a link line asking for the linker to search for the library +# look like a missing object file so we will get predictable content +# in the error message. This also ensures that cases expected to use +# the full path can be verified by confirming that they link. +set(CMAKE_LINK_LIBRARY_FLAG LINKFLAG_) +set(CMAKE_LINK_LIBRARY_SUFFIX _LINKSUFFIX${CMAKE_C_OUTPUT_EXTENSION}) + +# Convince CMake that our library is in an implicit linker search directory. +list(APPEND CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/lib) + +# Create a simple library file. Place it in our library directory. +add_library(CMP0060 STATIC cmp0060.c) +set_property(TARGET CMP0060 PROPERTY + ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/lib) + +# Add a target to link the library file by full path. +add_executable(main1 main.c) +target_link_libraries(main1 $) +add_dependencies(main1 CMP0060) + +# Add a second target to verify the warning only appears once. +add_executable(main2 main.c) +target_link_libraries(main2 $) +add_dependencies(main2 CMP0060) diff --git a/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake b/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake new file mode 100644 index 000000000..0414e4b4b --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0060 NEW) +include(CMP0060-Common.cmake) diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt new file mode 100644 index 000000000..240764c10 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-OLD-Build-stdout.txt @@ -0,0 +1 @@ +LINKFLAG_CMP0060_LINKSUFFIX diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD.cmake b/Tests/RunCMake/CMP0060/CMP0060-OLD.cmake new file mode 100644 index 000000000..a9cffefbd --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0060 OLD) +include(CMP0060-Common.cmake) diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt new file mode 100644 index 000000000..240764c10 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF-Build-stdout.txt @@ -0,0 +1 @@ +LINKFLAG_CMP0060_LINKSUFFIX diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake new file mode 100644 index 000000000..6b84565a2 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-OFF.cmake @@ -0,0 +1 @@ +include(CMP0060-Common.cmake) diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt new file mode 100644 index 000000000..240764c10 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-Build-stdout.txt @@ -0,0 +1 @@ +LINKFLAG_CMP0060_LINKSUFFIX diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt new file mode 100644 index 000000000..f6cc97854 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt @@ -0,0 +1,16 @@ +^CMake Warning \(dev\) at CMP0060-Common.cmake:[0-9]+ \(add_executable\): + Policy CMP0060 is not set: Link libraries by full path even in implicit + directories. Run "cmake --help-policy CMP0060" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + Some library files are in directories implicitly searched by the linker + when invoked for C: + + .*/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-build/lib/(lib)?CMP0060.(a|lib) + + For compatibility with older versions of CMake, the generated link line + will ask the linker to search for these by library name. +Call Stack \(most recent call first\): + CMP0060-WARN-ON.cmake:[0-9]+ \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake new file mode 100644 index 000000000..a0a7950ef --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON.cmake @@ -0,0 +1,2 @@ +set(CMAKE_POLICY_WARNING_CMP0060 1) +include(CMP0060-Common.cmake) diff --git a/Tests/RunCMake/CMP0060/CMakeLists.txt b/Tests/RunCMake/CMP0060/CMakeLists.txt new file mode 100644 index 000000000..db6b701c0 --- /dev/null +++ b/Tests/RunCMake/CMP0060/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0060/RunCMakeTest.cmake b/Tests/RunCMake/CMP0060/RunCMakeTest.cmake new file mode 100644 index 000000000..445156fa1 --- /dev/null +++ b/Tests/RunCMake/CMP0060/RunCMakeTest.cmake @@ -0,0 +1,19 @@ +include(RunCMake) + +function(run_cmake_CMP0060 CASE) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0060-${CASE}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(CMP0060-${CASE}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(CMP0060-${CASE}-Build + ${CMAKE_COMMAND} --build . --config Debug + ) +endfunction() + +run_cmake_CMP0060(OLD) +run_cmake_CMP0060(WARN-OFF) +run_cmake_CMP0060(WARN-ON) +run_cmake_CMP0060(NEW) diff --git a/Tests/RunCMake/CMP0060/cmp0060.c b/Tests/RunCMake/CMP0060/cmp0060.c new file mode 100644 index 000000000..a2da227b1 --- /dev/null +++ b/Tests/RunCMake/CMP0060/cmp0060.c @@ -0,0 +1,4 @@ +int libCMP0060(void) +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0060/main.c b/Tests/RunCMake/CMP0060/main.c new file mode 100644 index 000000000..91848c2e6 --- /dev/null +++ b/Tests/RunCMake/CMP0060/main.c @@ -0,0 +1,5 @@ +extern int libCMP0060(void); +int main(void) +{ + return libCMP0060(); +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 60a8a8222..e53612f50 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -65,6 +65,7 @@ add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) add_RunCMake_test(CMP0059) +add_RunCMake_test(CMP0060) if(CMAKE_GENERATOR STREQUAL "Ninja") add_RunCMake_test(Ninja) endif() diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index f4b744b4b..1da16238f 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -17,6 +17,7 @@ \* CMP0042 \* CMP0046 \* CMP0052 + \* CMP0060 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) From 8313de2d5adf4514f0b3cccca747e78ca07d3ad3 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Thu, 26 Mar 2015 23:46:35 -0600 Subject: [PATCH 0485/1029] FindCUDA: Allow setting CUDA_SOURCE_PROPERTY_FORMAT for non-.cu files. A previously undocumented feature allowed overriding the format specified to CUDA_WRAP_SRCS with a source file property called CUDA_SOURCE_PROPERTY_FORMAT. I added documentation for this feature as well as added the ability to let nvcc compile any file regardless of type if this property was found. In addition, I also fixed a couple of bugs with the calls to _cuda_get_important_host_flags that weren't garding the arguments with "" to prevent empty values from causing errors. --- Modules/FindCUDA.cmake | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index ca3255963..de66443a4 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -106,6 +106,13 @@ # CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and # CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called. # +# CUDA_SOURCE_PROPERTY_FORMAT +# -- If this source file property is set, it can override the format specified +# to CUDA_WRAP_SRCS (OBJ, PTX, CUBIN, or FATBIN). If an input source file +# is not a .cu file, setting this file will cause it to be treated as a .cu +# file. See documentation for set_source_files_properties on how to set +# this property. +# # CUDA_USE_STATIC_CUDA_RUNTIME (Default ON) # -- When enabled the static version of the CUDA runtime library will be used # in CUDA_LIBRARIES. If the version of CUDA configured doesn't support @@ -1294,13 +1301,17 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) foreach(file ${ARGN}) # Ignore any file marked as a HEADER_FILE_ONLY get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) - if(${file} MATCHES "\\.cu$" AND NOT _is_header) + # Allow per source file overrides of the format. Also allows compiling non-.cu files. + get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT) + if((${file} MATCHES "\\.cu$" OR _cuda_source_format) AND NOT _is_header) - # Allow per source file overrides of the format. - get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT) if(NOT _cuda_source_format) set(_cuda_source_format ${format}) endif() + # If file isn't a .cu file, we need to tell nvcc to treat it as such. + if(NOT ${file} MATCHES "\\.cu$") + list(APPEND nvcc_flags "-x=cu") + endif() if( ${_cuda_source_format} MATCHES "OBJ") set( cuda_compile_to_external_module OFF ) @@ -1313,7 +1324,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) elseif( ${_cuda_source_format} MATCHES "FATBIN") set( cuda_compile_to_external_module_type "fatbin" ) else() - message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ, PTX, CUBIN or FATBIN.") + message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS or set with CUDA_SOURCE_PROPERTY_FORMAT file property for file '${file}': '${_cuda_source_format}'. Use OBJ, PTX, CUBIN or FATBIN.") endif() endif() @@ -1472,10 +1483,10 @@ endmacro() function(_cuda_get_important_host_flags important_flags flag_string) if(CMAKE_GENERATOR MATCHES "Visual Studio") - string(REGEX MATCHALL "/M[DT][d]?" flags ${flag_string}) + string(REGEX MATCHALL "/M[DT][d]?" flags "${flag_string}") list(APPEND ${important_flags} ${flags}) else() - string(REGEX MATCHALL "-fPIC" flags ${flag_string}) + string(REGEX MATCHALL "-fPIC" flags "${flag_string}") list(APPEND ${important_flags} ${flags}) endif() set(${important_flags} ${${important_flags}} PARENT_SCOPE) @@ -1535,14 +1546,14 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options list(APPEND config_specific_flags $<$:${f}>) endforeach() set(important_host_flags) - _cuda_get_important_host_flags(important_host_flags ${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}) + _cuda_get_important_host_flags(important_host_flags "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") foreach(f ${important_host_flags}) list(APPEND flags $<$:-Xcompiler> $<$:${f}>) endforeach() endforeach() # Add CMAKE_${CUDA_C_OR_CXX}_FLAGS set(important_host_flags) - _cuda_get_important_host_flags(important_host_flags ${CMAKE_${CUDA_C_OR_CXX}_FLAGS}) + _cuda_get_important_host_flags(important_host_flags "${CMAKE_${CUDA_C_OR_CXX}_FLAGS}") foreach(f ${important_host_flags}) list(APPEND flags -Xcompiler ${f}) endforeach() From 1b0c77a33d2e598c48bc8ad385cfd0586b8294e9 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Wed, 1 Apr 2015 17:23:51 -0600 Subject: [PATCH 0486/1029] FindCUDA: Add specific cuda_language_flag instead of using nvcc. I was previously appending to nvcc_flags inside the file loop. This caused the flag to be appended multiple times which freaks out nvcc. Now the flag is specifically handled per file. --- Modules/FindCUDA.cmake | 4 +++- Modules/FindCUDA/run_nvcc.cmake | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index de66443a4..1802e61ef 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1310,7 +1310,9 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # If file isn't a .cu file, we need to tell nvcc to treat it as such. if(NOT ${file} MATCHES "\\.cu$") - list(APPEND nvcc_flags "-x=cu") + set(cuda_language_flag -x=cu) + else() + set(cuda_language_flag) endif() if( ${_cuda_source_format} MATCHES "OBJ") diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index abdd3079e..80323091d 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -75,6 +75,7 @@ set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list set(nvcc_flags @nvcc_flags@) # list set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly). set(format_flag "@format_flag@") # string +set(cuda_language_flag @cuda_language_flag@) # list if(build_cubin AND NOT generated_cubin_file) message(FATAL_ERROR "You must specify generated_cubin_file on the command line") @@ -238,6 +239,7 @@ cuda_execute_process( "Generating ${generated_file}" COMMAND "${CUDA_NVCC_EXECUTABLE}" "${source_file}" + ${cuda_language_flag} ${format_flag} -o "${generated_file}" ${CCBIN} ${nvcc_flags} From ad194ae0b1d85e5e13f1c38a20d397dabccf80e9 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Wed, 8 Apr 2015 19:58:08 +0200 Subject: [PATCH 0487/1029] libarchive: Use base-256 encoding for UID/GID like GNU tar does --- .../libarchive/archive_write_set_format_gnutar.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c index 13942c132..647079de6 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c @@ -644,18 +644,18 @@ archive_format_gnutar_header(struct archive_write *a, char h[512], format_octal(archive_entry_mode(entry) & 07777, h + GNUTAR_mode_offset, GNUTAR_mode_size); - /* TODO: How does GNU tar handle large UIDs? */ - if (format_octal(archive_entry_uid(entry), - h + GNUTAR_uid_offset, GNUTAR_uid_size)) { + /* GNU tar supports base-256 here, so should never overflow. */ + if (format_number(archive_entry_uid(entry), h + GNUTAR_uid_offset, + GNUTAR_uid_size, GNUTAR_uid_max_size)) { archive_set_error(&a->archive, ERANGE, "Numeric user ID %jd too large", (intmax_t)archive_entry_uid(entry)); ret = ARCHIVE_FAILED; } - /* TODO: How does GNU tar handle large GIDs? */ - if (format_octal(archive_entry_gid(entry), - h + GNUTAR_gid_offset, GNUTAR_gid_size)) { + /* GNU tar supports base-256 here, so should never overflow. */ + if (format_number(archive_entry_gid(entry), h + GNUTAR_gid_offset, + GNUTAR_gid_size, GNUTAR_gid_max_size)) { archive_set_error(&a->archive, ERANGE, "Numeric group ID %jd too large", (intmax_t)archive_entry_gid(entry)); From a74d558d1082f2bd380d7a03772972af2cd43e56 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 10 Apr 2015 00:01:05 -0400 Subject: [PATCH 0488/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1e4302e70..52666907f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150409) +set(CMake_VERSION_PATCH 20150410) #set(CMake_VERSION_RC 1) From 1f3bb59b691bf4d745e5c01b012c9d0b178bc34f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Apr 2015 08:11:21 -0400 Subject: [PATCH 0489/1029] CTestCustom: Suppress more OS X universal binary link arch warnings --- CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 15f83ad43..8a345b088 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -53,6 +53,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" + "ld: warning .*/libgcc.a archive's cputype" "ld: warning: ignoring file .*/libgcc.a, file was built for archive which is not the architecture being linked" "ld: warning: in .*/libgcc.a, file is not of required architecture" "warning.*This version of Mac OS X is unsupported" From d2cc580704fa4e608eae104ce5be211a229b2d64 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Tue, 7 Apr 2015 12:36:52 +0200 Subject: [PATCH 0490/1029] cmake: Teach "-E tar" command a "--format=" option Allows specifying a libarchive defined archive format currently restricted to 7zip, gnutar, pax, paxr and zip. The default is "paxr" (pax restricted). --- Help/manual/cmake.1.rst | 4 ++ Help/release/dev/tar-write-format.rst | 6 +++ Source/CPack/cmCPack7zGenerator.cxx | 2 +- Source/CPack/cmCPackArchiveGenerator.cxx | 6 +-- Source/CPack/cmCPackArchiveGenerator.h | 4 +- Source/CPack/cmCPackTGZGenerator.cxx | 2 +- Source/CPack/cmCPackTXZGenerator.cxx | 2 +- Source/CPack/cmCPackTarBZip2Generator.cxx | 2 +- Source/CPack/cmCPackTarCompressGenerator.cxx | 2 +- Source/CPack/cmCPackZIPGenerator.cxx | 2 +- Source/cmArchiveWrite.cxx | 44 ++++++------------- Source/cmArchiveWrite.h | 12 ++--- Source/cmSystemTools.cxx | 7 ++- Source/cmSystemTools.h | 3 +- Source/cmcmd.cxx | 33 +++++++++++++- .../CommandLine/E_tar-bad-format-result.txt | 1 + .../CommandLine/E_tar-bad-format-stderr.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 1 + 18 files changed, 78 insertions(+), 56 deletions(-) create mode 100644 Help/release/dev/tar-write-format.rst create mode 100644 Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index da41bbb1c..b2f7e9d36 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -215,6 +215,10 @@ Available commands are: names start in ``-``. ``--mtime=`` Specify modification time recorded in tarball entries. + ``--format=`` + Specify the format of the archive to be created. + Supported formats are: ``7zip``, ``gnutar``, ``pax``, + ``paxr`` (restricted pax, default), and ``zip``. ``time [...]`` Run command and return elapsed time. diff --git a/Help/release/dev/tar-write-format.rst b/Help/release/dev/tar-write-format.rst new file mode 100644 index 000000000..004df211a --- /dev/null +++ b/Help/release/dev/tar-write-format.rst @@ -0,0 +1,6 @@ +tar-write-format +---------------- + +* The :manual:`cmake(1)` ``-E tar`` command learned a new + ``--format`` option to specify the archive format to + be written. diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index ce31ad455..2809e568e 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPack7zGenerator::cmCPack7zGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, - cmArchiveWrite::Type7Zip) + "7zip") { } diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 05b5cd997..58bd94730 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -27,10 +27,10 @@ //---------------------------------------------------------------------- cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, - cmArchiveWrite::Type at) + std::string const& format) { this->Compress = t; - this->Archive = at; + this->ArchiveFormat = format; } //---------------------------------------------------------------------- @@ -108,7 +108,7 @@ if (!GenerateHeader(&gf)) \ << ">." << std::endl); \ return 0; \ } \ -cmArchiveWrite archive(gf,this->Compress, this->Archive); \ +cmArchiveWrite archive(gf,this->Compress, this->ArchiveFormat); \ if (!archive) \ { \ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \ diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 6411b1ebf..16e7632de 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -31,7 +31,7 @@ public: /** * Construct generator */ - cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type); + cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format); virtual ~cmCPackArchiveGenerator(); // Used to add a header to the archive virtual int GenerateHeader(std::ostream* os); @@ -68,7 +68,7 @@ protected: int PackageComponentsAllInOne(); virtual const char* GetOutputExtension() = 0; cmArchiveWrite::Compress Compress; - cmArchiveWrite::Type Archive; + std::string ArchiveFormat; }; #endif diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 509c7f80a..3fa2b6470 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackTGZGenerator::cmCPackTGZGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index ecfc177af..6d4ede1a8 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackTXZGenerator::cmCPackTXZGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index ae73c3795..9ff588b3f 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -14,7 +14,7 @@ //---------------------------------------------------------------------- cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index df294084c..1c8311b01 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, - cmArchiveWrite::TypeTAR) + "paxr") { } diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index e6e4e77d0..7ef7729e6 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------- cmCPackZIPGenerator::cmCPackZIPGenerator() :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, - cmArchiveWrite::TypeZIP) + "zip") { } diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index cf2fe82ee..72818f50a 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -79,11 +79,12 @@ struct cmArchiveWrite::Callback }; //---------------------------------------------------------------------------- -cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t): - Stream(os), - Archive(archive_write_new()), - Disk(archive_read_disk_new()), - Verbose(false) +cmArchiveWrite::cmArchiveWrite( + std::ostream& os, Compress c, std::string const& format): + Stream(os), + Archive(archive_write_new()), + Disk(archive_read_disk_new()), + Verbose(false) { switch (c) { @@ -141,35 +142,16 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t): { this->Error = "archive_read_disk_set_standard_lookup: "; this->Error += cm_archive_error_string(this->Archive); - return;; + return; } #endif - switch (t) + + if(archive_write_set_format_by_name(this->Archive, format.c_str()) + != ARCHIVE_OK) { - case TypeZIP: - if(archive_write_set_format_zip(this->Archive) != ARCHIVE_OK) - { - this->Error = "archive_write_set_format_zip: "; - this->Error += cm_archive_error_string(this->Archive); - return; - } - break; - case TypeTAR: - if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK) - { - this->Error = "archive_write_set_format_pax_restricted: "; - this->Error += cm_archive_error_string(this->Archive); - return; - } - break; - case Type7Zip: - if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK) - { - this->Error = "archive_write_set_format_7zip: "; - this->Error += cm_archive_error_string(this->Archive); - return; - } - break; + this->Error = "archive_write_set_format_by_name: "; + this->Error += cm_archive_error_string(this->Archive); + return; } // do not pad the last block!! diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 17357b45d..794cb282c 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -38,16 +38,10 @@ public: CompressXZ }; - /** Archive Type */ - enum Type - { - TypeTAR, - TypeZIP, - Type7Zip - }; - /** Construct with output stream to which to write archive. */ - cmArchiveWrite(std::ostream& os, Compress c = CompressNone, Type = TypeTAR); + cmArchiveWrite(std::ostream& os, Compress c = CompressNone, + std::string const& format = "paxr"); + ~cmArchiveWrite(); /** diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 5264123d7..95d05a65b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1475,7 +1475,8 @@ bool cmSystemTools::IsPathToFramework(const char* path) bool cmSystemTools::CreateTar(const char* outFileName, const std::vector& files, cmTarCompression compressType, - bool verbose, std::string const& mtime) + bool verbose, std::string const& mtime, + std::string const& format) { #if defined(CMAKE_BUILD_WITH_CMAKE) std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); @@ -1505,8 +1506,10 @@ bool cmSystemTools::CreateTar(const char* outFileName, compress = cmArchiveWrite::CompressNone; break; } + cmArchiveWrite a(fout, compress, - cmArchiveWrite::TypeTAR); + format.empty() ? "paxr" : format); + a.SetMTime(mtime); a.SetVerbose(verbose); for(std::vector::const_iterator i = files.begin(); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index c59ae96b8..433ef46c1 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -395,7 +395,8 @@ public: static bool CreateTar(const char* outFileName, const std::vector& files, cmTarCompression compressType, bool verbose, - std::string const& mtime = std::string()); + std::string const& mtime = std::string(), + std::string const& format = std::string()); static bool ExtractTar(const char* inFileName, bool verbose); // This should be called first thing in main // it will keep child processes from inheriting the diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9f2ea4636..2ef04efdf 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -703,10 +703,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Tar files else if (args[1] == "tar" && args.size() > 3) { + const char* knownFormats[] = + { + "7zip", + "gnutar", + "pax", + "paxr", + "zip" + }; + std::string flags = args[2]; std::string outFile = args[3]; std::vector files; std::string mtime; + std::string format; bool doing_options = true; for (std::string::size_type cc = 4; cc < args.size(); cc ++) { @@ -729,6 +739,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) return 1; } } + else if (cmHasLiteralPrefix(arg, "--format=")) + { + format = arg.substr(9); + bool isKnown = std::find(cmArrayBegin(knownFormats), + cmArrayEnd(knownFormats), format) != cmArrayEnd(knownFormats); + + if(!isKnown) + { + cmSystemTools::Error("Unknown -E tar --format= argument: ", + format.c_str()); + return 1; + } + } else { cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str()); @@ -759,7 +782,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) compress = cmSystemTools::TarCompressGZip; ++nCompress; } - if ( nCompress > 1 ) + if ( (format == "7zip" || format == "zip") && nCompress > 0 ) + { + cmSystemTools::Error("Can not use compression flags with format: ", + format.c_str()); + return 1; + } + else if ( nCompress > 1 ) { cmSystemTools::Error("Can only compress a tar file one way; " "at most one flag of z, j, or J may be used"); @@ -781,7 +810,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) else if ( flags.find_first_of('c') != flags.npos ) { if ( !cmSystemTools::CreateTar( - outFile.c_str(), files, compress, verbose, mtime) ) + outFile.c_str(), files, compress, verbose, mtime, format) ) { cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); return 1; diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt b/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt b/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt new file mode 100644 index 000000000..fe9e2dccf --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt @@ -0,0 +1 @@ +CMake Error: Unknown -E tar --format= argument: bad-format diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index e8b458482..e3942a805 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake_command(E_tar-bad-from5 ${CMAKE_COMMAND} -E tar cvf bad.tar --files-f run_cmake_command(E_tar-end-opt1 ${CMAKE_COMMAND} -E tar cvf bad.tar -- --bad) run_cmake_command(E_tar-end-opt2 ${CMAKE_COMMAND} -E tar cvf bad.tar --) run_cmake_command(E_tar-mtime ${CMAKE_COMMAND} -E tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC") +run_cmake_command(E_tar-bad-format ${CMAKE_COMMAND} -E tar cvf bad.tar "--format=bad-format") run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) From fd04d87323749c15969982d9aa9b72059f33463b Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Tue, 7 Apr 2015 12:41:55 +0200 Subject: [PATCH 0491/1029] CTestCoverageCollectGCOV: Write tar files intended for CDash in gnutar format PHP's PharData can not currently (PHP 5.6.4) extract paxr tar archives with long filenames. --- Modules/CTestCoverageCollectGCOV.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index 8659a6916..6c74cf39a 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -198,6 +198,7 @@ ${label_files} execute_process(COMMAND ${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL} "--mtime=1970-01-01 0:0:0 UTC" + "--format=gnutar" --files-from=${coverage_dir}/coverage_file_list.txt WORKING_DIRECTORY ${binary_dir}) endfunction() From 6c4781baa9ea4cfb7b4de9ef91e58888286fab44 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Tue, 7 Apr 2015 19:40:33 +0200 Subject: [PATCH 0492/1029] Tests: Consolidate, refactor and extend -E tar tests --- Tests/CMakeLists.txt | 1 - Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 12 --- .../7zip-gz-result.txt} | 0 .../CommandLineTar/7zip-gz-stderr.txt | 1 + Tests/RunCMake/CommandLineTar/7zip.cmake | 10 +++ Tests/RunCMake/CommandLineTar/CMakeLists.txt | 3 + .../CommandLineTar/RunCMakeTest.cmake | 28 +++++++ .../bad-format-result.txt} | 0 .../bad-format-stderr.txt} | 0 .../bad-from1-result.txt} | 0 .../bad-from1-stderr.txt} | 0 .../bad-from2-result.txt} | 0 .../bad-from2-stderr.txt} | 0 .../bad-from3-result.txt} | 0 .../bad-from3-stderr.txt} | 2 +- .../bad-from3.txt} | 0 .../bad-from4-result.txt} | 0 .../bad-from4-stderr.txt} | 0 .../bad-from4.txt} | 0 .../bad-from5-result.txt} | 0 .../bad-from5-stderr.txt} | 0 .../bad-from5.txt} | 0 .../bad-mtime1-result.txt} | 0 .../bad-mtime1-stderr.txt} | 0 .../bad-opt1-result.txt} | 0 .../bad-opt1-stderr.txt} | 0 .../CommandLineTar/end-opt1-result.txt | 1 + .../end-opt1-stderr.txt} | 0 Tests/RunCMake/CommandLineTar/gnutar-gz.cmake | 10 +++ Tests/RunCMake/CommandLineTar/gnutar.cmake | 10 +++ Tests/RunCMake/CommandLineTar/pax-xz.cmake | 10 +++ Tests/RunCMake/CommandLineTar/pax.cmake | 10 +++ Tests/RunCMake/CommandLineTar/paxr-bz2.cmake | 10 +++ Tests/RunCMake/CommandLineTar/paxr.cmake | 10 +++ Tests/RunCMake/CommandLineTar/roundtrip.cmake | 81 +++++++++++++++++++ .../CommandLineTar/zip-bz2-result.txt | 1 + .../CommandLineTar/zip-bz2-stderr.txt | 1 + Tests/RunCMake/CommandLineTar/zip.cmake | 10 +++ Tests/TarTest/CMakeLists.txt | 69 ---------------- Tests/TarTest/TestTarExec.cxx | 5 -- 41 files changed, 198 insertions(+), 88 deletions(-) rename Tests/RunCMake/{CommandLine/E_tar-bad-format-result.txt => CommandLineTar/7zip-gz-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt create mode 100644 Tests/RunCMake/CommandLineTar/7zip.cmake create mode 100644 Tests/RunCMake/CommandLineTar/CMakeLists.txt create mode 100644 Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake rename Tests/RunCMake/{CommandLine/E_tar-bad-from1-result.txt => CommandLineTar/bad-format-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-format-stderr.txt => CommandLineTar/bad-format-stderr.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from2-result.txt => CommandLineTar/bad-from1-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from1-stderr.txt => CommandLineTar/bad-from1-stderr.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from3-result.txt => CommandLineTar/bad-from2-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from2-stderr.txt => CommandLineTar/bad-from2-stderr.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from4-result.txt => CommandLineTar/bad-from3-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from3-stderr.txt => CommandLineTar/bad-from3-stderr.txt} (67%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from3.txt => CommandLineTar/bad-from3.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from5-result.txt => CommandLineTar/bad-from4-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from4-stderr.txt => CommandLineTar/bad-from4-stderr.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from4.txt => CommandLineTar/bad-from4.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-mtime1-result.txt => CommandLineTar/bad-from5-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from5-stderr.txt => CommandLineTar/bad-from5-stderr.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-from5.txt => CommandLineTar/bad-from5.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-opt1-result.txt => CommandLineTar/bad-mtime1-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-mtime1-stderr.txt => CommandLineTar/bad-mtime1-stderr.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-end-opt1-result.txt => CommandLineTar/bad-opt1-result.txt} (100%) rename Tests/RunCMake/{CommandLine/E_tar-bad-opt1-stderr.txt => CommandLineTar/bad-opt1-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CommandLineTar/end-opt1-result.txt rename Tests/RunCMake/{CommandLine/E_tar-end-opt1-stderr.txt => CommandLineTar/end-opt1-stderr.txt} (100%) create mode 100644 Tests/RunCMake/CommandLineTar/gnutar-gz.cmake create mode 100644 Tests/RunCMake/CommandLineTar/gnutar.cmake create mode 100644 Tests/RunCMake/CommandLineTar/pax-xz.cmake create mode 100644 Tests/RunCMake/CommandLineTar/pax.cmake create mode 100644 Tests/RunCMake/CommandLineTar/paxr-bz2.cmake create mode 100644 Tests/RunCMake/CommandLineTar/paxr.cmake create mode 100644 Tests/RunCMake/CommandLineTar/roundtrip.cmake create mode 100644 Tests/RunCMake/CommandLineTar/zip-bz2-result.txt create mode 100644 Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt create mode 100644 Tests/RunCMake/CommandLineTar/zip.cmake delete mode 100644 Tests/TarTest/CMakeLists.txt delete mode 100644 Tests/TarTest/TestTarExec.cxx diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f80191b46..aa6a993fe 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -218,7 +218,6 @@ if(BUILD_TESTING) ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll) ADD_TEST_MACRO(StringFileTest StringFileTest) ADD_TEST_MACRO(TryCompile TryCompile) - ADD_TEST_MACRO(TarTest TarTest) ADD_TEST_MACRO(SystemInformation SystemInformation) ADD_TEST_MACRO(MathTest MathTest) ADD_TEST_MACRO(CompileFeatures CompileFeatures) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 37099134f..d7ac81d85 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -200,6 +200,7 @@ add_RunCMake_test(target_link_libraries) add_RunCMake_test(target_compile_features) add_RunCMake_test(CheckModules) add_RunCMake_test(CommandLine) +add_RunCMake_test(CommandLineTar) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index e3942a805..f879ee6c8 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1,17 +1,5 @@ include(RunCMake) -run_cmake_command(E_tar-bad-opt1 ${CMAKE_COMMAND} -E tar cvf bad.tar --bad) -run_cmake_command(E_tar-bad-mtime1 ${CMAKE_COMMAND} -E tar cvf bad.tar --mtime=bad .) -run_cmake_command(E_tar-bad-from1 ${CMAKE_COMMAND} -E tar cvf bad.tar --files-from=bad) -run_cmake_command(E_tar-bad-from2 ${CMAKE_COMMAND} -E tar cvf bad.tar --files-from=.) -run_cmake_command(E_tar-bad-from3 ${CMAKE_COMMAND} -E tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/E_tar-bad-from3.txt) -run_cmake_command(E_tar-bad-from4 ${CMAKE_COMMAND} -E tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/E_tar-bad-from4.txt) -run_cmake_command(E_tar-bad-from5 ${CMAKE_COMMAND} -E tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/E_tar-bad-from5.txt) -run_cmake_command(E_tar-end-opt1 ${CMAKE_COMMAND} -E tar cvf bad.tar -- --bad) -run_cmake_command(E_tar-end-opt2 ${CMAKE_COMMAND} -E tar cvf bad.tar --) -run_cmake_command(E_tar-mtime ${CMAKE_COMMAND} -E tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC") -run_cmake_command(E_tar-bad-format ${CMAKE_COMMAND} -E tar cvf bad.tar "--format=bad-format") - run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt b/Tests/RunCMake/CommandLineTar/7zip-gz-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt rename to Tests/RunCMake/CommandLineTar/7zip-gz-result.txt diff --git a/Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt b/Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt new file mode 100644 index 000000000..2fad3266d --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/7zip-gz-stderr.txt @@ -0,0 +1 @@ +CMake Error: Can not use compression flags with format: 7zip diff --git a/Tests/RunCMake/CommandLineTar/7zip.cmake b/Tests/RunCMake/CommandLineTar/7zip.cmake new file mode 100644 index 000000000..4bc654846 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/7zip.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.7z") + +set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_OPTIONS --format=7zip) + +set(DECOMPRESSION_FLAGS xvf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("377abcaf271c" LIMIT 6 HEX) diff --git a/Tests/RunCMake/CommandLineTar/CMakeLists.txt b/Tests/RunCMake/CommandLineTar/CMakeLists.txt new file mode 100644 index 000000000..289710955 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake new file mode 100644 index 000000000..12635dbfb --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake @@ -0,0 +1,28 @@ +include(RunCMake) + +function(external_command_test NAME) + run_cmake_command(${NAME} ${CMAKE_COMMAND} -E ${ARGN}) +endfunction() + +external_command_test(bad-opt1 tar cvf bad.tar --bad) +external_command_test(bad-mtime1 tar cvf bad.tar --mtime=bad .) +external_command_test(bad-from1 tar cvf bad.tar --files-from=bad) +external_command_test(bad-from2 tar cvf bad.tar --files-from=.) +external_command_test(bad-from3 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from3.txt) +external_command_test(bad-from4 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from4.txt) +external_command_test(bad-from5 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from5.txt) +external_command_test(end-opt1 tar cvf bad.tar -- --bad) +external_command_test(end-opt2 tar cvf bad.tar --) +external_command_test(mtime tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC") +external_command_test(bad-format tar cvf bad.tar "--format=bad-format") +external_command_test(zip-bz2 tar cvjf bad.tar "--format=zip") +external_command_test(7zip-gz tar cvzf bad.tar "--format=7zip") + +run_cmake(7zip) +run_cmake(gnutar) +run_cmake(gnutar-gz) +run_cmake(pax) +run_cmake(pax-xz) +run_cmake(paxr) +run_cmake(paxr-bz2) +run_cmake(zip) diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from1-result.txt b/Tests/RunCMake/CommandLineTar/bad-format-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from1-result.txt rename to Tests/RunCMake/CommandLineTar/bad-format-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-format-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-format-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from2-result.txt b/Tests/RunCMake/CommandLineTar/bad-from1-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from2-result.txt rename to Tests/RunCMake/CommandLineTar/bad-from1-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from1-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from1-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from1-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-from1-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from3-result.txt b/Tests/RunCMake/CommandLineTar/bad-from2-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from3-result.txt rename to Tests/RunCMake/CommandLineTar/bad-from2-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from2-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from2-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from2-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-from2-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from4-result.txt b/Tests/RunCMake/CommandLineTar/bad-from3-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from4-result.txt rename to Tests/RunCMake/CommandLineTar/bad-from3-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from3-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt similarity index 67% rename from Tests/RunCMake/CommandLine/E_tar-bad-from3-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt index 147bd8042..da32ad917 100644 --- a/Tests/RunCMake/CommandLine/E_tar-bad-from3-stderr.txt +++ b/Tests/RunCMake/CommandLineTar/bad-from3-stderr.txt @@ -1,2 +1,2 @@ -^CMake Error: -E tar --files-from='.*/Tests/RunCMake/CommandLine/E_tar-bad-from3.txt' file invalid line: +^CMake Error: -E tar --files-from='.*/Tests/RunCMake/CommandLineTar/bad-from3.txt' file invalid line: -add-file=option-typo$ diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from3.txt b/Tests/RunCMake/CommandLineTar/bad-from3.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from3.txt rename to Tests/RunCMake/CommandLineTar/bad-from3.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from5-result.txt b/Tests/RunCMake/CommandLineTar/bad-from4-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from5-result.txt rename to Tests/RunCMake/CommandLineTar/bad-from4-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from4-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from4-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from4-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-from4-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from4.txt b/Tests/RunCMake/CommandLineTar/bad-from4.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from4.txt rename to Tests/RunCMake/CommandLineTar/bad-from4.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-mtime1-result.txt b/Tests/RunCMake/CommandLineTar/bad-from5-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-mtime1-result.txt rename to Tests/RunCMake/CommandLineTar/bad-from5-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from5-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-from5-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from5-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-from5-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-from5.txt b/Tests/RunCMake/CommandLineTar/bad-from5.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-from5.txt rename to Tests/RunCMake/CommandLineTar/bad-from5.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-opt1-result.txt b/Tests/RunCMake/CommandLineTar/bad-mtime1-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-opt1-result.txt rename to Tests/RunCMake/CommandLineTar/bad-mtime1-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-mtime1-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-mtime1-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-mtime1-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-mtime1-stderr.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-end-opt1-result.txt b/Tests/RunCMake/CommandLineTar/bad-opt1-result.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-end-opt1-result.txt rename to Tests/RunCMake/CommandLineTar/bad-opt1-result.txt diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-opt1-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-opt1-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-bad-opt1-stderr.txt rename to Tests/RunCMake/CommandLineTar/bad-opt1-stderr.txt diff --git a/Tests/RunCMake/CommandLineTar/end-opt1-result.txt b/Tests/RunCMake/CommandLineTar/end-opt1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/end-opt1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_tar-end-opt1-stderr.txt b/Tests/RunCMake/CommandLineTar/end-opt1-stderr.txt similarity index 100% rename from Tests/RunCMake/CommandLine/E_tar-end-opt1-stderr.txt rename to Tests/RunCMake/CommandLineTar/end-opt1-stderr.txt diff --git a/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake b/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake new file mode 100644 index 000000000..5f2674a8f --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.gz") + +set(COMPRESSION_FLAGS cvzf) +set(COMPRESSION_OPTIONS --format=gnutar) + +set(DECOMPRESSION_FLAGS xvzf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("1f8b" LIMIT 2 HEX) diff --git a/Tests/RunCMake/CommandLineTar/gnutar.cmake b/Tests/RunCMake/CommandLineTar/gnutar.cmake new file mode 100644 index 000000000..aaca596f5 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/gnutar.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar") + +set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_OPTIONS --format=gnutar) + +set(DECOMPRESSION_FLAGS xvf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("7573746172202000" OFFSET 257 LIMIT 8 HEX) diff --git a/Tests/RunCMake/CommandLineTar/pax-xz.cmake b/Tests/RunCMake/CommandLineTar/pax-xz.cmake new file mode 100644 index 000000000..baf63d5c8 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/pax-xz.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.xz") + +set(COMPRESSION_FLAGS cvJf) +set(COMPRESSION_OPTIONS --format=pax) + +set(DECOMPRESSION_FLAGS xvJf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("fd377a585a00" LIMIT 6 HEX) diff --git a/Tests/RunCMake/CommandLineTar/pax.cmake b/Tests/RunCMake/CommandLineTar/pax.cmake new file mode 100644 index 000000000..60ed2385c --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/pax.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar") + +set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_OPTIONS --format=pax) + +set(DECOMPRESSION_FLAGS xvf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("7573746172003030" OFFSET 257 LIMIT 8 HEX) diff --git a/Tests/RunCMake/CommandLineTar/paxr-bz2.cmake b/Tests/RunCMake/CommandLineTar/paxr-bz2.cmake new file mode 100644 index 000000000..881a0af3b --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/paxr-bz2.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar.bz2") + +set(COMPRESSION_FLAGS cvjf) +set(COMPRESSION_OPTIONS --format=paxr) + +set(DECOMPRESSION_FLAGS xvjf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("425a68" LIMIT 3 HEX) diff --git a/Tests/RunCMake/CommandLineTar/paxr.cmake b/Tests/RunCMake/CommandLineTar/paxr.cmake new file mode 100644 index 000000000..968a103ca --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/paxr.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.tar") + +set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_OPTIONS --format=paxr) + +set(DECOMPRESSION_FLAGS xvf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("7573746172003030" OFFSET 257 LIMIT 8 HEX) diff --git a/Tests/RunCMake/CommandLineTar/roundtrip.cmake b/Tests/RunCMake/CommandLineTar/roundtrip.cmake new file mode 100644 index 000000000..dc1c88528 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/roundtrip.cmake @@ -0,0 +1,81 @@ +foreach(parameter OUTPUT_NAME COMPRESSION_FLAGS DECOMPRESSION_FLAGS) + if(NOT DEFINED ${parameter}) + message(FATAL_ERROR "missing required parameter ${parameter}") + endif() +endforeach() + +function(run_tar WORKING_DIRECTORY) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar ${ARGN} + WORKING_DIRECTORY ${WORKING_DIRECTORY} + RESULT_VARIABLE result + ) + + if(NOT result STREQUAL "0") + message(FATAL_ERROR "tar failed with arguments [${ARGN}] result [${result}]") + endif() +endfunction() + +set(COMPRESS_DIR compress_dir) +set(FULL_COMPRESS_DIR ${CMAKE_CURRENT_BINARY_DIR}/${COMPRESS_DIR}) + +set(DECOMPRESS_DIR decompress_dir) +set(FULL_DECOMPRESS_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DECOMPRESS_DIR}) + +set(FULL_OUTPUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}) + +set(CHECK_FILES + "f1.txt" + "d1/f1.txt" + "d 2/f1.txt" + "d + 3/f1.txt" + "d_4/f1.txt" + "d-4/f1.txt" + "My Special Directory/f1.txt" +) + +foreach(file ${CHECK_FILES}) + configure_file(${CMAKE_CURRENT_LIST_FILE} ${FULL_COMPRESS_DIR}/${file} COPYONLY) +endforeach() + +if(UNIX) + execute_process(COMMAND ln -sf f1.txt ${FULL_COMPRESS_DIR}/d1/f2.txt) + list(APPEND CHECK_FILES "d1/f2.txt") +endif() + +file(REMOVE ${FULL_OUTPUT_NAME}) +file(REMOVE_RECURSE ${FULL_DECOMPRESS_DIR}) +file(MAKE_DIRECTORY ${FULL_DECOMPRESS_DIR}) + +run_tar(${CMAKE_CURRENT_BINARY_DIR} ${COMPRESSION_FLAGS} ${FULL_OUTPUT_NAME} ${COMPRESSION_OPTIONS} ${COMPRESS_DIR}) +run_tar(${FULL_DECOMPRESS_DIR} ${DECOMPRESSION_FLAGS} ${FULL_OUTPUT_NAME} ${DECOMPRESSION_OPTIONS}) + +foreach(file ${CHECK_FILES}) + set(input ${FULL_COMPRESS_DIR}/${file}) + set(output ${FULL_DECOMPRESS_DIR}/${COMPRESS_DIR}/${file}) + + if(NOT EXISTS ${input}) + message(SEND_ERROR "Cannot find input file ${output}") + endif() + + if(NOT EXISTS ${output}) + message(SEND_ERROR "Cannot find output file ${output}") + endif() + + file(MD5 ${input} input_md5) + file(MD5 ${output} output_md5) + + if(NOT input_md5 STREQUAL output_md5) + message(SEND_ERROR "Files \"${input}\" and \"${output}\" are different") + endif() +endforeach() + +function(check_magic EXPECTED) + file(READ ${FULL_OUTPUT_NAME} ACTUAL + ${ARGN} + ) + + if(NOT ACTUAL STREQUAL EXPECTED) + message(FATAL_ERROR + "Actual [${ACTUAL}] does not match expected [${EXPECTED}]") + endif() +endfunction() diff --git a/Tests/RunCMake/CommandLineTar/zip-bz2-result.txt b/Tests/RunCMake/CommandLineTar/zip-bz2-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/zip-bz2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt b/Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt new file mode 100644 index 000000000..1134b4fd4 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/zip-bz2-stderr.txt @@ -0,0 +1 @@ +CMake Error: Can not use compression flags with format: zip diff --git a/Tests/RunCMake/CommandLineTar/zip.cmake b/Tests/RunCMake/CommandLineTar/zip.cmake new file mode 100644 index 000000000..08e2fdb9c --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/zip.cmake @@ -0,0 +1,10 @@ +set(OUTPUT_NAME "test.zip") + +set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_OPTIONS --format=zip) + +set(DECOMPRESSION_FLAGS xvf) + +include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) + +check_magic("504b0304" LIMIT 4 HEX) diff --git a/Tests/TarTest/CMakeLists.txt b/Tests/TarTest/CMakeLists.txt deleted file mode 100644 index bcc340bb3..000000000 --- a/Tests/TarTest/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project(TarTest) - -# this is macro that we will be running -macro(EXEC_TAR_COMMAND DIR ARGS) - exec_program("${CMAKE_COMMAND}" "${DIR}" ARGS "-E tar ${ARGS}" RETURN_VALUE RET) - if(${RET}) - message(FATAL_ERROR "CMake tar command failed with arguments \"${ARGS}\"") - endif() -endmacro() - -# Create a directory structure -set(CHECK_FILES) -macro(COPY F1 F2) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${F1}" "${CMAKE_CURRENT_BINARY_DIR}/tar_dir/${F2}" COPYONLY) - set(CHECK_FILES ${CHECK_FILES} "${F2}") -endmacro() -COPY("CMakeLists.txt" "f1.txt") -COPY("CMakeLists.txt" "d1/f1.txt") -COPY("CMakeLists.txt" "d 2/f1.txt") -COPY("CMakeLists.txt" "d + 3/f1.txt") -COPY("CMakeLists.txt" "d_4/f1.txt") -COPY("CMakeLists.txt" "d-4/f1.txt") -COPY("CMakeLists.txt" "My Special Directory/f1.txt") - -if(UNIX) - exec_program("ln" ARGS "-sf f1.txt \"${CMAKE_CURRENT_BINARY_DIR}/tar_dir/d1/f2.txt\"") - set(CHECK_FILES ${CHECK_FILES} "d1/f2.txt") -endif() - -# cleanup first in case there are files left from previous runs -# if the umask is odd on the machine it might create files that -# are not automatically over written. These tests are run -# each time the configure step is run. -file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test_tar.tar") -file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test_tgz.tgz") -file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_output_tar") -file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz") - -make_directory("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar") -make_directory("${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz") - - -# Run tests -EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}" "cvf \"${CMAKE_CURRENT_BINARY_DIR}/test_tar.tar\" tar_dir") -EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}" "cvfz \"${CMAKE_CURRENT_BINARY_DIR}/test_tgz.tgz\" tar_dir") - -EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar" "xvf \"${CMAKE_CURRENT_BINARY_DIR}/test_tar.tar\"") -EXEC_TAR_COMMAND("${CMAKE_CURRENT_BINARY_DIR}/test_output_tgz" "xvfz \"${CMAKE_CURRENT_BINARY_DIR}/test_tgz.tgz\"") - -macro(CHECK_DIR_STRUCTURE DIR) - foreach(file ${CHECK_FILES}) - set(sfile "${DIR}/${file}") - set(rfile "${CMAKE_CURRENT_BINARY_DIR}/tar_dir/${file}") - if(NOT EXISTS "${sfile}") - message(SEND_ERROR "Cannot find file ${sfile}") - else() - exec_program("${CMAKE_COMMAND}" ARGS "-E compare_files \"${sfile}\" \"${rfile}\"" RETURN_VALUE ret) - if(${ret}) - message(SEND_ERROR "Files \"${sfile}\" \"${rfile}\" are different") - endif() - endif() - endforeach() -endmacro() - -CHECK_DIR_STRUCTURE("${CMAKE_CURRENT_BINARY_DIR}/test_output_tar/tar_dir") - -add_executable(TarTest TestTarExec.cxx) - diff --git a/Tests/TarTest/TestTarExec.cxx b/Tests/TarTest/TestTarExec.cxx deleted file mode 100644 index 86f2cd170..000000000 --- a/Tests/TarTest/TestTarExec.cxx +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - return 0; -} - From c9e9c31c53f69475aa080ad442492408217259b5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Apr 2015 12:42:49 -0400 Subject: [PATCH 0493/1029] Tests: Create pseudo_emulator output dir for Xcode 2.x Apply the workardound from commit v2.8.2~598 (Create CMakeLibTests output dir for Xcode, 2009-12-09) to the pseudo_emulator tool. --- Tests/RunCMake/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 977721de8..0ffae0e34 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -230,3 +230,11 @@ endif() add_executable(pseudo_emulator pseudo_emulator.c) add_RunCMake_test(CrosscompilingEmulator -DPSEUDO_EMULATOR=$) +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command( + TARGET pseudo_emulator + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) +endif() From 4e039a9a9814fd13142ae2c9876420ddf2414b8e Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Apr 2015 11:52:16 -0400 Subject: [PATCH 0494/1029] Tests: Move more command line tests into RunCMake.CommandLine Port most CMakeTestBadCommandLines test cases to RunCMake.CommandLine and drop the former test. Add validation of expected results, which was not done by the old test. --- Tests/CMakeLists.txt | 15 ---- Tests/CMakeTestBadCommandLines/RunCMake.cmake | 79 ------------------- .../RunCMake/CommandLine/C-no-arg-result.txt | 1 + .../RunCMake/CommandLine/C-no-arg-stderr.txt | 2 + .../RunCMake/CommandLine/C-no-file-result.txt | 1 + .../RunCMake/CommandLine/C-no-file-stderr.txt | 3 + .../RunCMake/CommandLine/D-no-arg-result.txt | 1 + .../RunCMake/CommandLine/D-no-arg-stderr.txt | 2 + .../RunCMake/CommandLine/E-no-arg-result.txt | 1 + .../RunCMake/CommandLine/E-no-arg-stderr.txt | 3 + .../E_create_symlink-no-arg-result.txt | 1 + .../E_create_symlink-no-arg-stderr.txt | 3 + .../CommandLine/E_rename-no-arg-result.txt | 1 + .../CommandLine/E_rename-no-arg-stderr.txt | 3 + .../E_touch_nocreate-no-arg-result.txt | 1 + .../E_touch_nocreate-no-arg-stderr.txt | 3 + .../RunCMake/CommandLine/G_bad-arg-result.txt | 1 + .../RunCMake/CommandLine/G_bad-arg-stderr.txt | 1 + .../RunCMake/CommandLine/G_no-arg-result.txt | 1 + .../RunCMake/CommandLine/G_no-arg-stderr.txt | 1 + Tests/RunCMake/CommandLine/NoArgs-stdout.txt | 10 +++ .../RunCMake/CommandLine/P_no-arg-result.txt | 1 + .../RunCMake/CommandLine/P_no-arg-stderr.txt | 1 + .../RunCMake/CommandLine/P_no-file-result.txt | 1 + .../RunCMake/CommandLine/P_no-file-stderr.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 40 ++++++++++ .../RunCMake/CommandLine/U-no-arg-result.txt | 1 + .../RunCMake/CommandLine/U-no-arg-stderr.txt | 2 + Tests/RunCMake/CommandLine/Wdev-stderr.txt | 5 ++ Tests/RunCMake/CommandLine/Wdev.cmake | 1 + Tests/RunCMake/CommandLine/Wno-dev.cmake | 1 + .../CommandLine/cache-no-file-result.txt | 1 + .../CommandLine/cache-no-file-stderr.txt | 2 + .../CommandLine/debug-output-stdout.txt | 1 + Tests/RunCMake/CommandLine/debug-output.cmake | 0 .../CommandLine/debug-trycompile.cmake | 5 ++ .../CommandLine/lists-no-file-result.txt | 1 + .../CommandLine/lists-no-file-stderr.txt | 2 + Tests/RunCMake/CommandLine/trace-stderr.txt | 2 + Tests/RunCMake/CommandLine/trace.cmake | 0 40 files changed, 108 insertions(+), 94 deletions(-) delete mode 100644 Tests/CMakeTestBadCommandLines/RunCMake.cmake create mode 100644 Tests/RunCMake/CommandLine/C-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/C-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/C-no-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/C-no-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/D-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/D-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/E-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/G_bad-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/G_no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/G_no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/NoArgs-stdout.txt create mode 100644 Tests/RunCMake/CommandLine/P_no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/P_no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/P_no-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/P_no-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/U-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/U-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Wdev-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Wdev.cmake create mode 100644 Tests/RunCMake/CommandLine/Wno-dev.cmake create mode 100644 Tests/RunCMake/CommandLine/cache-no-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/cache-no-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/debug-output-stdout.txt create mode 100644 Tests/RunCMake/CommandLine/debug-output.cmake create mode 100644 Tests/RunCMake/CommandLine/debug-trycompile.cmake create mode 100644 Tests/RunCMake/CommandLine/lists-no-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/lists-no-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/trace-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/trace.cmake diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index aa6a993fe..1e60abe71 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1095,21 +1095,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators") endif() - if(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines) - set(CTEST_RUN_CMakeTestBadCommandLines ON) - endif() - - if(CTEST_RUN_CMakeTestBadCommandLines) - add_test(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND} - -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines - -D gen=${CMAKE_GENERATOR} - -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR} - -P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake - ) - list(APPEND TEST_BUILD_DIRS - "${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines") - endif() - if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures) set(CTEST_RUN_CMakeTestMultipleConfigures ON) endif() diff --git a/Tests/CMakeTestBadCommandLines/RunCMake.cmake b/Tests/CMakeTestBadCommandLines/RunCMake.cmake deleted file mode 100644 index 08549cc5e..000000000 --- a/Tests/CMakeTestBadCommandLines/RunCMake.cmake +++ /dev/null @@ -1,79 +0,0 @@ -if(NOT DEFINED CMake_SOURCE_DIR) - message(FATAL_ERROR "CMake_SOURCE_DIR not defined") -endif() - -if(NOT DEFINED dir) - message(FATAL_ERROR "dir not defined") -endif() - -if(NOT DEFINED gen) - message(FATAL_ERROR "gen not defined") -endif() - -message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") - -# First setup a source tree to run CMake on. -# -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast - ${dir}/Source -) - -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${dir}/Build - ) - -function(RunCMakeWithArgs) - message(STATUS "info: running cmake with ARGN='${ARGN}'") - - execute_process(COMMAND ${CMAKE_COMMAND} ${ARGN} - RESULT_VARIABLE result - OUTPUT_VARIABLE stdout - ERROR_VARIABLE stderr - WORKING_DIRECTORY ${dir}/Build - ) - - message(STATUS "result='${result}'") - message(STATUS "stdout='${stdout}'") - message(STATUS "stderr='${stderr}'") - message(STATUS "") -endfunction() - -# Run cmake once with no errors to get a good build tree: -# -RunCMakeWithArgs(-G ${gen} ../Source) - -# Run cmake with args that produce some sort of problem to cover the error -# cases in cmake.cxx... -# -# (These are not good examples of cmake command lines. Do not copy and -# paste them elsewhere and expect them to work... See the cmake -# documentation or other real examples of usage instead.) -# -RunCMakeWithArgs() -RunCMakeWithArgs(-C) -RunCMakeWithArgs(-C nosuchcachefile.txt) -RunCMakeWithArgs(--check-stamp-file nostampfile) -RunCMakeWithArgs(--check-stamp-list nostamplist) -RunCMakeWithArgs(nosuchsubdir/CMakeCache.txt) -RunCMakeWithArgs(nosuchsubdir/CMakeLists.txt) -RunCMakeWithArgs(-D) -RunCMakeWithArgs(--debug-output .) -RunCMakeWithArgs(--debug-trycompile .) -RunCMakeWithArgs(-E) -RunCMakeWithArgs(-E create_symlink) -RunCMakeWithArgs(-E echo_append) -RunCMakeWithArgs(-E rename) -RunCMakeWithArgs(-E touch_nocreate) -RunCMakeWithArgs(-G) -RunCMakeWithArgs(--graphviz= ../Source) -RunCMakeWithArgs(--graphviz=g.dot .) -RunCMakeWithArgs(-P) -RunCMakeWithArgs(-P nosuchscriptfile.cmake) -RunCMakeWithArgs(--trace .) -RunCMakeWithArgs(-U) -RunCMakeWithArgs(-U nosuchvariable .) -RunCMakeWithArgs(-V) -RunCMakeWithArgs(-V .) -RunCMakeWithArgs(-Wno-dev .) -RunCMakeWithArgs(-Wdev .) diff --git a/Tests/RunCMake/CommandLine/C-no-arg-result.txt b/Tests/RunCMake/CommandLine/C-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt new file mode 100644 index 000000000..0570d8fca --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: -C must be followed by a file name. +CMake Error: Problem processing arguments. Aborting.$ diff --git a/Tests/RunCMake/CommandLine/C-no-file-result.txt b/Tests/RunCMake/CommandLine/C-no-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt new file mode 100644 index 000000000..5315f5904 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Error processing file: nosuchcachefile.txt +CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build/nosuchcachefile.txt" does not exist. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/D-no-arg-result.txt b/Tests/RunCMake/CommandLine/D-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/D-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt new file mode 100644 index 000000000..5e43bcace --- /dev/null +++ b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: -D must be followed with VAR=VALUE. +CMake Error: Problem processing arguments. Aborting.$ diff --git a/Tests/RunCMake/CommandLine/E-no-arg-result.txt b/Tests/RunCMake/CommandLine/E-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt new file mode 100644 index 000000000..056ce052d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt new file mode 100644 index 000000000..056ce052d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt new file mode 100644 index 000000000..056ce052d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt new file mode 100644 index 000000000..056ce052d --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/G_bad-arg-result.txt b/Tests/RunCMake/CommandLine/G_bad-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_bad-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt new file mode 100644 index 000000000..511208f58 --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Could not create named generator NoSuchGenerator$ diff --git a/Tests/RunCMake/CommandLine/G_no-arg-result.txt b/Tests/RunCMake/CommandLine/G_no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt new file mode 100644 index 000000000..56d23c2ee --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No generator specified for -G$ diff --git a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt new file mode 100644 index 000000000..1cd34697b --- /dev/null +++ b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt @@ -0,0 +1,10 @@ +^Usage + + cmake \[options\] + cmake \[options\] + +Specify a source directory to \(re-\)generate a build system for it in the +current working directory. Specify an existing build directory to +re-generate its build system. + +Run 'cmake --help' for more information.$ diff --git a/Tests/RunCMake/CommandLine/P_no-arg-result.txt b/Tests/RunCMake/CommandLine/P_no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_no-arg-stderr.txt b/Tests/RunCMake/CommandLine/P_no-arg-stderr.txt new file mode 100644 index 000000000..8af3a53ce --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No script specified for argument -P$ diff --git a/Tests/RunCMake/CommandLine/P_no-file-result.txt b/Tests/RunCMake/CommandLine/P_no-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_no-file-stderr.txt b/Tests/RunCMake/CommandLine/P_no-file-stderr.txt new file mode 100644 index 000000000..2e1239924 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-file-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Error processing file: nosuchscriptfile.cmake$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f879ee6c8..f047baf20 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1,5 +1,22 @@ include(RunCMake) +run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C) +run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt) +run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt) +run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt) +run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D) +run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U) +run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) +run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) +run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) +run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) + +run_cmake_command(G_no-arg ${CMAKE_COMMAND} -G) +run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) +run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) +run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) + run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator @@ -24,6 +41,9 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") endif() if(UNIX) + run_cmake_command(E_create_symlink-no-arg + ${CMAKE_COMMAND} -E create_symlink + ) run_cmake_command(E_create_symlink-missing-dir ${CMAKE_COMMAND} -E create_symlink T missing-dir/L ) @@ -70,6 +90,26 @@ set(RunCMake_TEST_OPTIONS "-DFOO:STRING=-DBAR:BOOL=BAZ") run_cmake(D_typed_nested_cache) +set(RunCMake_TEST_OPTIONS -Wno-dev) +run_cmake(Wno-dev) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev) +run_cmake(Wdev) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --debug-output) +run_cmake(debug-output) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --trace) +run_cmake(trace) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --debug-trycompile) +run_cmake(debug-trycompile) +unset(RunCMake_TEST_OPTIONS) + function(run_cmake_depends) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build") diff --git a/Tests/RunCMake/CommandLine/U-no-arg-result.txt b/Tests/RunCMake/CommandLine/U-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/U-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt new file mode 100644 index 000000000..c34ef947c --- /dev/null +++ b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: -U must be followed with VAR. +CMake Error: Problem processing arguments. Aborting.$ diff --git a/Tests/RunCMake/CommandLine/Wdev-stderr.txt b/Tests/RunCMake/CommandLine/Wdev-stderr.txt new file mode 100644 index 000000000..f4273039f --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wdev-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at Wdev.cmake:1 \(message\): + Some Author Warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Wdev.cmake b/Tests/RunCMake/CommandLine/Wdev.cmake new file mode 100644 index 000000000..0242086a6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wdev.cmake @@ -0,0 +1 @@ +message(AUTHOR_WARNING "Some Author Warning") diff --git a/Tests/RunCMake/CommandLine/Wno-dev.cmake b/Tests/RunCMake/CommandLine/Wno-dev.cmake new file mode 100644 index 000000000..0242086a6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-dev.cmake @@ -0,0 +1 @@ +message(AUTHOR_WARNING "Some Author Warning") diff --git a/Tests/RunCMake/CommandLine/cache-no-file-result.txt b/Tests/RunCMake/CommandLine/cache-no-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-no-file-stderr.txt b/Tests/RunCMake/CommandLine/cache-no-file-stderr.txt new file mode 100644 index 000000000..da3a0c3a8 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-no-file-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/cache-no-file-build/nosuchsubdir" does not exist. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/debug-output-stdout.txt b/Tests/RunCMake/CommandLine/debug-output-stdout.txt new file mode 100644 index 000000000..96f2aae7e --- /dev/null +++ b/Tests/RunCMake/CommandLine/debug-output-stdout.txt @@ -0,0 +1 @@ +Running with debug output on. diff --git a/Tests/RunCMake/CommandLine/debug-output.cmake b/Tests/RunCMake/CommandLine/debug-output.cmake new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/debug-trycompile.cmake b/Tests/RunCMake/CommandLine/debug-trycompile.cmake new file mode 100644 index 000000000..a3835a700 --- /dev/null +++ b/Tests/RunCMake/CommandLine/debug-trycompile.cmake @@ -0,0 +1,5 @@ +enable_language(C) +# Look for a source tree left by enable_language internal checks. +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt) + message(FATAL_ERROR "--debug-trycompile should leave the source behind") +endif() diff --git a/Tests/RunCMake/CommandLine/lists-no-file-result.txt b/Tests/RunCMake/CommandLine/lists-no-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/lists-no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/lists-no-file-stderr.txt b/Tests/RunCMake/CommandLine/lists-no-file-stderr.txt new file mode 100644 index 000000000..3465e8972 --- /dev/null +++ b/Tests/RunCMake/CommandLine/lists-no-file-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/lists-no-file-build/nosuchsubdir" does not exist. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/trace-stderr.txt b/Tests/RunCMake/CommandLine/trace-stderr.txt new file mode 100644 index 000000000..8e8ddfa59 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-stderr.txt @@ -0,0 +1,2 @@ +^.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.0 \) +.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(2\): project\(\${RunCMake_TEST} NONE \) diff --git a/Tests/RunCMake/CommandLine/trace.cmake b/Tests/RunCMake/CommandLine/trace.cmake new file mode 100644 index 000000000..e69de29bb From 588dcb33b7ff089a84ce5cbacf2696b4a3646b42 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sun, 29 Mar 2015 11:28:30 -0700 Subject: [PATCH 0495/1029] cmake: Provide guidance when an invalid -G option is given Print a list of generators if no generator or an invalid one is supplied. Signed-off-by: Gerald Combs --- Source/cmDocumentation.cxx | 15 +++++++++++++++ Source/cmDocumentation.h | 1 + Source/cmDocumentationFormatter.h | 4 ++-- Source/cmake.cxx | 16 ++++++++++++++++ Source/cmake.h | 3 +++ Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt | 4 +++- Tests/RunCMake/CommandLine/G_no-arg-stderr.txt | 4 +++- 7 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 8c17536a8..4f3475536 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -138,6 +138,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) return this->PrintHelpListVariables(os); case cmDocumentation::ListPolicies: return this->PrintHelpListPolicies(os); + case cmDocumentation::ListGenerators: + return this->PrintHelpListGenerators(os); case cmDocumentation::Version: return this->PrintVersion(os); case cmDocumentation::OldCustomModules: @@ -816,6 +818,19 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os) return true; } +//---------------------------------------------------------------------------- +bool cmDocumentation::PrintHelpListGenerators(std::ostream& os) +{ + std::map::iterator si; + si = this->AllSections.find("Generators"); + if(si != this->AllSections.end()) + { + this->Formatter.SetIndent(" "); + this->Formatter.PrintSection(os, *si->second); + } + return true; +} + //---------------------------------------------------------------------------- bool cmDocumentation::PrintHelpOneVariable(std::ostream& os) { diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index b72b5fe27..8854c3618 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -117,6 +117,7 @@ private: bool PrintHelpListProperties(std::ostream& os); bool PrintHelpListVariables(std::ostream& os); bool PrintHelpListPolicies(std::ostream& os); + bool PrintHelpListGenerators(std::ostream& os); bool PrintOldCustomModules(std::ostream& os); const char* GetNameString() const; diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h index 59513ccb5..6e19b7d72 100644 --- a/Source/cmDocumentationFormatter.h +++ b/Source/cmDocumentationFormatter.h @@ -26,8 +26,8 @@ public: /** Types of help provided. */ enum Type { - None, Version, Usage, Help, Full, ListManuals, - ListCommands, ListModules, ListProperties, ListVariables, ListPolicies, + None, Version, Usage, Help, Full, ListManuals, ListCommands, + ListModules, ListProperties, ListVariables, ListPolicies, ListGenerators, OneManual, OneCommand, OneModule, OneProperty, OneVariable, OnePolicy, OldCustomModules }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7595155b0..3654aa78d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -818,6 +818,7 @@ void cmake::SetArgs(const std::vector& args, if(i >= args.size()) { cmSystemTools::Error("No generator specified for -G"); + this->PrintGeneratorList(); return; } value = args[i]; @@ -828,6 +829,7 @@ void cmake::SetArgs(const std::vector& args, { cmSystemTools::Error("Could not create named generator ", value.c_str()); + this->PrintGeneratorList(); } else { @@ -1961,6 +1963,18 @@ void cmake::GetGeneratorDocumentation(std::vector& v) } } +void cmake::PrintGeneratorList() +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + cmDocumentation doc; + std::vector generators; + this->GetGeneratorDocumentation(generators); + doc.AppendSection("Generators",generators); + std::cerr << "\n"; + doc.PrintDocumentation(cmDocumentation::ListGenerators, std::cerr); +#endif +} + void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: @@ -2438,6 +2452,7 @@ int cmake::GetSystemInformation(std::vector& args) if(i >= args.size()) { cmSystemTools::Error("No generator specified for -G"); + this->PrintGeneratorList(); return -1; } value = args[i]; @@ -2448,6 +2463,7 @@ int cmake::GetSystemInformation(std::vector& args) { cmSystemTools::Error("Could not create named generator ", value.c_str()); + this->PrintGeneratorList(); } else { diff --git a/Source/cmake.h b/Source/cmake.h index 3acf4a82f..0715d74f9 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -476,6 +476,9 @@ private: InstalledFilesMap InstalledFiles; void UpdateConversionPathTable(); + + // Print a list of valid generators to stderr. + void PrintGeneratorList(); }; #define CMAKE_STANDARD_OPTIONS_TABLE \ diff --git a/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt index 511208f58..07f2b5294 100644 --- a/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt @@ -1 +1,3 @@ -^CMake Error: Could not create named generator NoSuchGenerator$ +^CMake Error: Could not create named generator NoSuchGenerator + +Generators diff --git a/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt index 56d23c2ee..2f491a224 100644 --- a/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt @@ -1 +1,3 @@ -^CMake Error: No generator specified for -G$ +^CMake Error: No generator specified for -G + +Generators From 18b58b618ccfb3b3fc56935b64a8fa2139b8398a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 11 Apr 2015 00:01:13 -0400 Subject: [PATCH 0496/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 52666907f..6de0439a4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150410) +set(CMake_VERSION_PATCH 20150411) #set(CMake_VERSION_RC 1) From e9e417b57c85c6901f729c350dca0b01628016f0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 12 Apr 2015 00:01:04 -0400 Subject: [PATCH 0497/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6de0439a4..349c95487 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150411) +set(CMake_VERSION_PATCH 20150412) #set(CMake_VERSION_RC 1) From 55ecd818f6bf70590d61584a87aae7bba992e26d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:08:42 +0200 Subject: [PATCH 0498/1029] cmGlobalGenerator: Store languages as vector, not map. The second component of the map is never used. --- Source/cmGlobalGenerator.cxx | 17 ++++++++++------- Source/cmGlobalGenerator.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35394b8f9..6a6a50394 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -968,7 +968,13 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf) { - this->LanguageEnabled[l] = true; + std::vector::iterator it = + std::lower_bound(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); + if (it == this->LanguageEnabled.end() || *it != l) + { + this->LanguageEnabled.insert(it, l); + } // Fill the language-to-extension map with the current variable // settings to make sure it is available for the try_compile() @@ -1079,7 +1085,8 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { - return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); + return std::binary_search(this->LanguageEnabled.begin(), + this->LanguageEnabled.end(), l); } void cmGlobalGenerator::ClearEnabledLanguages() @@ -1958,11 +1965,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - for(std::map::const_iterator i = - this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i) - { - lang.push_back(i->first); - } + lang = this->LanguageEnabled; } int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b9ddee5b..ce3f03773 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -441,7 +441,7 @@ private: // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map IgnoreExtensions; - std::map LanguageEnabled; + std::vector LanguageEnabled; std::set LanguagesReady; // Ready for try_compile std::map OutputExtensions; std::map LanguageToOutputExtension; From 8c13d7709bb2a254e5927d3df1346d8264ba1bd5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 18:35:49 +0200 Subject: [PATCH 0499/1029] cmake: Don't set the CMakeInstance on the Properties member. There is no need, as global properties have nowhere to chain up to. --- Source/cmake.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7595155b0..99c12d6ba 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -187,7 +187,6 @@ cmake::~cmake() void cmake::InitializeProperties() { this->Properties.clear(); - this->Properties.SetCMakeInstance(this); this->PropertyDefinitions.clear(); // initialize properties From 7450a2c6ed601dc94f2de410661065554ff8ce12 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 14:16:47 +0200 Subject: [PATCH 0500/1029] cmake: Remove method with no external users. Port internal users to access the member. --- Source/cmake.cxx | 10 +++++----- Source/cmake.h | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 99c12d6ba..d2331cb34 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -290,9 +290,9 @@ void cmake::AddCommand(cmCommand* wg) void cmake::RemoveUnscriptableCommands() { std::vector unscriptableCommands; - cmake::RegisteredCommandsMap* commands = this->GetCommands(); - for (cmake::RegisteredCommandsMap::const_iterator pos = commands->begin(); - pos != commands->end(); + for (cmake::RegisteredCommandsMap::const_iterator + pos = this->Commands.begin(); + pos != this->Commands.end(); ++pos) { if (!pos->second->IsScriptable()) @@ -2323,8 +2323,8 @@ const char *cmake::GetProperty(const std::string& prop, else if ( prop == "COMMANDS" ) { cmake::RegisteredCommandsMap::iterator cmds - = this->GetCommands()->begin(); - for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds ) + = this->Commands.begin(); + for (unsigned int cc=0 ; cmds != this->Commands.end(); ++ cmds ) { if ( cc > 0 ) { diff --git a/Source/cmake.h b/Source/cmake.h index 3acf4a82f..d2d3a85ec 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -249,9 +249,6 @@ class cmake */ cmCommand *GetCommand(const std::string& name); - /** Get list of all commands */ - RegisteredCommandsMap* GetCommands() { return &this->Commands; } - /** Check if a command exists. */ bool CommandExists(const std::string& name) const; From 6fb306ea3bbe04b8e4dde8f13eec3e6bdfe35086 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 11:31:43 +0200 Subject: [PATCH 0501/1029] Test expected value of DEBUG_CONFIGURATIONS global property. --- .../DebugConfigurations-stderr.txt | 11 +++++ .../get_property/DebugConfigurations.cmake | 41 +++++++++++++++++++ .../RunCMake/get_property/RunCMakeTest.cmake | 1 + 3 files changed, 53 insertions(+) create mode 100644 Tests/RunCMake/get_property/DebugConfigurations-stderr.txt create mode 100644 Tests/RunCMake/get_property/DebugConfigurations.cmake diff --git a/Tests/RunCMake/get_property/DebugConfigurations-stderr.txt b/Tests/RunCMake/get_property/DebugConfigurations-stderr.txt new file mode 100644 index 000000000..b2956043c --- /dev/null +++ b/Tests/RunCMake/get_property/DebugConfigurations-stderr.txt @@ -0,0 +1,11 @@ +CONFIGS: +IFACE1:\$<\$:external1> +CONFIGS:EXTRA +IFACE1:\$<\$:external1> +IFACE1:\$<\$:external1>;\$<\$:external2> +CONFIGS:NEW;CONFIGS +IFACE1:\$<\$:external1>;\$<\$:external2> +IFACE1:\$<\$:external1>;\$<\$:external2>;\$<\$,\$>:external3> +CONFIGS:NEW;CONFIGS;EXTRA +IFACE1:\$<\$:external1>;\$<\$:external2>;\$<\$,\$>:external3> +IFACE1:\$<\$:external1>;\$<\$:external2>;\$<\$,\$>:external3>;\$<\$,\$,\$>:external4> diff --git a/Tests/RunCMake/get_property/DebugConfigurations.cmake b/Tests/RunCMake/get_property/DebugConfigurations.cmake new file mode 100644 index 000000000..534beafcd --- /dev/null +++ b/Tests/RunCMake/get_property/DebugConfigurations.cmake @@ -0,0 +1,41 @@ + +enable_language(CXX) + +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +add_library(iface1 INTERFACE) +target_link_libraries(iface1 INTERFACE debug external1) + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") + +set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS EXTRA) +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") +target_link_libraries(iface1 INTERFACE debug external2) +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") + +set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS NEW CONFIGS) +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") +target_link_libraries(iface1 INTERFACE debug external3) +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") + +set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS EXTRA) +get_property(configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) +message("CONFIGS:${configs}") + +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") +target_link_libraries(iface1 INTERFACE debug external4) +get_property(tgt_iface TARGET iface1 PROPERTY INTERFACE_LINK_LIBRARIES) +message("IFACE1:${tgt_iface}") diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 196482422..e420b5b13 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -7,3 +7,4 @@ run_cmake(install_properties) run_cmake(source_properties) run_cmake(target_properties) run_cmake(test_properties) +run_cmake(DebugConfigurations) From ade20b433b2ce1cf176bc727a8ed9c47a5f6537e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:04:05 +0200 Subject: [PATCH 0502/1029] cmake: Remove DebugConfigs member. It adds needless complexity to global property handling. --- Source/cmTarget.cxx | 4 +-- Source/cmTargetLinkLibrariesCommand.cxx | 2 +- Source/cmake.cxx | 45 +++++++++---------------- Source/cmake.h | 3 +- 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 85e5165b1..745a84c60 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1157,7 +1157,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType( } // Get the list of configurations considered to be DEBUG. - std::vector const& debugConfigs = + std::vector debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); // Check if any entry in the list matches this configuration. @@ -1216,7 +1216,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, } // Get the list of configurations considered to be DEBUG. - std::vector const& debugConfigs = + std::vector debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); std::string configString = "$"; diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 75c94c544..9be7d46ef 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -467,7 +467,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, } // Get the list of configurations considered to be DEBUG. - std::vector const& debugConfigs = + std::vector debugConfigs = this->Makefile->GetCMakeInstance()->GetDebugConfigs(); std::string prop; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d2331cb34..bef8904bb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2283,24 +2283,12 @@ bool cmake::IsPropertyChained(const std::string& name, void cmake::SetProperty(const std::string& prop, const char* value) { - // Special hook to invalidate cached value. - if(prop == "DEBUG_CONFIGURATIONS") - { - this->DebugConfigs.clear(); - } - this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); } void cmake::AppendProperty(const std::string& prop, const char* value, bool asString) { - // Special hook to invalidate cached value. - if(prop == "DEBUG_CONFIGURATIONS") - { - this->DebugConfigs.clear(); - } - this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); } @@ -2758,27 +2746,24 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, } //---------------------------------------------------------------------------- -std::vector const& cmake::GetDebugConfigs() +std::vector cmake::GetDebugConfigs() { - // Compute on-demand. - if(this->DebugConfigs.empty()) + std::vector configs; + if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) { - if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) - { - // Expand the specified list and convert to upper-case. - cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); - std::transform(this->DebugConfigs.begin(), - this->DebugConfigs.end(), - this->DebugConfigs.begin(), - cmSystemTools::UpperCase); - } - // If no configurations were specified, use a default list. - if(this->DebugConfigs.empty()) - { - this->DebugConfigs.push_back("DEBUG"); - } + // Expand the specified list and convert to upper-case. + cmSystemTools::ExpandListArgument(config_list, configs); + std::transform(configs.begin(), + configs.end(), + configs.begin(), + cmSystemTools::UpperCase); } - return this->DebugConfigs; + // If no configurations were specified, use a default list. + if(configs.empty()) + { + configs.push_back("DEBUG"); + } + return configs; } diff --git a/Source/cmake.h b/Source/cmake.h index d2d3a85ec..0c3de651b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -359,7 +359,7 @@ class cmake /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ - std::vector const& GetDebugConfigs(); + std::vector GetDebugConfigs(); void SetCMakeEditCommand(std::string const& s) { this->CMakeEditCommand = s; } @@ -469,7 +469,6 @@ private: bool DebugTryCompile; cmFileTimeComparison* FileComparison; std::string GraphVizFile; - std::vector DebugConfigs; InstalledFilesMap InstalledFiles; void UpdateConversionPathTable(); From 6ed19e615bada326c38a2b27d9378959503094ae Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:09:15 +0200 Subject: [PATCH 0503/1029] cmake: Remove duplicate condition. --- Source/cmake.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bef8904bb..cf81ea456 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1530,11 +1530,7 @@ int cmake::ActualConfigure() if (!this->InTryCompile) { this->GlobalGenerator->ClearEnabledLanguages(); - } - // Truncate log files - if (!this->InTryCompile) - { this->TruncateOutputLog("CMakeOutput.log"); this->TruncateOutputLog("CMakeError.log"); } From 14c70b8c580c519ca38bcd9ba5ca8fc9e7629068 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:12:14 +0200 Subject: [PATCH 0504/1029] cmake: out-of-line try compile state methods. --- Source/cmake.cxx | 10 ++++++++++ Source/cmake.h | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cf81ea456..0cbb2994d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1935,6 +1935,16 @@ void cmake::UpdateProgress(const char *msg, float prog) } } +bool cmake::GetIsInTryCompile() const +{ + return this->InTryCompile; +} + +void cmake::SetIsInTryCompile(bool b) +{ + this->InTryCompile = b; +} + void cmake::GetGeneratorDocumentation(std::vector& v) { for(RegisteredGeneratorsVector::const_iterator i = diff --git a/Source/cmake.h b/Source/cmake.h index 0c3de651b..a9f791d74 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -257,10 +257,8 @@ class cmake bool directoriesSetBefore = false); ///! Is this cmake running as a result of a TRY_COMPILE command - bool GetIsInTryCompile() { return this->InTryCompile; } - - ///! Is this cmake running as a result of a TRY_COMPILE command - void SetIsInTryCompile(bool i) { this->InTryCompile = i; } + bool GetIsInTryCompile() const; + void SetIsInTryCompile(bool b); ///! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector&); From 23368c9b83cd62724e94d345e3af940b3cda8762 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:32:00 +0200 Subject: [PATCH 0505/1029] cmake: Use make_pair instead of Foo::value_type. It works with all supported compilers. --- Source/cmake.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0cbb2994d..8e09485f1 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -257,7 +257,7 @@ void cmake::RenameCommand(const std::string& oldName, delete pos->second; this->Commands.erase(pos); } - this->Commands.insert(RegisteredCommandsMap::value_type(sNewName, cmd)); + this->Commands.insert(std::make_pair(sNewName, cmd)); pos = this->Commands.find(sOldName); this->Commands.erase(pos); } @@ -283,7 +283,7 @@ void cmake::AddCommand(cmCommand* wg) delete pos->second; this->Commands.erase(pos); } - this->Commands.insert( RegisteredCommandsMap::value_type(name, wg)); + this->Commands.insert(std::make_pair(name, wg)); } From c57f086a81c487fa88c36a785865d27b81e3cb8d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:36:58 +0200 Subject: [PATCH 0506/1029] cmake: Don't lower-case a string needlessly. --- Source/cmake.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8e09485f1..8868ef64b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -243,12 +243,12 @@ void cmake::RenameCommand(const std::string& oldName, { // if the command already exists, free the old one std::string sOldName = cmSystemTools::LowerCase(oldName); - std::string sNewName = cmSystemTools::LowerCase(newName); RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName); if ( pos == this->Commands.end() ) { return; } + std::string sNewName = cmSystemTools::LowerCase(newName); cmCommand* cmd = pos->second; pos = this->Commands.find(sNewName); From 275185ac2b30b655b53100a129f5d7518ed943ad Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:44:18 +0200 Subject: [PATCH 0507/1029] cmake: Constify GetCommand method. --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8868ef64b..b27fefa8d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -226,11 +226,11 @@ bool cmake::CommandExists(const std::string& name) const return (this->Commands.find(sName) != this->Commands.end()); } -cmCommand *cmake::GetCommand(const std::string& name) +cmCommand *cmake::GetCommand(const std::string& name) const { cmCommand* rm = 0; std::string sName = cmSystemTools::LowerCase(name); - RegisteredCommandsMap::iterator pos = this->Commands.find(sName); + RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName); if (pos != this->Commands.end()) { rm = (*pos).second; diff --git a/Source/cmake.h b/Source/cmake.h index a9f791d74..c436c7773 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -247,7 +247,7 @@ class cmake /** * Get a command by its name */ - cmCommand *GetCommand(const std::string& name); + cmCommand *GetCommand(const std::string& name) const; /** Check if a command exists. */ bool CommandExists(const std::string& name) const; From 0f1f324b0dd7147850f923ab266873bd8a4a4353 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:45:12 +0200 Subject: [PATCH 0508/1029] cmake: Rename oddly named variables. --- Source/cmake.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b27fefa8d..f22989d77 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -228,14 +228,14 @@ bool cmake::CommandExists(const std::string& name) const cmCommand *cmake::GetCommand(const std::string& name) const { - cmCommand* rm = 0; + cmCommand* command = 0; std::string sName = cmSystemTools::LowerCase(name); RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName); if (pos != this->Commands.end()) { - rm = (*pos).second; + command = (*pos).second; } - return rm; + return command; } void cmake::RenameCommand(const std::string& oldName, @@ -273,9 +273,9 @@ void cmake::RemoveCommand(const std::string& name) } } -void cmake::AddCommand(cmCommand* wg) +void cmake::AddCommand(cmCommand* command) { - std::string name = cmSystemTools::LowerCase(wg->GetName()); + std::string name = cmSystemTools::LowerCase(command->GetName()); // if the command already exists, free the old one RegisteredCommandsMap::iterator pos = this->Commands.find(name); if (pos != this->Commands.end()) @@ -283,7 +283,7 @@ void cmake::AddCommand(cmCommand* wg) delete pos->second; this->Commands.erase(pos); } - this->Commands.insert(std::make_pair(name, wg)); + this->Commands.insert(std::make_pair(name, command)); } From 04b307b961a34c00f72d9031817ce4f918288701 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:33:27 +0200 Subject: [PATCH 0509/1029] cmake: Simplify CommandExists method. --- Source/cmake.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f22989d77..f62421455 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -222,8 +222,7 @@ void cmake::CleanupCommandsAndMacros() bool cmake::CommandExists(const std::string& name) const { - std::string sName = cmSystemTools::LowerCase(name); - return (this->Commands.find(sName) != this->Commands.end()); + return this->GetCommand(name) ? true : false; } cmCommand *cmake::GetCommand(const std::string& name) const From ecdb1b3bba991c13f3f61c7b00a80b8dd97567b2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:09:25 +0200 Subject: [PATCH 0510/1029] Add some missing includes. --- Source/cmFileCommand.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 93e3ac4fe..6ac0def71 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -15,6 +15,8 @@ #include "cmHexFileConverter.h" #include "cmInstallType.h" #include "cmFileTimeComparison.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmCryptoHash.h" #include "cmAlgorithms.h" From 6deb43e6c836a61536c3d6e36ca16b51013e9134 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:09:31 +0200 Subject: [PATCH 0511/1029] Remove some files which do not need to be in BootstrapCommands. --- Source/CMakeLists.txt | 4 ++++ Source/cmBootstrapCommands1.cxx | 1 - Source/cmBootstrapCommands2.cxx | 1 - bootstrap | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a8136..868e8b9b7 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -219,6 +219,8 @@ set(SRCS cmExportSet.cxx cmExportSetMap.h cmExportSetMap.cxx + cmExternalMakefileProjectGenerator.cxx + cmExternalMakefileProjectGenerator.h cmExtraCodeBlocksGenerator.cxx cmExtraCodeBlocksGenerator.h cmExtraCodeLiteGenerator.cxx @@ -244,6 +246,8 @@ set(SRCS cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h + cmGeneratorExpressionEvaluationFile.cxx + cmGeneratorExpressionEvaluationFile.h cmGeneratorExpressionEvaluator.cxx cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 4274d85b2..1b0abf498 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -42,7 +42,6 @@ #include "cmEndWhileCommand.cxx" #include "cmExecProgramCommand.cxx" #include "cmExecuteProcessCommand.cxx" -#include "cmExternalMakefileProjectGenerator.cxx" #include "cmFindBase.cxx" #include "cmFindCommon.cxx" #include "cmFileCommand.cxx" diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx index 5675295f5..e292a3a61 100644 --- a/Source/cmBootstrapCommands2.cxx +++ b/Source/cmBootstrapCommands2.cxx @@ -16,7 +16,6 @@ #include "cmCommands.h" #include "cmConditionEvaluator.cxx" #include "cmExpandedCommandArgument.cxx" -#include "cmGeneratorExpressionEvaluationFile.cxx" #include "cmGetCMakePropertyCommand.cxx" #include "cmGetDirectoryPropertyCommand.cxx" #include "cmGetFilenameComponentCommand.cxx" diff --git a/bootstrap b/bootstrap index 423980292..c7c66132f 100755 --- a/bootstrap +++ b/bootstrap @@ -264,7 +264,8 @@ CMAKE_CXX_SOURCES="\ cmExportTryCompileFileGenerator \ cmExportSet \ cmExportSetMap \ - cmInstallDirectoryGenerator \ + cmExternalMakefileProjectGenerator \ + cmGeneratorExpressionEvaluationFile \ cmGeneratedFileStream \ cmGeneratorTarget \ cmGeneratorExpressionContext \ @@ -275,6 +276,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ + cmInstallDirectoryGenerator \ cmLocalGenerator \ cmInstalledFile \ cmInstallGenerator \ From 57dd094eded03a94402b6eecf7027325bd7b5136 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 02:44:41 +0200 Subject: [PATCH 0512/1029] Use vector, not list for cmCommand storage. --- Source/cmBootstrapCommands1.cxx | 2 +- Source/cmBootstrapCommands2.cxx | 2 +- Source/cmCommands.cxx.in | 2 +- Source/cmCommands.h | 8 ++++---- Source/cmCommandsForBootstrap.cxx | 2 +- Source/cmake.cxx | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 1b0abf498..118451432 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -55,7 +55,7 @@ #include "cmPathLabel.cxx" #include "cmSearchPath.cxx" -void GetBootstrapCommands1(std::list& commands) +void GetBootstrapCommands1(std::vector& commands) { commands.push_back(new cmAddCustomCommandCommand); commands.push_back(new cmAddCustomTargetCommand); diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx index e292a3a61..e522d8c79 100644 --- a/Source/cmBootstrapCommands2.cxx +++ b/Source/cmBootstrapCommands2.cxx @@ -59,7 +59,7 @@ #include "cmUnsetCommand.cxx" #include "cmWhileCommand.cxx" -void GetBootstrapCommands2(std::list& commands) +void GetBootstrapCommands2(std::vector& commands) { commands.push_back(new cmGetCMakePropertyCommand); commands.push_back(new cmGetDirectoryPropertyCommand); diff --git a/Source/cmCommands.cxx.in b/Source/cmCommands.cxx.in index f0745d780..e23bbd1e3 100644 --- a/Source/cmCommands.cxx.in +++ b/Source/cmCommands.cxx.in @@ -13,7 +13,7 @@ @COMMAND_INCLUDES@ -void GetPredefinedCommands(std::list& commands) +void GetPredefinedCommands(std::vector& commands) { @NEW_COMMANDS@ } diff --git a/Source/cmCommands.h b/Source/cmCommands.h index e90285386..7a94423a4 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -13,7 +13,7 @@ #define cmCommands_h #include "cmStandardIncludes.h" -#include +#include class cmCommand; /** @@ -23,9 +23,9 @@ class cmCommand; * It is up to the caller to delete the commands created by this * call. */ -void GetBootstrapCommands1(std::list& commands); -void GetBootstrapCommands2(std::list& commands); -void GetPredefinedCommands(std::list& commands); +void GetBootstrapCommands1(std::vector& commands); +void GetBootstrapCommands2(std::vector& commands); +void GetPredefinedCommands(std::vector& commands); #endif diff --git a/Source/cmCommandsForBootstrap.cxx b/Source/cmCommandsForBootstrap.cxx index 15b664eee..5f397a1fb 100644 --- a/Source/cmCommandsForBootstrap.cxx +++ b/Source/cmCommandsForBootstrap.cxx @@ -11,6 +11,6 @@ ============================================================================*/ #include "cmCommands.h" -void GetPredefinedCommands(std::list&) +void GetPredefinedCommands(std::vector&) { } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f62421455..1d067a596 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1804,11 +1804,11 @@ const char* cmake::GetCacheDefinition(const std::string& name) const void cmake::AddDefaultCommands() { - std::list commands; + std::vector commands; GetBootstrapCommands1(commands); GetBootstrapCommands2(commands); GetPredefinedCommands(commands); - for(std::list::iterator i = commands.begin(); + for(std::vector::iterator i = commands.begin(); i != commands.end(); ++i) { this->AddCommand(*i); From 0ee3ccb3b0a25264e8302a150eee297dd40affde Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 19:32:48 +0200 Subject: [PATCH 0513/1029] cmake: Fix variable name bugs. --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1d067a596..f182ad248 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1112,9 +1112,9 @@ void cmake::SetHomeDirectory(const std::string& dir) cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } -void cmake::SetHomeOutputDirectory(const std::string& lib) +void cmake::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = lib; + this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); } diff --git a/Source/cmake.h b/Source/cmake.h index c436c7773..26ee8fe3c 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -117,7 +117,7 @@ class cmake { return this->cmHomeDirectory.c_str(); } - void SetHomeOutputDirectory(const std::string& lib); + void SetHomeOutputDirectory(const std::string& dir); const char* GetHomeOutputDirectory() const { return this->HomeOutputDirectory.c_str(); @@ -141,9 +141,9 @@ class cmake { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const std::string& lib) + void SetStartOutputDirectory(const std::string& dir) { - this->StartOutputDirectory = lib; + this->StartOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); } const char* GetStartOutputDirectory() const From 6241253a4b20e74625b855b1e0d5220c8e7282b1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:10:40 +0200 Subject: [PATCH 0514/1029] cmake: Out-of-line Home and Start directory methods. --- Source/cmake.cxx | 32 ++++++++++++++++++++++++++++++++ Source/cmake.h | 32 ++++++-------------------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f182ad248..ec05a0ed4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1112,12 +1112,44 @@ void cmake::SetHomeDirectory(const std::string& dir) cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } +const char* cmake::GetHomeDirectory() const +{ + return this->cmHomeDirectory.c_str(); +} + void cmake::SetHomeOutputDirectory(const std::string& dir) { this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); } +const char* cmake::GetHomeOutputDirectory() const +{ + return this->HomeOutputDirectory.c_str(); +} + +const char* cmake::GetStartDirectory() const +{ + return this->cmStartDirectory.c_str(); +} + +void cmake::SetStartDirectory(const std::string& dir) +{ + this->cmStartDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); +} + +const char* cmake::GetStartOutputDirectory() const +{ + return this->StartOutputDirectory.c_str(); +} + +void cmake::SetStartOutputDirectory(const std::string& dir) +{ + this->StartOutputDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); +} + void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { if(!gg) diff --git a/Source/cmake.h b/Source/cmake.h index 26ee8fe3c..87b771d8f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -113,15 +113,9 @@ class cmake * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const std::string& dir); - const char* GetHomeDirectory() const - { - return this->cmHomeDirectory.c_str(); - } + const char* GetHomeDirectory() const; void SetHomeOutputDirectory(const std::string& dir); - const char* GetHomeOutputDirectory() const - { - return this->HomeOutputDirectory.c_str(); - } + const char* GetHomeOutputDirectory() const; //@} //@{ @@ -132,24 +126,10 @@ class cmake * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const std::string& dir) - { - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); - } - const char* GetStartDirectory() const - { - return this->cmStartDirectory.c_str(); - } - void SetStartOutputDirectory(const std::string& dir) - { - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); - } - const char* GetStartOutputDirectory() const - { - return this->StartOutputDirectory.c_str(); - } + void SetStartDirectory(const std::string& dir); + const char* GetStartDirectory() const; + void SetStartOutputDirectory(const std::string& dir); + const char* GetStartOutputDirectory() const; //@} /** From 7bb4e3db069e06fe2eac053e329ffb9f1ea322bf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:10:45 +0200 Subject: [PATCH 0515/1029] cmMakefile: Out-of-line Home directory accessors. --- Source/cmMakefile.cxx | 10 ++++++++++ Source/cmMakefile.h | 10 ++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 34b46218d..dea9e4601 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3461,6 +3461,11 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } +const char* cmMakefile::GetHomeDirectory() const +{ + return this->cmHomeDirectory.c_str(); +} + void cmMakefile::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; @@ -3472,6 +3477,11 @@ void cmMakefile::SetHomeDirectory(const std::string& dir) } } +const char* cmMakefile::GetHomeOutputDirectory() const +{ + return this->HomeOutputDirectory.c_str(); +} + void cmMakefile::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5209891d2..823acb143 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -438,15 +438,9 @@ public: * and going up until it reaches the HomeDirectory. */ void SetHomeDirectory(const std::string& dir); - const char* GetHomeDirectory() const - { - return this->cmHomeDirectory.c_str(); - } + const char* GetHomeDirectory() const; void SetHomeOutputDirectory(const std::string& lib); - const char* GetHomeOutputDirectory() const - { - return this->HomeOutputDirectory.c_str(); - } + const char* GetHomeOutputDirectory() const; //@} /** From fca2b542b43546c64aa2c474b810890e52bd0ea4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 20:10:48 +0200 Subject: [PATCH 0516/1029] cmMakefile: Internalize setting of CMakeInstance on Properties. --- Source/cmLocalGenerator.cxx | 1 - Source/cmMakefile.cxx | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1998e420..c143bce83 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -252,7 +252,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) this->Makefile->SetLocalGenerator(this); // setup the home directories - this->Makefile->GetProperties().SetCMakeInstance(gg->GetCMakeInstance()); this->Makefile->SetHomeDirectory( gg->GetCMakeInstance()->GetHomeDirectory()); this->Makefile->SetHomeOutputDirectory( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dea9e4601..35be1b7e2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -741,6 +741,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); #endif + this->Properties.SetCMakeInstance(this->GetCMakeInstance()); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); } From 6ad86c7fc4167561c7c13c28482a5fea0fe9d70b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 18:47:24 +0200 Subject: [PATCH 0517/1029] cmMakefile: Remove bad comment. --- Source/cmMakefile.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 35be1b7e2..ec0a16517 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1658,7 +1658,6 @@ void cmMakefile::InitializeFromParent() void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) { - // copy our variables from the child makefile lg2->GetMakefile()->InitializeFromParent(); lg2->GetMakefile()->MakeStartDirectoriesCurrent(); if (this->GetCMakeInstance()->GetDebugOutput()) From ea819b29f8735ca09242cc646a7b25e933bc913c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 18:34:12 +0200 Subject: [PATCH 0518/1029] cmMakefile: Remove unused method. --- Source/cmMakefile.cxx | 27 --------------------------- Source/cmMakefile.h | 1 - 2 files changed, 28 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ec0a16517..35fdd0cc0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1676,33 +1676,6 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } } -void cmMakefile::AddSubDirectory(const std::string& sub, - bool excludeFromAll) -{ - // the source path must be made full if it isn't already - std::string srcPath = sub; - if (!cmSystemTools::FileIsFullPath(srcPath.c_str())) - { - srcPath = this->GetCurrentDirectory(); - srcPath += "/"; - srcPath += sub; - } - - // binary path must be made full if it isn't already - std::string binPath = sub; - if (!cmSystemTools::FileIsFullPath(binPath.c_str())) - { - binPath = this->GetCurrentOutputDirectory(); - binPath += "/"; - binPath += sub; - } - - - this->AddSubDirectory(srcPath, binPath, - excludeFromAll, false); -} - - void cmMakefile::AddSubDirectory(const std::string& srcPath, const std::string& binPath, bool excludeFromAll, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 823acb143..b78f921f2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -281,7 +281,6 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const std::string&, bool excludeFromAll=false); void AddSubDirectory(const std::string& fullSrcDir, const std::string& fullBinDir, bool excludeFromAll, From 07d44d638bca028d2a76fb1ffdc1f1542184243c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 19:22:09 +0200 Subject: [PATCH 0519/1029] cmake: Remove confusing duplication. --- Source/cmake.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ec05a0ed4..7ccd76aef 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -843,12 +843,8 @@ void cmake::SetArgs(const std::vector& args, { this->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - this->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - this->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); } this->SetStartDirectory(this->GetHomeDirectory()); From 74c8b9284469dcc8b5a1e7fe23dae1bdc7aad468 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 13 Apr 2015 00:01:04 -0400 Subject: [PATCH 0520/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 349c95487..f91acbe57 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150412) +set(CMake_VERSION_PATCH 20150413) #set(CMake_VERSION_RC 1) From a198839a7b110a47d76d47e342b1c63f908e6878 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 9 Apr 2015 20:56:43 +0200 Subject: [PATCH 0521/1029] CTest: Fix locale used for VCS updates 6a661f06030b85b4484733375bbb0aa23eca7446 fixed the locale used for message output but at the same time broke the locale used for filename encodings. This commit preserves LC_CTYPE in the presence of LC_ALL. --- Source/CMakeLists.txt | 2 + Source/CTest/cmCTestUpdateHandler.cxx | 43 +---------------- Source/cmCLocaleEnvironmentScope.cxx | 67 +++++++++++++++++++++++++++ Source/cmCLocaleEnvironmentScope.h | 32 +++++++++++++ 4 files changed, 103 insertions(+), 41 deletions(-) create mode 100644 Source/cmCLocaleEnvironmentScope.cxx create mode 100644 Source/cmCLocaleEnvironmentScope.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a8136..7af6da3e8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -159,6 +159,8 @@ set(SRCS cmCacheManager.cxx cmCacheManager.h "${CMAKE_CURRENT_BINARY_DIR}/cmCommands.cxx" + cmCLocaleEnvironmentScope.h + cmCLocaleEnvironmentScope.cxx cmCommands.h cmCommandArgumentLexer.cxx cmCommandArgumentParser.cxx diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index b9da8a01d..10927e78c 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -21,6 +21,7 @@ #include "cmGeneratedFileStream.h" #include "cmXMLParser.h" #include "cmXMLSafe.h" +#include "cmCLocaleEnvironmentScope.h" #include "cmCTestVC.h" #include "cmCTestCVS.h" @@ -66,46 +67,6 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type) return cmCTestUpdateHandlerUpdateStrings[type]; } -class cmCTestUpdateHandlerLocale -{ -public: - cmCTestUpdateHandlerLocale(); - ~cmCTestUpdateHandlerLocale(); -private: - std::string saveLCAll; -}; - -cmCTestUpdateHandlerLocale::cmCTestUpdateHandlerLocale() -{ - const char* lcall = cmSystemTools::GetEnv("LC_ALL"); - if(lcall) - { - saveLCAll = lcall; - } - // if LC_ALL is not set to C, then - // set it, so that svn/cvs info will be in english ascii - if(! (lcall && strcmp(lcall, "C") == 0)) - { - cmSystemTools::PutEnv("LC_ALL=C"); - } -} - -cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale() -{ - // restore the value of LC_ALL after running the version control - // commands - if(!saveLCAll.empty()) - { - std::string put = "LC_ALL="; - put += saveLCAll; - cmSystemTools::PutEnv(put); - } - else - { - cmSystemTools::UnsetEnv("LC_ALL"); - } -} - //---------------------------------------------------------------------- cmCTestUpdateHandler::cmCTestUpdateHandler() { @@ -194,7 +155,7 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) int cmCTestUpdateHandler::ProcessHandler() { // Make sure VCS tool messages are in English so we can parse them. - cmCTestUpdateHandlerLocale fixLocale; + cmCLocaleEnvironmentScope fixLocale; static_cast(fixLocale); // Get source dir diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx new file mode 100644 index 000000000..579230274 --- /dev/null +++ b/Source/cmCLocaleEnvironmentScope.cxx @@ -0,0 +1,67 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmCLocaleEnvironmentScope.h" + +#include "cmSystemTools.h" + +#include + +cmCLocaleEnvironmentScope::cmCLocaleEnvironmentScope() +{ + this->SetEnv("LANGUAGE", ""); + this->SetEnv("LC_MESSAGES", "C"); + + std::string lcAll = this->GetEnv("LC_ALL"); + + if(!lcAll.empty()) + { + this->SetEnv("LC_ALL", ""); + this->SetEnv("LC_CTYPE", lcAll); + } +} + +std::string cmCLocaleEnvironmentScope::GetEnv(std::string const& key) +{ + const char* value = cmSystemTools::GetEnv(key); + return value ? value : std::string(); +} + +void cmCLocaleEnvironmentScope::SetEnv( + std::string const& key, std::string const& value) +{ + std::string oldValue = this->GetEnv(key); + + this->EnvironmentBackup.insert(std::make_pair(key, oldValue)); + + if(value.empty()) + { + cmSystemTools::UnsetEnv(key.c_str()); + } + else + { + std::stringstream tmp; + tmp << key << "=" << value; + cmSystemTools::PutEnv(tmp.str()); + } +} + +cmCLocaleEnvironmentScope::~cmCLocaleEnvironmentScope() +{ + for(backup_map_t::const_iterator i = this->EnvironmentBackup.begin(); + i != this->EnvironmentBackup.end(); ++i) + { + std::stringstream tmp; + tmp << i->first << "=" << i->second; + cmSystemTools::PutEnv(tmp.str()); + } +} diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h new file mode 100644 index 000000000..b011741a3 --- /dev/null +++ b/Source/cmCLocaleEnvironmentScope.h @@ -0,0 +1,32 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmCLocaleEnvironmentScope_h +#define cmCLocaleEnvironmentScope_h + +#include "cmStandardIncludes.h" + +class cmCLocaleEnvironmentScope +{ +public: + cmCLocaleEnvironmentScope(); + ~cmCLocaleEnvironmentScope(); + +private: + std::string GetEnv(std::string const& key); + void SetEnv(std::string const& key, std::string const& value); + + typedef std::map backup_map_t; + backup_map_t EnvironmentBackup; +}; + +#endif From d34d5a370ec656aab6f980218d74002789fedfff Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 10 Apr 2015 08:55:18 -0400 Subject: [PATCH 0522/1029] KWSys 2015-04-10 (69bccf2e) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 69bccf2e | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 9367a33b..69bccf2e Brad King (1): 69bccf2e SystemTools: Teach Touch with !create to succeed on missing file Change-Id: I4af502542578b6a16ca4ddffb03553a046378e56 --- SystemTools.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 8a481d654..6c4a7a675 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -1260,15 +1260,22 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path) bool SystemTools::Touch(const kwsys_stl::string& filename, bool create) { - if(create && !SystemTools::FileExists(filename)) + if (!SystemTools::FileExists(filename)) { - FILE* file = Fopen(filename, "a+b"); - if(file) + if(create) + { + FILE* file = Fopen(filename, "a+b"); + if(file) + { + fclose(file); + return true; + } + return false; + } + else { - fclose(file); return true; } - return false; } #if defined(_WIN32) && !defined(__CYGWIN__) HANDLE h = CreateFileW( From bb2a42aeca46c993f1a8790aadfa0e86d5e30f9b Mon Sep 17 00:00:00 2001 From: Raffi Enficiaud Date: Fri, 10 Apr 2015 22:52:16 +0200 Subject: [PATCH 0523/1029] Tests: Increasing the stability of the FindMatlab.basic_checks test Increase the timeout to tolerate longer network delays. --- Tests/FindMatlab/basic_checks/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt index acf71ea97..bf5442767 100644 --- a/Tests/FindMatlab/basic_checks/CMakeLists.txt +++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt @@ -24,7 +24,7 @@ matlab_add_mex( matlab_add_unit_test( NAME ${PROJECT_NAME}_matlabtest-1 - TIMEOUT 30 + TIMEOUT 90 UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m ADDITIONAL_PATH $ ) From a6b1ad1309d14668e572da7937a2a8dda9e1f669 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 21:20:12 +0200 Subject: [PATCH 0524/1029] Introduce cmState class. At this point, it is an interface to the cache. It will be extended to be a universal interface for access to and manipulation of configuration-time data (defintions, properties on targets, directories, source files etc). This will allow porting all command implementations away from the cmMakefile and cmTarget classes, and result in something more-purely related to configuration-time processing of cmake commands. That should serve at least the following goals: * Split the CMake implementation more definitively into three stages: Configuration, computation and generation, and be able to implement each optimally for memory access patterns etc. * Make better IDE integration possible by making more configuration data available. * Make it possiblte to use a smaller library than CMakeLib.a in cpack and ctest, resulting in smaller executables. * Make it possible to run the configure step multiple times in the same CMake run (#14539). Manage its lifetime in the cmake class, and add a convenience accessor to cmMakefile. --- Source/CMakeLists.txt | 2 + Source/cmCacheManager.h | 1 + Source/cmMakefile.cxx | 6 ++ Source/cmMakefile.h | 1 + Source/cmState.cxx | 147 ++++++++++++++++++++++++++++++++++++++++ Source/cmState.h | 62 +++++++++++++++++ Source/cmake.cxx | 4 ++ Source/cmake.h | 6 ++ bootstrap | 1 + 9 files changed, 230 insertions(+) create mode 100644 Source/cmState.cxx create mode 100644 Source/cmState.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a8136..c847bc8e8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -323,6 +323,8 @@ set(SRCS cmSourceFileLocation.h cmSourceGroup.cxx cmSourceGroup.h + cmState.cxx + cmState.h cmSystemTools.cxx cmSystemTools.h cmTarget.cxx diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 3b02fa6c5..64c7c0d53 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -249,6 +249,7 @@ private: // Only cmake and cmMakefile should be able to add cache values // the commands should never use the cmCacheManager directly friend class cmMakefile; // allow access to add cache values + friend class cmState; // allow access to add cache values friend class cmake; // allow access to add cache values friend class cmMarkAsAdvancedCommand; // allow access to add cache values }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 34b46218d..fefa648d4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmCommands.h" #include "cmCacheManager.h" +#include "cmState.h" #include "cmFunctionBlocker.h" #include "cmListFileCache.h" #include "cmCommandArgumentParserHelper.h" @@ -3738,6 +3739,11 @@ cmCacheManager *cmMakefile::GetCacheManager() const return this->GetCMakeInstance()->GetCacheManager(); } +cmState *cmMakefile::GetState() const +{ + return this->GetCMakeInstance()->GetState(); +} + void cmMakefile::DisplayStatus(const char* message, float s) const { cmake* cm = this->GetLocalGenerator()->GetGlobalGenerator() diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5209891d2..49bab4cec 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -766,6 +766,7 @@ public: void EnableLanguage(std::vectorconst& languages, bool optional); cmCacheManager *GetCacheManager() const; + cmState *GetState() const; /** * Get the variable watch. This is used to determine when certain variables diff --git a/Source/cmState.cxx b/Source/cmState.cxx new file mode 100644 index 000000000..f5e3752ca --- /dev/null +++ b/Source/cmState.cxx @@ -0,0 +1,147 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmState.h" + +#include "cmake.h" + +cmState::cmState(cmake* cm) + : CMakeInstance(cm) +{ +} +cmCacheManager::CacheEntryType +cmState::StringToCacheEntryType(const char* s) +{ + return cmCacheManager::StringToType(s); +} + +const char* +cmState::CacheEntryTypeToString(cmCacheManager::CacheEntryType t) +{ + return cmCacheManager::TypeToString(t); +} + +bool cmState::IsCacheEntryType(std::string const& key) +{ + return cmCacheManager::IsType(key.c_str()); +} + +std::vector cmState::GetCacheEntryKeys() const +{ + std::vector definitions; + definitions.reserve(this->CMakeInstance->GetCacheManager()->GetSize()); + cmCacheManager::CacheIterator cit = + this->CMakeInstance->GetCacheManager()->GetCacheIterator(); + for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) + { + definitions.push_back(cit.GetName()); + } + return definitions; +} + +const char* cmState::GetCacheEntryValue(std::string const& key) const +{ + cmCacheManager::CacheEntry* e = this->CMakeInstance->GetCacheManager() + ->GetCacheEntry(key); + if (!e) + { + return 0; + } + return e->Value.c_str(); +} + +const char* +cmState::GetInitializedCacheValue(std::string const& key) const +{ + return this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue(key); +} + +cmCacheManager::CacheEntryType +cmState::GetCacheEntryType(std::string const& key) const +{ + cmCacheManager::CacheIterator it = + this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str()); + return it.GetType(); +} + +void cmState::SetCacheEntryValue(std::string const& key, + std::string const& value) +{ + this->CMakeInstance->GetCacheManager()->SetCacheEntryValue(key, value); +} + +void cmState::SetCacheEntryProperty(std::string const& key, + std::string const& propertyName, + std::string const& value) +{ + cmCacheManager::CacheIterator it = + this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str()); + it.SetProperty(propertyName, value.c_str()); +} + +void cmState::SetCacheEntryBoolProperty(std::string const& key, + std::string const& propertyName, + bool value) +{ + cmCacheManager::CacheIterator it = + this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str()); + it.SetProperty(propertyName, value); +} + +const char* cmState::GetCacheEntryProperty(std::string const& key, + std::string const& propertyName) +{ + cmCacheManager::CacheIterator it = this->CMakeInstance->GetCacheManager() + ->GetCacheIterator(key.c_str()); + if (!it.PropertyExists(propertyName)) + { + return 0; + } + return it.GetProperty(propertyName); +} + +bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, + std::string const& propertyName) +{ + return this->CMakeInstance->GetCacheManager() + ->GetCacheIterator(key.c_str()).GetPropertyAsBool(propertyName); +} + +void cmState::AddCacheEntry(const std::string& key, const char* value, + const char* helpString, + cmCacheManager::CacheEntryType type) +{ + this->CMakeInstance->GetCacheManager()->AddCacheEntry(key, value, + helpString, type); +} + +void cmState::RemoveCacheEntry(std::string const& key) +{ + this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(key); +} + +void cmState::AppendCacheEntryProperty(const std::string& key, + const std::string& property, + const std::string& value, + bool asString) +{ + this->CMakeInstance->GetCacheManager() + ->GetCacheIterator(key.c_str()).AppendProperty(property, + value.c_str(), + asString); +} + +void cmState::RemoveCacheEntryProperty(std::string const& key, + std::string const& propertyName) +{ + this->CMakeInstance->GetCacheManager() + ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0); +} diff --git a/Source/cmState.h b/Source/cmState.h new file mode 100644 index 000000000..06b0ec69e --- /dev/null +++ b/Source/cmState.h @@ -0,0 +1,62 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Stephen Kelly + + 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. +============================================================================*/ +#ifndef cmState_h +#define cmState_h + +#include "cmCacheManager.h" + +class cmake; + +class cmState +{ +public: + cmState(cmake* cm); + + static cmCacheManager::CacheEntryType StringToCacheEntryType(const char*); + static const char* CacheEntryTypeToString(cmCacheManager::CacheEntryType); + static bool IsCacheEntryType(std::string const& key); + + std::vector GetCacheEntryKeys() const; + const char* GetCacheEntryValue(std::string const& key) const; + const char* GetInitializedCacheValue(std::string const& key) const; + cmCacheManager::CacheEntryType + GetCacheEntryType(std::string const& key) const; + void SetCacheEntryValue(std::string const& key, std::string const& value); + void SetCacheValue(std::string const& key, std::string const& value); + + void AddCacheEntry(const std::string& key, const char* value, + const char* helpString, + cmCacheManager::CacheEntryType type); + void RemoveCacheEntry(std::string const& key); + + void SetCacheEntryProperty(std::string const& key, + std::string const& propertyName, + std::string const& value); + void SetCacheEntryBoolProperty(std::string const& key, + std::string const& propertyName, + bool value); + const char* GetCacheEntryProperty(std::string const& key, + std::string const& propertyName); + bool GetCacheEntryPropertyAsBool(std::string const& key, + std::string const& propertyName); + void AppendCacheEntryProperty(std::string const& key, + const std::string& property, + const std::string& value, + bool asString = false); + void RemoveCacheEntryProperty(std::string const& key, + std::string const& propertyName); + +private: + cmake* CMakeInstance; +}; + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 64b332ccc..c419edc76 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -21,6 +21,7 @@ #include "cmTest.h" #include "cmDocumentationFormatter.h" #include "cmAlgorithms.h" +#include "cmState.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmGraphVizWriter.h" @@ -133,6 +134,8 @@ cmake::cmake() this->FileComparison = new cmFileTimeComparison; this->Policies = new cmPolicies(); + this->State = new cmState(this); + this->InitializeProperties(); #ifdef __APPLE__ @@ -171,6 +174,7 @@ cmake::~cmake() { delete this->CacheManager; delete this->Policies; + delete this->State; if (this->GlobalGenerator) { delete this->GlobalGenerator; diff --git a/Source/cmake.h b/Source/cmake.h index 3acf4a82f..0b24ed6ef 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -32,6 +32,7 @@ class cmDocumentationSection; class cmPolicies; class cmTarget; class cmGeneratedFileStream; +class cmState; /** \brief Represents a cmake invocation. * @@ -387,6 +388,9 @@ class cmake void UnwatchUnusedCli(const std::string& var); void WatchUnusedCli(const std::string& var); + + cmState* GetState() const { return this->State; } + protected: void RunCheckForUnusedVariables(); void InitializeProperties(); @@ -475,6 +479,8 @@ private: std::vector DebugConfigs; InstalledFilesMap InstalledFiles; + cmState* State; + void UpdateConversionPathTable(); }; diff --git a/bootstrap b/bootstrap index 423980292..69855b4de 100755 --- a/bootstrap +++ b/bootstrap @@ -285,6 +285,7 @@ CMAKE_CXX_SOURCES="\ cmScriptGenerator \ cmSourceFile \ cmSourceFileLocation \ + cmState \ cmSystemTools \ cmTestGenerator \ cmVersion \ From ff7169a03c2ae2e7a0440c1f2921b7ce6b2e486c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 10:52:45 +0200 Subject: [PATCH 0525/1029] Port to cmState. --- Source/CursesDialog/ccmake.cxx | 1 - .../cmCursesCacheEntryComposite.cxx | 7 +- .../CursesDialog/cmCursesLongMessageForm.cxx | 1 - Source/CursesDialog/cmCursesMainForm.cxx | 47 ++++++----- Source/QtDialog/QCMake.cxx | 36 ++++---- Source/cmCommandArgumentParserHelper.cxx | 3 +- Source/cmExtraEclipseCDT4Generator.cxx | 3 +- Source/cmFindBase.cxx | 9 +- Source/cmGetPropertyCommand.cxx | 5 +- Source/cmGlobalGenerator.cxx | 13 +-- Source/cmMakefile.cxx | 27 +++--- Source/cmMarkAsAdvancedCommand.cxx | 12 +-- Source/cmOptionCommand.cxx | 8 +- Source/cmSetCommand.cxx | 6 +- Source/cmSetPropertyCommand.cxx | 13 ++- Source/cmTryRunCommand.cxx | 14 ++-- Source/cmVariableRequiresCommand.cxx | 8 +- Source/cmake.cxx | 83 +++++++++---------- Source/cmakemain.cxx | 11 +-- 19 files changed, 156 insertions(+), 151 deletions(-) diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 3d92a2dfd..e013f8167 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -9,7 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "../cmCacheManager.h" #include "../cmSystemTools.h" #include "../cmake.h" #include "../cmDocumentation.h" diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 4f028c42a..4eb8e6cdc 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -19,6 +19,7 @@ #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" #include "../cmake.h" +#include "../cmState.h" #include @@ -50,9 +51,9 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } this->Entry = 0; - const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); + const char* value = cm->GetState()->GetCacheEntryValue(key); assert(value); - switch (cm->GetCacheManager()->GetCacheEntryType(key)) + switch (cm->GetState()->GetCacheEntryType(key)) { case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); @@ -75,7 +76,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( break; case cmCacheManager::STRING: { - const char* stringsProp = cm->GetCacheManager() + const char* stringsProp = cm->GetState() ->GetCacheEntryProperty(key, "STRINGS"); if(stringsProp) { diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 057f8f3d8..67e4aab2b 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -9,7 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "../cmCacheManager.h" #include "../cmSystemTools.h" #include "../cmake.h" #include "../cmVersion.h" diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 833d54038..b067743c3 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -23,6 +23,7 @@ #include "cmCursesCacheEntryComposite.h" #include "cmCursesLongMessageForm.h" #include "cmAlgorithms.h" +#include "cmState.h" inline int ctrl(int z) @@ -107,17 +108,17 @@ void cmCursesMainForm::InitializeUI() // which contain labels, entries and new entry markers std::vector* newEntries = new std::vector; - newEntries->reserve(this->CMakeInstance->GetCacheManager()->GetSize()); + std::vector cacheKeys = + this->CMakeInstance->GetState()->GetCacheEntryKeys(); + newEntries->reserve(cacheKeys.size()); // Count non-internal and non-static entries int count=0; - std::vector cacheKeys = - this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys(); for(std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); if (t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && @@ -147,7 +148,7 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); if (t == cmCacheManager::INTERNAL || t == cmCacheManager::STATIC || @@ -171,7 +172,7 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); if (t == cmCacheManager::INTERNAL || t == cmCacheManager::STATIC || @@ -225,10 +226,10 @@ void cmCursesMainForm::RePost() for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -257,10 +258,10 @@ void cmCursesMainForm::RePost() for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -329,10 +330,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -352,10 +353,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -516,10 +517,10 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // Get the help string of the current entry // and add it to the help string const char* existingValue = - this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField); + this->CMakeInstance->GetState()->GetCacheEntryValue(curField); if (existingValue) { - const char* hs = this->CMakeInstance->GetCacheManager() + const char* hs = this->CMakeInstance->GetState() ->GetCacheEntryProperty(curField, "HELPSTRING"); if ( hs ) { @@ -814,7 +815,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() for(size_t i=0; i < size; i++) { std::string cacheKey = (*this->Entries)[i]->Key; - const char* existingValue = this->CMakeInstance->GetCacheManager() + const char* existingValue = this->CMakeInstance->GetState() ->GetCacheEntryValue(cacheKey); if (existingValue) { @@ -823,7 +824,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() std::string fixedOldValue; std::string fixedNewValue; cmCacheManager::CacheEntryType t = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryType(cacheKey); this->FixValue(t, oldValue, fixedOldValue); this->FixValue(t, newValue, fixedNewValue); @@ -831,9 +832,9 @@ void cmCursesMainForm::FillCacheManagerFromUI() if(!(fixedOldValue == fixedNewValue)) { // The user has changed the value. Mark it as modified. - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true); - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->SetCacheEntryValue(cacheKey, fixedNewValue); } } @@ -1046,11 +1047,11 @@ void cmCursesMainForm::HandleInput() const char* helpString = 0; const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue(curField); if (existingValue) { - helpString = this->CMakeInstance->GetCacheManager() + helpString = this->CMakeInstance->GetState() ->GetCacheEntryProperty(curField, "HELPSTRING"); } if (helpString) @@ -1161,7 +1162,7 @@ void cmCursesMainForm::HandleInput() field_userptr(this->Fields[findex-2])); if ( lbl ) { - this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue()); + this->CMakeInstance->GetState()->RemoveCacheEntry(lbl->GetValue()); std::string nextVal; if (nextCur) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 08d53ce27..775c11c38 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -16,7 +16,7 @@ #include #include "cmake.h" -#include "cmCacheManager.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmExternalMakefileProjectGenerator.h" @@ -94,7 +94,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) { this->BinaryDirectory = QDir::fromNativeSeparators(dir); emit this->binaryDirChanged(this->BinaryDirectory); - cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); + cmState* state = this->CMakeInstance->GetState(); this->setGenerator(QString()); if(!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) @@ -110,15 +110,15 @@ void QCMake::setBinaryDirectory(const QString& _dir) QCMakePropertyList props = this->properties(); emit this->propertiesChanged(props); - const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); if (homeDir) { setSourceDirectory(QString::fromLocal8Bit(homeDir)); } - const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR"); + const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR"); if (gen) { - const char* extraGen = cachem + const char* extraGen = state ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: CreateFullGeneratorName(gen, extraGen? extraGen : ""); @@ -195,12 +195,12 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) QStringList toremove; // set the value of properties - cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - std::vector cacheKeys = cachem->GetCacheEntryKeys(); + cmState* state = this->CMakeInstance->GetState(); + std::vector cacheKeys = state->GetCacheEntryKeys(); for(std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it); + cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*it); if(t == cmCacheManager::INTERNAL || t == cmCacheManager::STATIC) { @@ -219,11 +219,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) prop = props[idx]; if(prop.Value.type() == QVariant::Bool) { - cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF"); + state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF"); } else { - cachem->SetCacheEntryValue(*it, + state->SetCacheEntryValue(*it, prop.Value.toString().toLocal8Bit().data()); } props.removeAt(idx); @@ -236,7 +236,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) { this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data()); - cachem->RemoveCacheEntry(s.toLocal8Bit().data()); + state->RemoveCacheEntry(s.toLocal8Bit().data()); } // add some new properites @@ -281,12 +281,12 @@ QCMakePropertyList QCMake::properties() const { QCMakePropertyList ret; - cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); - std::vector cacheKeys = cachem->GetCacheEntryKeys(); + cmState* state = this->CMakeInstance->GetState(); + std::vector cacheKeys = state->GetCacheEntryKeys(); for (std::vector::const_iterator i = cacheKeys.begin(); i != cacheKeys.end(); ++i) { - cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i); + cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*i); if(t == cmCacheManager::INTERNAL || t == cmCacheManager::STATIC || t == cmCacheManager::UNINITIALIZED) @@ -294,14 +294,14 @@ QCMakePropertyList QCMake::properties() const continue; } - const char* cachedValue = cachem->GetCacheEntryValue(*i); + const char* cachedValue = state->GetCacheEntryValue(*i); QCMakeProperty prop; prop.Key = QString::fromLocal8Bit(i->c_str()); prop.Help = QString::fromLocal8Bit( - cachem->GetCacheEntryProperty(*i, "HELPSTRING")); + state->GetCacheEntryProperty(*i, "HELPSTRING")); prop.Value = QString::fromLocal8Bit(cachedValue); - prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); + prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); if(t == cmCacheManager::BOOL) { prop.Type = QCMakeProperty::BOOL; @@ -319,7 +319,7 @@ QCMakePropertyList QCMake::properties() const { prop.Type = QCMakeProperty::STRING; const char* stringsProperty = - cachem->GetCacheEntryProperty(*i, "STRINGS"); + state->GetCacheEntryProperty(*i, "STRINGS"); if (stringsProperty) { prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";"); diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 99bf5f55f..0d1c86dab 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -13,6 +13,7 @@ #include "cmSystemTools.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmCommandArgumentLexer.h" @@ -90,7 +91,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } if ( strcmp(key, "CACHE") == 0 ) { - if(const char* c = this->Makefile->GetCacheManager() + if(const char* c = this->Makefile->GetState() ->GetInitializedCacheValue(var)) { if(this->EscapeQuotes) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 0d32e4bac..675076946 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -16,6 +16,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" +#include "cmState.h" #include "cmTarget.h" #include "cmSourceFile.h" @@ -205,7 +206,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; cacheEntryName += envVar; - const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue( + const char* cacheValue = mf->GetState()->GetInitializedCacheValue( cacheEntryName); // now we have both, decide which one to use diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index cc080528d..f10d545ed 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -12,6 +12,7 @@ #include "cmFindBase.h" #include "cmAlgorithms.h" +#include "cmState.h" cmFindBase::cmFindBase() { @@ -366,8 +367,8 @@ bool cmFindBase::CheckForVariableInCache() if(const char* cacheValue = this->Makefile->GetDefinition(this->VariableName)) { - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName); + cmState* state = this->Makefile->GetState(); + const char* cacheEntry = state->GetCacheEntryValue(this->VariableName); bool found = !cmSystemTools::IsNOTFOUND(cacheValue); bool cached = cacheEntry ? true : false; if(found) @@ -376,7 +377,7 @@ bool cmFindBase::CheckForVariableInCache() // type we should add the type and docstring but keep the // original value. Tell the subclass implementations to do // this. - if(cached && manager->GetCacheEntryType(this->VariableName) + if(cached && state->GetCacheEntryType(this->VariableName) == cmCacheManager::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; @@ -385,7 +386,7 @@ bool cmFindBase::CheckForVariableInCache() } else if(cached) { - const char* hs = manager->GetCacheEntryProperty(this->VariableName, + const char* hs = state->GetCacheEntryProperty(this->VariableName, "HELPSTRING"); this->VariableDocumentation = hs?hs:"(none)"; } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 0e6e0c20e..80edbcd22 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -12,6 +12,7 @@ #include "cmGetPropertyCommand.h" #include "cmake.h" +#include "cmState.h" #include "cmTest.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" @@ -391,9 +392,9 @@ bool cmGetPropertyCommand::HandleCacheMode() } const char* value = 0; - if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name)) + if(this->Makefile->GetState()->GetCacheEntryValue(this->Name)) { - value = this->Makefile->GetCacheManager() + value = this->Makefile->GetState() ->GetCacheEntryProperty(this->Name, this->PropertyName); } this->StoreResult(value); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35394b8f9..f6ec643dc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -20,6 +20,7 @@ #include "cmLocalGenerator.h" #include "cmExternalMakefileProjectGenerator.h" #include "cmake.h" +#include "cmState.h" #include "cmMakefile.h" #include "cmQtAutoGenerators.h" #include "cmSourceFile.h" @@ -179,7 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, return; } const char* cname = this->GetCMakeInstance()-> - GetCacheManager()->GetInitializedCacheValue(langComp); + GetState()->GetInitializedCacheValue(langComp); std::string changeVars; if(cname && !optional) { @@ -1537,7 +1538,7 @@ void cmGlobalGenerator::CheckLocalGenerators() std::map notFoundMap; // std::set notFoundMap; // after it is all done do a ConfigureFinalPass - cmCacheManager* manager = this->GetCMakeInstance()->GetCacheManager(); + cmState* state = this->GetCMakeInstance()->GetState(); for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { this->LocalGenerators[i]->ConfigureFinalPass(); @@ -1559,7 +1560,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(lib->first.c_str())) { std::string varName = lib->first.substr(0, lib->first.size()-9); - if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) + if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) { varName += " (ADVANCED)"; } @@ -1590,7 +1591,7 @@ void cmGlobalGenerator::CheckLocalGenerators() cmSystemTools::IsNOTFOUND(incDir->c_str())) { std::string varName = incDir->substr(0, incDir->size()-9); - if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) + if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) { varName += " (ADVANCED)"; } @@ -1637,7 +1638,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, // and there is a good chance that the try compile stuff will // take the bulk of the time, so try and guess some progress // by getting closer and closer to 100 without actually getting there. - if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue + if (!this->CMakeInstance->GetState()->GetInitializedCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) { // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set @@ -1835,7 +1836,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) // update progress // estimate how many lg there will be const char *numGenC = - this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue + this->CMakeInstance->GetState()->GetInitializedCacheValue ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); if (!numGenC) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fefa648d4..ca50bc7c2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1812,9 +1812,9 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, bool haveVal = value ? true : false; std::string val = haveVal ? value : ""; const char* existingValue = - this->GetCacheManager()->GetInitializedCacheValue(name); + this->GetState()->GetInitializedCacheValue(name); if(existingValue - && (this->GetCacheManager()->GetCacheEntryType(name) + && (this->GetState()->GetCacheEntryType(name) == cmCacheManager::UNINITIALIZED)) { // if this is not a force, then use the value from the cache @@ -1843,14 +1843,14 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, nvalue += files[cc]; } - this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); - val = this->GetCacheManager()->GetInitializedCacheValue(name); + this->GetState()->AddCacheEntry(name, nvalue.c_str(), doc, type); + val = this->GetState()->GetInitializedCacheValue(name); haveVal = true; } } - this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, - doc, type); + this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0, + doc, type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } @@ -1977,7 +1977,7 @@ void cmMakefile::RemoveDefinition(const std::string& name) void cmMakefile::RemoveCacheDefinition(const std::string& name) { - this->GetCacheManager()->RemoveCacheEntry(name); + this->GetState()->RemoveCacheEntry(name); } void cmMakefile::SetProjectName(const char* p) @@ -2434,7 +2434,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const this->Internal->VarUsageStack.top().insert(name); if(!def) { - def = this->GetCacheManager()->GetInitializedCacheValue(name); + def = this->GetState()->GetInitializedCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE if(cmVariableWatch* vv = this->GetVariableWatch()) @@ -2459,7 +2459,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const const char* def = this->Internal->VarStack.top().Get(name); if(!def) { - def = this->GetCacheManager()->GetInitializedCacheValue(name); + def = this->GetState()->GetInitializedCacheValue(name); } #ifdef CMAKE_BUILD_WITH_CMAKE cmVariableWatch* vv = this->GetVariableWatch(); @@ -2501,7 +2501,7 @@ std::vector cmMakefile res.insert(res.end(), definitions.begin(), definitions.end()); } std::vector cacheKeys = - this->GetCacheManager()->GetCacheEntryKeys(); + this->GetState()->GetCacheEntryKeys(); res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); std::sort(res.begin(), res.end()); @@ -2802,6 +2802,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( openstack.push(t_lookup()); cmake::MessageType mtype = cmake::LOG; + cmState* state = this->GetCMakeInstance()->GetState(); + do { char inc = *in; @@ -2835,8 +2837,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( value = cmSystemTools::GetEnv(lookup.c_str()); break; case CACHE: - value = this->GetCacheManager() - ->GetInitializedCacheValue(lookup); + value = state->GetCacheEntryValue(lookup); break; } // Get the string we're meant to append to. @@ -4908,7 +4909,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, if(id == cmPolicies::CMP0001 && (status == cmPolicies::WARN || status == cmPolicies::OLD)) { - if(!(this->GetCacheManager() + if(!(this->GetState() ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) { // Set it to 2.4 because that is the last version where the diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index cc094b1bc..66f1ebc7d 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -36,20 +36,20 @@ bool cmMarkAsAdvancedCommand for(; i < args.size(); ++i) { std::string variable = args[i]; - cmCacheManager* manager = this->Makefile->GetCacheManager(); - if (!manager->GetCacheEntryValue(variable)) + cmState* state = this->Makefile->GetState(); + if (!state->GetCacheEntryValue(variable)) { - manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); + state->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); overwrite = true; } - if (!manager->GetCacheEntryValue(variable)) + if (!state->GetCacheEntryValue(variable)) { cmSystemTools::Error("This should never happen..."); return false; } - if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite) + if (!state->GetCacheEntryProperty(variable, "ADVANCED") || overwrite) { - manager->SetCacheEntryProperty(variable, "ADVANCED", value); + state->SetCacheEntryProperty(variable, "ADVANCED", value); } } return true; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index baf5b1e08..6c090def4 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -42,13 +42,13 @@ bool cmOptionCommand std::string initialValue = "Off"; // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* existingValue = manager->GetCacheEntryValue(args[0]); + cmState* state = this->Makefile->GetState(); + const char* existingValue = state->GetCacheEntryValue(args[0]); if(existingValue) { - if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) + if (state->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) { - manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); + state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; } initialValue = existingValue; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index e17474bd6..c636d530b 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -136,10 +136,10 @@ bool cmSetCommand } // see if this is already in the cache - cmCacheManager* manager = this->Makefile->GetCacheManager(); - const char* existingValue = manager->GetCacheEntryValue(variable); + cmState* state = this->Makefile->GetState(); + const char* existingValue = state->GetCacheEntryValue(variable); if(existingValue && - (manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) + (state->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 77f9fb90b..08de585ef 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -453,7 +453,7 @@ bool cmSetPropertyCommand::HandleCacheMode() cmMakefile* mf = this->GetMakefile(); cmake* cm = mf->GetCMakeInstance(); const char* existingValue - = cm->GetCacheManager()->GetCacheEntryValue(*ni); + = cm->GetState()->GetCacheEntryValue(*ni); if(existingValue) { if(!this->HandleCacheEntry(*ni)) @@ -479,20 +479,19 @@ bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey) // Set or append the property. const char* name = this->PropertyName.c_str(); const char* value = this->PropertyValue.c_str(); - cmCacheManager* manager = this->Makefile->GetCacheManager(); + cmState* state = this->Makefile->GetState(); if (this->Remove) { - manager->RemoveCacheEntryProperty(cacheKey, name); - return true; + state->RemoveCacheEntryProperty(cacheKey, name); } if(this->AppendMode) { - manager->AppendCacheEntryProperty(cacheKey, name, value, - this->AppendAsString); + state->AppendCacheEntryProperty(cacheKey, name, value, + this->AppendAsString); } else { - manager->SetCacheEntryProperty(cacheKey, name, value); + state->SetCacheEntryProperty(cacheKey, name, value); } return true; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 911ade810..3f766ab96 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -264,12 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment.c_str(), cmCacheManager::STRING); - cmCacheManager* manager = this->Makefile->GetCacheManager(); + cmState* state = this->Makefile->GetState(); const char* existingValue - = manager->GetCacheEntryValue(this->RunResultVariable); + = state->GetCacheEntryValue(this->RunResultVariable); if (existingValue) { - manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1"); + state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1"); } error = true; @@ -291,13 +291,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), cmCacheManager::STRING); - cmCacheManager* manager = this->Makefile->GetCacheManager(); + cmState* state = this->Makefile->GetState(); const char* existing = - manager->GetCacheEntryValue(internalRunOutputName); + state->GetCacheEntryValue(internalRunOutputName); if (existing) { - manager->SetCacheEntryProperty(internalRunOutputName, - "ADVANCED", "1"); + state->SetCacheEntryProperty(internalRunOutputName, + "ADVANCED", "1"); } error = true; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index dd2a68299..1d33db13c 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -10,7 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmVariableRequiresCommand.h" -#include "cmCacheManager.h" +#include "cmState.h" // cmLibraryCommand bool cmVariableRequiresCommand @@ -34,6 +34,7 @@ bool cmVariableRequiresCommand bool requirementsMet = true; std::string notSet; bool hasAdvanced = false; + cmState* state = this->Makefile->GetState(); for(unsigned int i = 2; i < args.size(); ++i) { if(!this->Makefile->IsOn(args[i])) @@ -41,9 +42,8 @@ bool cmVariableRequiresCommand requirementsMet = false; notSet += args[i]; notSet += "\n"; - cmCacheManager* manager = this->Makefile->GetCacheManager(); - if(manager->GetCacheEntryValue(args[i]) && - manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) + if(state->GetCacheEntryValue(args[i]) && + state->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) { hasAdvanced = true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c419edc76..a337b2c3e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -348,22 +348,20 @@ bool cmake::SetCacheArgs(const std::vector& args) std::string cachedValue; if(this->WarnUnusedCli) { - if(const char *v = this->CacheManager - ->GetInitializedCacheValue(var)) + if(const char *v = this->State->GetInitializedCacheValue(var)) { haveValue = true; cachedValue = v; } } - this->CacheManager->AddCacheEntry(var, value.c_str(), + this->State->AddCacheEntry(var, value.c_str(), "No help, variable specified on the command line.", type); if(this->WarnUnusedCli) { if (!haveValue || - cachedValue != this->CacheManager - ->GetInitializedCacheValue(var)) + cachedValue != this->State->GetInitializedCacheValue(var)) { this->WatchUnusedCli(var); } @@ -407,13 +405,11 @@ bool cmake::SetCacheArgs(const std::vector& args) cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector entriesToDelete; - std::vector cacheKeys = - this->CacheManager->GetCacheEntryKeys(); + std::vector cacheKeys = this->State->GetCacheEntryKeys(); for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = - this->CacheManager->GetCacheEntryType(*it); + cmCacheManager::CacheEntryType t = this->State->GetCacheEntryType(*it); if(t != cmCacheManager::STATIC) { if (regex.find(it->c_str())) @@ -429,7 +425,7 @@ bool cmake::SetCacheArgs(const std::vector& args) currentEntry != entriesToDelete.end(); ++currentEntry) { - this->CacheManager->RemoveCacheEntry(*currentEntry); + this->State->RemoveCacheEntry(*currentEntry); } } else if(arg.find("-C",0) == 0) @@ -925,7 +921,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) if(this->LoadCache(cachePath)) { const char* existingValue = - this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + this->State->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); if (existingValue) { this->SetHomeOutputDirectory(cachePath); @@ -1255,7 +1251,6 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) { return 0; } - cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator(); std::vector saved; std::ostringstream warning; warning @@ -1271,10 +1266,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) i++; save.value = *i; warning << *i << "\n"; - if(ci.Find(save.key)) + const char* existingValue = + this->CacheManager->GetCacheEntryValue(save.key); + if(existingValue) { - save.type = ci.GetType(); - if(const char* help = ci.GetProperty("HELPSTRING")) + save.type = this->CacheManager->GetCacheEntryType(save.key); + if(const char* help = + this->CacheManager->GetCacheEntryProperty(save.key, "HELPSTRING")) { save.help = help; } @@ -1556,49 +1554,51 @@ int cmake::ActualConfigure() // project requires compatibility with CMake 2.4. We detect this // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY // variable created when CMP0001 is not set to NEW. - if(this->GetCacheManager() + if(this->State ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { - if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) + if(!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) { - this->CacheManager->AddCacheEntry + this->State->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", cmCacheManager::PATH); } - if(!this->CacheManager + if(!this->State ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { - this->CacheManager->AddCacheEntry + this->State->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", cmCacheManager::PATH); } } - if(!this->CacheManager + if(!this->State ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) { - this->CacheManager->AddCacheEntry + this->State->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", cmCacheManager::BOOL); - if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED")) + if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED")) { - this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED", "1"); + this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED", "1"); } } - if(cmSystemTools::GetFatalErrorOccured() && - (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") || - cmSystemTools::IsOff(this->CacheManager-> - GetInitializedCacheValue("CMAKE_MAKE_PROGRAM")))) + if(cmSystemTools::GetFatalErrorOccured()) { - // We must have a bad generator selection. Wipe the cache entry so the - // user can select another. - this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); - this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); + const char* makeProgram = + this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"); + if (!makeProgram || cmSystemTools::IsOff(makeProgram)) + { + // We must have a bad generator selection. Wipe the cache entry so the + // user can select another. + this->State->RemoveCacheEntry("CMAKE_GENERATOR"); + this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); + } } cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); @@ -2204,7 +2204,7 @@ void cmake::TruncateOutputLog(const char* fname) { return; } - if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") ) + if (!this->State->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) { cmSystemTools::RemoveFile(fullPath); return; @@ -2321,8 +2321,7 @@ const char *cmake::GetProperty(const std::string& prop, std::string output = ""; if ( prop == "CACHE_VARIABLES" ) { - std::vector cacheKeys = - this->CacheManager->GetCacheEntryKeys(); + std::vector cacheKeys = this->State->GetCacheEntryKeys(); this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); } else if ( prop == "COMMANDS" ) @@ -2475,7 +2474,7 @@ int cmake::GetSystemInformation(std::vector& args) // we have to find the module directory, so we can copy the files this->AddCMakePaths(); std::string modulesPath = - this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT"); + this->State->GetInitializedCacheValue("CMAKE_ROOT"); modulesPath += "/Modules"; std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; @@ -2685,7 +2684,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, if(t == cmake::AUTHOR_WARNING) { // Allow suppression of these warnings. - const char* suppress = this->CacheManager->GetCacheEntryValue( + const char* suppress = this->State->GetCacheEntryValue( "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); if(suppress && cmSystemTools::IsOn(suppress)) { @@ -2806,7 +2805,7 @@ int cmake::Build(const std::string& dir, return 1; } const char* cachedGenerator = - this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR"); + this->State->GetCacheEntryValue("CMAKE_GENERATOR"); if(!cachedGenerator) { std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; @@ -2823,7 +2822,7 @@ int cmake::Build(const std::string& dir, std::string output; std::string projName; const char* cachedProjectName = - this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME"); + this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME"); if(!cachedProjectName) { std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n"; @@ -2832,7 +2831,7 @@ int cmake::Build(const std::string& dir, projName = cachedProjectName; bool verbose = false; const char* cachedVerbose = - this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); + this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); if(cachedVerbose) { verbose = cmSystemTools::IsOn(cachedVerbose); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 3b518be77..f678c6a4b 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -18,6 +18,7 @@ #include "cmake.h" #include "cmcmd.h" +#include "cmState.h" #include "cmCacheManager.h" #include "cmListFileCache.h" #include "cmSourceFile.h" @@ -330,28 +331,28 @@ int do_cmake(int ac, char const* const* av) { std::cout << "-- Cache values" << std::endl; std::vector keys = - cm.GetCacheManager()->GetCacheEntryKeys(); + cm.GetState()->GetCacheEntryKeys(); for (std::vector::const_iterator it = keys.begin(); it != keys.end(); ++it) { cmCacheManager::CacheEntryType t = - cm.GetCacheManager()->GetCacheEntryType(*it); + cm.GetState()->GetCacheEntryType(*it); if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && t != cmCacheManager::UNINITIALIZED ) { const char* advancedProp = - cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED"); + cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED"); if ( list_all_cached || !advancedProp) { if ( list_help ) { std::cout << "// " - << cm.GetCacheManager()->GetCacheEntryProperty(*it, + << cm.GetState()->GetCacheEntryProperty(*it, "HELPSTRING") << std::endl; } std::cout << *it << ":" << cmCacheManager::TypeToString(t) - << "=" << cm.GetCacheManager()->GetCacheEntryValue(*it) + << "=" << cm.GetState()->GetCacheEntryValue(*it) << std::endl; if ( list_help ) { From f71fdf0ec8289ada5b32b784bc2f6f617538ce0b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Apr 2015 22:36:13 +0200 Subject: [PATCH 0526/1029] cmMakefile: Remove unused CacheManager accessor. Remove unneeded friend declarations from cmCacheManager. --- Source/cmCacheManager.h | 2 -- Source/cmMakefile.cxx | 5 ----- Source/cmMakefile.h | 2 -- 3 files changed, 9 deletions(-) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 64c7c0d53..00ae33404 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -248,10 +248,8 @@ private: CacheEntryMap Cache; // Only cmake and cmMakefile should be able to add cache values // the commands should never use the cmCacheManager directly - friend class cmMakefile; // allow access to add cache values friend class cmState; // allow access to add cache values friend class cmake; // allow access to add cache values - friend class cmMarkAsAdvancedCommand; // allow access to add cache values }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ca50bc7c2..94e46959a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3735,11 +3735,6 @@ void cmMakefile::GetListOfMacros(std::string& macros) const macros = cmJoin(this->MacrosList, ";"); } -cmCacheManager *cmMakefile::GetCacheManager() const -{ - return this->GetCMakeInstance()->GetCacheManager(); -} - cmState *cmMakefile::GetState() const { return this->GetCMakeInstance()->GetState(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 49bab4cec..fad31d145 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -12,7 +12,6 @@ #ifndef cmMakefile_h #define cmMakefile_h -#include "cmCacheManager.h" #include "cmExecutionStatus.h" #include "cmListFileCache.h" #include "cmPolicies.h" @@ -765,7 +764,6 @@ public: ///enabled. void EnableLanguage(std::vectorconst& languages, bool optional); - cmCacheManager *GetCacheManager() const; cmState *GetState() const; /** From f081c5bdddcfcaaf5bee7b918fe5c7ff01faae35 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Apr 2015 22:45:54 +0200 Subject: [PATCH 0527/1029] cmState: Move CacheEntryType enum from cmCacheManager. --- Source/CursesDialog/cmCursesBoolWidget.cxx | 2 +- .../cmCursesCacheEntryComposite.cxx | 10 +- .../cmCursesCacheEntryComposite.h | 1 - Source/CursesDialog/cmCursesDummyWidget.cxx | 2 +- .../CursesDialog/cmCursesFilePathWidget.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 39 ++++---- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesPathWidget.cxx | 4 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesWidget.h | 6 +- Source/QtDialog/QCMake.cxx | 30 +++--- Source/cmBuildCommand.cxx | 2 +- Source/cmBuildNameCommand.cxx | 4 +- Source/cmCPluginAPI.cxx | 12 +-- Source/cmCTest.cxx | 2 +- Source/cmCacheManager.cxx | 96 +++++-------------- Source/cmCacheManager.h | 35 +++---- Source/cmCoreTryCompile.cxx | 3 +- Source/cmExtraEclipseCDT4Generator.cxx | 4 +- Source/cmFindBase.cxx | 2 +- Source/cmFindLibraryCommand.cxx | 7 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmFindPathCommand.cxx | 7 +- Source/cmFindProgramCommand.cxx | 7 +- Source/cmGetFilenameComponentCommand.cxx | 8 +- Source/cmGlobalGenerator.cxx | 6 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 8 +- Source/cmGlobalXCodeGenerator.cxx | 4 +- Source/cmIncludeExternalMSProjectCommand.cxx | 2 +- Source/cmLoadCacheCommand.cxx | 2 +- Source/cmLocalVisualStudio10Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 3 +- Source/cmMakefile.cxx | 15 ++- Source/cmMakefile.h | 3 +- Source/cmMarkAsAdvancedCommand.cxx | 2 +- Source/cmOptionCommand.cxx | 4 +- Source/cmProjectCommand.cxx | 6 +- Source/cmSetCommand.cxx | 10 +- Source/cmSetPropertyCommand.cxx | 3 +- Source/cmSiteNameCommand.cxx | 2 +- Source/cmState.cxx | 53 ++++++++-- Source/cmState.h | 14 +-- Source/cmTarget.cxx | 4 +- Source/cmTryRunCommand.cxx | 7 +- Source/cmUtilitySourceCommand.cxx | 6 +- Source/cmake.cxx | 40 ++++---- Source/cmake.h | 3 +- Source/cmakemain.cxx | 13 +-- 50 files changed, 240 insertions(+), 267 deletions(-) diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index fd15b9944..29d9cb23b 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -16,7 +16,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::BOOL; + this->Type = cmState::BOOL; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 4eb8e6cdc..7e0924212 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -55,7 +55,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( assert(value); switch (cm->GetState()->GetCacheEntryType(key)) { - case cmCacheManager::BOOL: + case cmState::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); if (cmSystemTools::IsOn(value)) { @@ -66,15 +66,15 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( static_cast(this->Entry)->SetValueAsBool(false); } break; - case cmCacheManager::PATH: + case cmState::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); static_cast(this->Entry)->SetString(value); break; - case cmCacheManager::FILEPATH: + case cmState::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); static_cast(this->Entry)->SetString(value); break; - case cmCacheManager::STRING: + case cmState::STRING: { const char* stringsProp = cm->GetState() ->GetCacheEntryProperty(key, "STRINGS"); @@ -99,7 +99,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; } - case cmCacheManager::UNINITIALIZED: + case cmState::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", key.c_str()); break; diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index dc4ee4af0..f28089742 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -12,7 +12,6 @@ #ifndef cmCursesCacheEntryComposite_h #define cmCursesCacheEntryComposite_h -#include "../cmCacheManager.h" #include "cmCursesLabelWidget.h" class cmCursesCacheEntryComposite diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 60086a51b..9801e4d58 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -15,7 +15,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::INTERNAL; + this->Type = cmState::INTERNAL; } diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index 01db014bb..51ed67087 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -15,6 +15,6 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) : cmCursesPathWidget(width, height, left, top) { - this->Type = cmCacheManager::FILEPATH; + this->Type = cmState::FILEPATH; } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index b067743c3..be17a9f8e 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -9,7 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "../cmCacheManager.h" #include "../cmSystemTools.h" #include "../cmVersion.h" #include "../cmake.h" @@ -118,11 +117,11 @@ void cmCursesMainForm::InitializeUI() for(std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t != cmCacheManager::INTERNAL && - t != cmCacheManager::STATIC && - t != cmCacheManager::UNINITIALIZED) + if (t != cmState::INTERNAL && + t != cmState::STATIC && + t != cmState::UNINITIALIZED) { ++count; } @@ -148,11 +147,11 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + if (t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED ) { continue; } @@ -172,11 +171,11 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + if (t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED ) { continue; } @@ -294,9 +293,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) cmCursesWidget* cw = reinterpret_cast (field_userptr(currentField)); // If in edit mode, get out of it - if ( cw->GetType() == cmCacheManager::STRING || - cw->GetType() == cmCacheManager::PATH || - cw->GetType() == cmCacheManager::FILEPATH ) + if ( cw->GetType() == cmState::STRING || + cw->GetType() == cmState::PATH || + cw->GetType() == cmState::FILEPATH ) { cmCursesStringWidget* sw = static_cast(cw); sw->SetInEdit(false); @@ -823,7 +822,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - cmCacheManager::CacheEntryType t = + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(cacheKey); this->FixValue(t, oldValue, fixedOldValue); @@ -841,15 +840,15 @@ void cmCursesMainForm::FillCacheManagerFromUI() } } -void cmCursesMainForm::FixValue(cmCacheManager::CacheEntryType type, +void cmCursesMainForm::FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const { out = in.substr(0,in.find_last_not_of(" ")+1); - if(type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH) + if(type == cmState::PATH || type == cmState::FILEPATH) { cmSystemTools::ConvertToUnixSlashes(out); } - if(type == cmCacheManager::BOOL) + if(type == cmState::BOOL) { if(cmSystemTools::IsOff(out.c_str())) { diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 64552525c..255c823be 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -113,7 +113,7 @@ protected: // cache. void FillCacheManagerFromUI(); // Fix formatting of values to a consistent form. - void FixValue(cmCacheManager::CacheEntryType type, + void FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const; // Re-post the existing fields. Used to toggle between // normal and advanced modes. Render() should be called diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 2f4b59e5b..30110a496 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -21,7 +21,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::BOOL; // this is a bit of a hack + this->Type = cmState::BOOL; // this is a bit of a hack // there is no option type, and string type causes ccmake to cast // the widget into a string widget at some point. BOOL is safe for // now. diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 89e223802..611682309 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -18,7 +18,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left, int top) : cmCursesStringWidget(width, height, left, top) { - this->Type = cmCacheManager::PATH; + this->Type = cmState::PATH; this->Cycle = false; this->CurrentIndex = 0; } @@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) } std::vector dirs; - cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0)); + cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmState::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) { cstr = dirs[this->CurrentIndex]; diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index d25022d59..acf262fef 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -22,7 +22,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, cmCursesWidget(width, height, left, top) { this->InEdit = false; - this->Type = cmCacheManager::STRING; + this->Type = cmState::STRING; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 7d82864ea..7bbdff109 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -12,7 +12,7 @@ #ifndef cmCursesWidget_h #define cmCursesWidget_h -#include "../cmCacheManager.h" +#include "../cmState.h" #include "cmCursesStandardIncludes.h" class cmCursesMainForm; @@ -46,7 +46,7 @@ public: /** * Get the type of the widget (STRING, PATH etc...) */ - cmCacheManager::CacheEntryType GetType() + cmState::CacheEntryType GetType() { return this->Type; } /** @@ -77,7 +77,7 @@ protected: cmCursesWidget(const cmCursesWidget& from); void operator=(const cmCursesWidget&); - cmCacheManager::CacheEntryType Type; + cmState::CacheEntryType Type; std::string Value; FIELD* Field; // The page in the main form this widget is in diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 775c11c38..652435052 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -200,9 +200,9 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) for(std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*it); - if(t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC) + cmState::CacheEntryType t = state->GetCacheEntryType(*it); + if(t == cmState::INTERNAL || + t == cmState::STATIC) { continue; } @@ -249,28 +249,28 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF", s.Help.toLocal8Bit().data(), - cmCacheManager::BOOL); + cmState::BOOL); } else if(s.Type == QCMakeProperty::STRING) { this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), s.Help.toLocal8Bit().data(), - cmCacheManager::STRING); + cmState::STRING); } else if(s.Type == QCMakeProperty::PATH) { this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), s.Help.toLocal8Bit().data(), - cmCacheManager::PATH); + cmState::PATH); } else if(s.Type == QCMakeProperty::FILEPATH) { this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), s.Help.toLocal8Bit().data(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); } } @@ -286,10 +286,10 @@ QCMakePropertyList QCMake::properties() const for (std::vector::const_iterator i = cacheKeys.begin(); i != cacheKeys.end(); ++i) { - cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*i); - if(t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED) + cmState::CacheEntryType t = state->GetCacheEntryType(*i); + if(t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED) { continue; } @@ -302,20 +302,20 @@ QCMakePropertyList QCMake::properties() const state->GetCacheEntryProperty(*i, "HELPSTRING")); prop.Value = QString::fromLocal8Bit(cachedValue); prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); - if(t == cmCacheManager::BOOL) + if(t == cmState::BOOL) { prop.Type = QCMakeProperty::BOOL; prop.Value = cmSystemTools::IsOn(cachedValue); } - else if(t == cmCacheManager::PATH) + else if(t == cmState::PATH) { prop.Type = QCMakeProperty::PATH; } - else if(t == cmCacheManager::FILEPATH) + else if(t == cmState::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; } - else if(t == cmCacheManager::STRING) + else if(t == cmState::STRING) { prop.Type = QCMakeProperty::STRING; const char* stringsProperty = diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 5d324371c..cdca792b6 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -147,6 +147,6 @@ bool cmBuildCommand makecommand.c_str(), "Command used to build entire project " "from the command line.", - cmCacheManager::STRING); + cmState::STRING); return true; } diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 171ed0fe5..2a0657414 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -39,7 +39,7 @@ bool cmBuildNameCommand this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", - cmCacheManager::STRING); + cmState::STRING); } return true; } @@ -74,7 +74,7 @@ bool cmBuildNameCommand this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), "Name of build.", - cmCacheManager::STRING); + cmState::STRING); return true; } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 987a7b17d..5ae7d4ca2 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -87,27 +87,27 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name, { case CM_CACHE_BOOL: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::BOOL); + cmState::BOOL); break; case CM_CACHE_PATH: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::PATH); + cmState::PATH); break; case CM_CACHE_FILEPATH: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::FILEPATH); + cmState::FILEPATH); break; case CM_CACHE_STRING: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::STRING); + cmState::STRING); break; case CM_CACHE_INTERNAL: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::INTERNAL); + cmState::INTERNAL); break; case CM_CACHE_STATIC: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::STATIC); + cmState::STATIC); break; } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1db057bd1..67156384e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2279,7 +2279,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) { std::string name; std::string value; - cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + cmState::CacheEntryType type = cmState::UNINITIALIZED; if (cmake::ParseCacheEntry(arg, name, value, type)) { diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 5387d0c81..289d0dc8c 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -22,17 +22,6 @@ #include #include -const char* cmCacheManagerTypes[] = -{ "BOOL", - "PATH", - "FILEPATH", - "STRING", - "INTERNAL", - "STATIC", - "UNINITIALIZED", - 0 -}; - cmCacheManager::cmCacheManager(cmake* cm) { this->CacheMajorVersion = 0; @@ -40,41 +29,6 @@ cmCacheManager::cmCacheManager(cmake* cm) this->CMakeInstance = cm; } -const char* cmCacheManager::TypeToString(cmCacheManager::CacheEntryType type) -{ - if ( type > 6 ) - { - return cmCacheManagerTypes[6]; - } - return cmCacheManagerTypes[type]; -} - -cmCacheManager::CacheEntryType cmCacheManager::StringToType(const char* s) -{ - int i = 0; - while(cmCacheManagerTypes[i]) - { - if(strcmp(s, cmCacheManagerTypes[i]) == 0) - { - return static_cast(i); - } - ++i; - } - return STRING; -} - -bool cmCacheManager::IsType(const char* s) -{ - for(int i=0; cmCacheManagerTypes[i]; ++i) - { - if(strcmp(s, cmCacheManagerTypes[i]) == 0) - { - return true; - } - } - return false; -} - bool cmCacheManager::LoadCache(const std::string& path) { std::set emptySet; @@ -122,7 +76,7 @@ static bool ParseEntryWithoutType(const std::string& entry, bool cmCacheManager::ParseEntry(const std::string& entry, std::string& var, std::string& value, - CacheEntryType& type) + cmState::CacheEntryType& type) { // input line is: key:type=value static cmsys::RegularExpression reg( @@ -134,14 +88,14 @@ bool cmCacheManager::ParseEntry(const std::string& entry, if(regQuoted.find(entry)) { var = regQuoted.match(1); - type = cmCacheManager::StringToType(regQuoted.match(2).c_str()); + type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str()); value = regQuoted.match(3); flag = true; } else if (reg.find(entry)) { var = reg.match(1); - type = cmCacheManager::StringToType(reg.match(2).c_str()); + type = cmState::StringToCacheEntryType(reg.match(2).c_str()); value = reg.match(3); flag = true; } @@ -250,7 +204,7 @@ bool cmCacheManager::LoadCache(const std::string& path, // If the entry is not internal to the cache being loaded // or if it is in the list of internal entries to be // imported, load it. - if ( internal || (e.Type != INTERNAL) || + if ( internal || (e.Type != cmState::INTERNAL) || (includes.find(entryKey) != includes.end()) ) { // If we are loading the cache from another project, @@ -258,7 +212,7 @@ bool cmCacheManager::LoadCache(const std::string& path, // not visible in the gui if (!internal) { - e.Type = INTERNAL; + e.Type = cmState::INTERNAL; helpString = "DO NOT EDIT, "; helpString += entryKey; helpString += " loaded from external file. " @@ -306,10 +260,10 @@ bool cmCacheManager::LoadCache(const std::string& path, // Set as version 0.0 this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0", "Minor version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0", "Major version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); } // check to make sure the cache directory has not @@ -351,7 +305,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, CacheEntry& e) { // All property entries are internal. - if(e.Type != cmCacheManager::INTERNAL) + if(e.Type != cmState::INTERNAL) { return false; } @@ -370,7 +324,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; ne.Properties.SetCMakeInstance(this->CMakeInstance); - ne.Type = cmCacheManager::UNINITIALIZED; + ne.Type = cmState::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } else @@ -427,15 +381,15 @@ bool cmCacheManager::SaveCache(const std::string& path) sprintf(temp, "%d", cmVersion::GetMinorVersion()); this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, "Minor version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); sprintf(temp, "%d", cmVersion::GetMajorVersion()); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp, "Major version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp, "Patch version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); // Let us store the current working directory so that if somebody // Copies it, he will not be surprised @@ -450,7 +404,7 @@ bool cmCacheManager::SaveCache(const std::string& path) cmSystemTools::ConvertToUnixSlashes(currentcwd); this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(), "This is the directory where this CMakeCache.txt" - " was created", cmCacheManager::INTERNAL); + " was created", cmState::INTERNAL); fout << "# This is the CMakeCache file.\n" << "# For build in directory: " << currentcwd << "\n"; @@ -484,7 +438,7 @@ bool cmCacheManager::SaveCache(const std::string& path) this->Cache.begin(); i != this->Cache.end(); ++i) { const CacheEntry& ce = (*i).second; - CacheEntryType t = ce.Type; + cmState::CacheEntryType t = ce.Type; if(!ce.Initialized) { /* @@ -493,7 +447,7 @@ bool cmCacheManager::SaveCache(const std::string& path) "\" is uninitialized"); */ } - else if(t != INTERNAL) + else if(t != cmState::INTERNAL) { // Format is key:type=value if(const char* help = ce.GetProperty("HELPSTRING")) @@ -505,7 +459,7 @@ bool cmCacheManager::SaveCache(const std::string& path) cmCacheManager::OutputHelpString(fout, "Missing description"); } this->OutputKey(fout, i->first); - fout << ":" << cmCacheManagerTypes[t] << "="; + fout << ":" << cmState::CacheEntryTypeToString(t) << "="; this->OutputValue(fout, ce.Value); fout << "\n\n"; } @@ -525,9 +479,9 @@ bool cmCacheManager::SaveCache(const std::string& path) continue; } - CacheEntryType t = i.GetType(); + cmState::CacheEntryType t = i.GetType(); this->WritePropertyEntries(fout, i); - if(t == cmCacheManager::INTERNAL) + if(t == cmState::INTERNAL) { // Format is key:type=value if(const char* help = i.GetProperty("HELPSTRING")) @@ -535,7 +489,7 @@ bool cmCacheManager::SaveCache(const std::string& path) this->OutputHelpString(fout, help); } this->OutputKey(fout, i.GetName()); - fout << ":" << cmCacheManagerTypes[t] << "="; + fout << ":" << cmState::CacheEntryTypeToString(t) << "="; this->OutputValue(fout, i.GetValue()); fout << "\n"; } @@ -677,7 +631,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const for(std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { - if((*i).second.Type != INTERNAL) + if((*i).second.Type != cmState::INTERNAL) { out << (*i).first << " = " << (*i).second.Value << std::endl; @@ -693,7 +647,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - CacheEntryType type) + cmState::CacheEntryType type) { CacheEntry& e = this->Cache[key]; e.Properties.SetCMakeInstance(this->CMakeInstance); @@ -708,7 +662,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, } e.Type = type; // make sure we only use unix style paths - if(type == FILEPATH || type == PATH) + if(type == cmState::FILEPATH || type == cmState::PATH) { if(e.Value.find(';') != e.Value.npos) { @@ -789,7 +743,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const { if(prop == "TYPE") { - return cmCacheManagerTypes[this->Type]; + return cmState::CacheEntryTypeToString(this->Type); } else if(prop == "VALUE") { @@ -806,7 +760,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, { if(prop == "TYPE") { - this->Type = cmCacheManager::StringToType(value? value : "STRING"); + this->Type = cmState::StringToCacheEntryType(value? value : "STRING"); } else if(prop == "VALUE") { @@ -825,7 +779,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, { if(prop == "TYPE") { - this->Type = cmCacheManager::StringToType(value? value : "STRING"); + this->Type = cmState::StringToCacheEntryType(value? value : "STRING"); } else if(prop == "VALUE") { diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 00ae33404..846225978 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" #include "cmPropertyMap.h" +#include "cmState.h" + class cmMakefile; class cmMarkAsAdvancedCommand; class cmake; @@ -30,21 +32,22 @@ public: cmCacheManager(cmake* cm); class CacheIterator; friend class cmCacheManager::CacheIterator; - enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, - UNINITIALIZED }; private: struct CacheEntry { std::string Value; - CacheEntryType Type; + cmState::CacheEntryType Type; cmPropertyMap Properties; const char* GetProperty(const std::string&) const; void SetProperty(const std::string& property, const char* value); void AppendProperty(const std::string& property, const char* value, bool asString=false); bool Initialized; - CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false) + CacheEntry() + : Value(""), + Type(cmState::UNINITIALIZED), + Initialized(false) {} }; @@ -68,8 +71,10 @@ public: const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); - CacheEntryType GetType() const { return this->GetEntry().Type; } - void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; } + cmState::CacheEntryType GetType() const + { return this->GetEntry().Type; } + void SetType(cmState::CacheEntryType ty) + { this->GetEntry().Type = ty; } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager &Container; std::map::iterator Position; @@ -94,17 +99,6 @@ public: return CacheIterator(*this); } - /** - * Types for the cache entries. These are useful as - * hints for a cache editor program. Path should bring - * up a file chooser, BOOL a check box, and STRING a - * text entry box, FILEPATH is a full path to a file which - * can be different than just a path input - */ - static CacheEntryType StringToType(const char*); - static const char* TypeToString(CacheEntryType); - static bool IsType(const char*); - ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path); bool LoadCache(const std::string& path, bool internal, @@ -134,7 +128,7 @@ public: static bool ParseEntry(const std::string& entry, std::string& var, std::string& value, - CacheEntryType& type); + cmState::CacheEntryType& type); ///! Get a value from the cache given a key const char* GetInitializedCacheValue(const std::string& key) const; @@ -155,7 +149,7 @@ public: return this->GetCacheIterator(key.c_str()).GetProperty(propName); } - CacheEntryType GetCacheEntryType(std::string const& key) + cmState::CacheEntryType GetCacheEntryType(std::string const& key) { return this->GetCacheIterator(key.c_str()).GetType(); } @@ -223,7 +217,8 @@ public: protected: ///! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, CacheEntryType type); + const char* helpString, + cmState::CacheEntryType type); ///! Get a cache entry object for a key CacheEntry *GetCacheEntry(const std::string& key); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 59efa52d9..56a884c26 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmCoreTryCompile.h" #include "cmake.h" -#include "cmCacheManager.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmAlgorithms.h" @@ -527,7 +526,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"), "Result of TRY_COMPILE", - cmCacheManager::INTERNAL); + cmState::INTERNAL); if (!outputVariable.empty()) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 675076946..35b70e8f0 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -222,7 +222,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, // in the cache valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmCacheManager::STRING, + cacheEntryName.c_str(), cmState::STRING, true); mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } @@ -243,7 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, { valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmCacheManager::STRING, + cacheEntryName.c_str(), cmState::STRING, true); mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index f10d545ed..add06a730 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -378,7 +378,7 @@ bool cmFindBase::CheckForVariableInCache() // original value. Tell the subclass implementations to do // this. if(cached && state->GetCacheEntryType(this->VariableName) - == cmCacheManager::UNINITIALIZED) + == cmState::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index c499f6154..ef8340bac 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmFindLibraryCommand.h" -#include "cmCacheManager.h" #include #include @@ -39,7 +38,7 @@ bool cmFindLibraryCommand { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); } return true; } @@ -72,14 +71,14 @@ bool cmFindLibraryCommand this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 4d7fd60f1..b32f5fdcc 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -947,7 +947,7 @@ bool cmFindPackageCommand::FindConfig() // We force the value since we do not get here if it was already set. this->Makefile->AddCacheDefinition(this->Variable, init.c_str(), help.c_str(), - cmCacheManager::PATH, true); + cmState::PATH, true); return found; } diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 49fbf455c..1f3d1a455 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmFindPathCommand.h" -#include "cmCacheManager.h" #include @@ -41,7 +40,7 @@ bool cmFindPathCommand this->VariableName, "", this->VariableDocumentation.c_str(), (this->IncludeFileInPath ? - cmCacheManager::FILEPATH :cmCacheManager::PATH) + cmState::FILEPATH :cmState::PATH) ); } return true; @@ -54,7 +53,7 @@ bool cmFindPathCommand (this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? - cmCacheManager::FILEPATH :cmCacheManager::PATH); + cmState::FILEPATH :cmState::PATH); return true; } this->Makefile->AddCacheDefinition @@ -62,7 +61,7 @@ bool cmFindPathCommand (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? - cmCacheManager::FILEPATH :cmCacheManager::PATH); + cmState::FILEPATH :cmState::PATH); return true; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 4ee419c69..fbd9fd34e 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmFindProgramCommand.h" -#include "cmCacheManager.h" #include #if defined(__APPLE__) @@ -37,7 +36,7 @@ bool cmFindProgramCommand { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); } return true; } @@ -49,14 +48,14 @@ bool cmFindProgramCommand this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } this->Makefile->AddCacheDefinition(this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 9aceb3917..6947a7fb1 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -117,13 +117,13 @@ bool cmGetFilenameComponentCommand { this->Makefile->AddCacheDefinition (storeArgs, programArgs.c_str(), - "", args[2] == "PATH" ? cmCacheManager::FILEPATH - : cmCacheManager::STRING); + "", args[2] == "PATH" ? cmState::FILEPATH + : cmState::STRING); } this->Makefile->AddCacheDefinition (args[0], result.c_str(), "", - args[2] == "PATH" ? cmCacheManager::FILEPATH - : cmCacheManager::STRING); + args[2] == "PATH" ? cmState::FILEPATH + : cmState::STRING); } else { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f6ec643dc..4a93446a7 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -311,7 +311,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) makeProgram += saveFile; mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(), "make program", - cmCacheManager::FILEPATH); + cmState::FILEPATH); } } @@ -1116,7 +1116,7 @@ void cmGlobalGenerator::Configure() sprintf(num,"%d",static_cast(this->LocalGenerators.size())); this->GetCMakeInstance()->AddCacheEntry ("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num, - "number of local generators", cmCacheManager::INTERNAL); + "number of local generators", cmState::INTERNAL); // check for link libraries and include directories containing "NOTFOUND" // and for infinite loops @@ -1894,7 +1894,7 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make, "make program", - cmCacheManager::FILEPATH); + cmState::FILEPATH); // copy the enabled languages this->LanguageEnabled = gen->LanguageEnabled; this->LanguagesReady = gen->LanguagesReady; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 7648813a3..22d633cb7 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -97,7 +97,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const { cm->AddCacheEntry ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), - "Path to cache edit program executable.", cmCacheManager::INTERNAL); + "Path to cache edit program executable.", cmState::INTERNAL); } } const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND"); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0e0e63a9c..6a3a145f2 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -89,7 +89,7 @@ void cmGlobalVisualStudio7Generator "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmCacheManager::STRING); + cmState::STRING); } // Create list of configurations requested by user's cache, if any. @@ -109,7 +109,7 @@ void cmGlobalVisualStudio7Generator mf->AddCacheDefinition ("CMAKE_MSVCIDE_RUN_PATH", extraPath, "Saved environment variable CMAKE_MSVCIDE_RUN_PATH", - cmCacheManager::STATIC); + cmState::STATIC); } } @@ -335,7 +335,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmCacheManager::STRING); + cmState::STRING); } void cmGlobalVisualStudio7Generator::Generate() @@ -970,7 +970,7 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) ret = cmSystemTools::UpperCase(ret); this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), ret.c_str(), "Stored GUID", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } std::vector *cmGlobalVisualStudio7Generator::GetConfigurations() diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0561a0542..748838687 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -285,7 +285,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmCacheManager::STRING); + cmState::STRING); } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); @@ -2754,7 +2754,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, } this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL); + id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL); return id; } diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index d40d8fe72..1e7258a83 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -73,7 +73,7 @@ bool cmIncludeExternalMSProjectCommand std::string guidVariable = utility_name + "_GUID_CMAKE"; this->Makefile->GetCMakeInstance()->AddCacheEntry( guidVariable.c_str(), customGuid.c_str(), - "Stored GUID", cmCacheManager::INTERNAL); + "Stored GUID", cmState::INTERNAL); } // Create a target instance for this utility. diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index e2ae90111..6ade53542 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -172,7 +172,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) // Check one line of the cache file. std::string var; std::string value; - cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + cmState::CacheEntryType type = cmState::UNINITIALIZED; if(cmake::ParseCacheEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index aa70ab9d6..2b6756233 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -118,7 +118,7 @@ void cmLocalVisualStudio10Generator AddCacheEntry(guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index c4abeb2dd..884212b34 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -16,7 +16,6 @@ #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmSourceFile.h" -#include "cmCacheManager.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" #include "cmake.h" @@ -2331,7 +2330,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( AddCacheEntry(guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94e46959a..6aa52248c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -18,7 +18,6 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmCommands.h" -#include "cmCacheManager.h" #include "cmState.h" #include "cmFunctionBlocker.h" #include "cmListFileCache.h" @@ -1806,7 +1805,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value) void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, const char* doc, - cmCacheManager::CacheEntryType type, + cmState::CacheEntryType type, bool force) { bool haveVal = value ? true : false; @@ -1815,7 +1814,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, this->GetState()->GetInitializedCacheValue(name); if(existingValue && (this->GetState()->GetCacheEntryType(name) - == cmCacheManager::UNINITIALIZED)) + == cmState::UNINITIALIZED)) { // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in @@ -1824,7 +1823,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, val = existingValue; haveVal = true; } - if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) + if ( type == cmState::PATH || type == cmState::FILEPATH ) { std::vector::size_type cc; std::vector files; @@ -3617,7 +3616,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // Add this before the user-provided CMake arguments in case // one of the arguments is -DCMAKE_BUILD_TYPE=... cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, - "Build configuration", cmCacheManager::STRING); + "Build configuration", cmState::STRING); } } // if cmake args were provided then pass them in @@ -3656,12 +3655,12 @@ int cmMakefile::TryCompile(const std::string& srcdir, if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", - "TRUE", "", cmCacheManager::INTERNAL); + "TRUE", "", cmState::INTERNAL); } else { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", - "FALSE", "", cmCacheManager::INTERNAL); + "FALSE", "", cmState::INTERNAL); } if (cm.Configure() != 0) { @@ -4914,7 +4913,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, "For backwards compatibility, what version of CMake " "commands and " "syntax should this version of CMake try to support.", - cmCacheManager::STRING); + cmState::STRING); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fad31d145..da92ad772 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -22,6 +22,7 @@ #include "cmGeneratorTarget.h" #include "cmExpandedCommandArgument.h" #include "cmake.h" +#include "cmState.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmSourceGroup.h" @@ -305,7 +306,7 @@ public: ///! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, const char* doc, - cmCacheManager::CacheEntryType type, + cmState::CacheEntryType type, bool force = false); /** diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 66f1ebc7d..10d30f31f 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -39,7 +39,7 @@ bool cmMarkAsAdvancedCommand cmState* state = this->Makefile->GetState(); if (!state->GetCacheEntryValue(variable)) { - state->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); + state->AddCacheEntry(variable, 0, 0, cmState::UNINITIALIZED); overwrite = true; } if (!state->GetCacheEntryValue(variable)) diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 6c090def4..92be5f1ab 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -46,7 +46,7 @@ bool cmOptionCommand const char* existingValue = state->GetCacheEntryValue(args[0]); if(existingValue) { - if (state->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) + if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED) { state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; @@ -59,6 +59,6 @@ bool cmOptionCommand } bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF", - args[1].c_str(), cmCacheManager::BOOL); + args[1].c_str(), cmState::BOOL); return true; } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 61c0133c4..601dc54f9 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -30,11 +30,11 @@ bool cmProjectCommand this->Makefile->AddCacheDefinition (bindir, this->Makefile->GetCurrentOutputDirectory(), - "Value Computed by CMake", cmCacheManager::STATIC); + "Value Computed by CMake", cmState::STATIC); this->Makefile->AddCacheDefinition (srcdir, this->Makefile->GetCurrentDirectory(), - "Value Computed by CMake", cmCacheManager::STATIC); + "Value Computed by CMake", cmState::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; @@ -59,7 +59,7 @@ bool cmProjectCommand this->Makefile->AddCacheDefinition ("CMAKE_PROJECT_NAME", args[0].c_str(), - "Value Computed by CMake", cmCacheManager::STATIC); + "Value Computed by CMake", cmState::STATIC); } bool haveVersion = false; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index c636d530b..bf9f42c8a 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -79,8 +79,8 @@ bool cmSetCommand bool cache = false; // optional bool force = false; // optional bool parentScope = false; - cmCacheManager::CacheEntryType type - = cmCacheManager::STRING; // required if cache + cmState::CacheEntryType type + = cmState::STRING; // required if cache const char* docstring = 0; // required if cache unsigned int ignoreLastArgs = 0; @@ -131,7 +131,7 @@ bool cmSetCommand if(cache) { std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0); - type = cmCacheManager::StringToType(args[cacheStart+1].c_str()); + type = cmState::StringToCacheEntryType(args[cacheStart+1].c_str()); docstring = args[cacheStart+2].c_str(); } @@ -139,13 +139,13 @@ bool cmSetCommand cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(variable); if(existingValue && - (state->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) + (state->GetCacheEntryType(variable) != cmState::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal // then leave now without setting any definitions in the cache // or the makefile - if(cache && type != cmCacheManager::INTERNAL && !force) + if(cache && type != cmState::INTERNAL && !force) { return true; } diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 08de585ef..bb94a722f 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -14,7 +14,6 @@ #include "cmSetTestsPropertiesCommand.h" #include "cmSetSourceFilesPropertiesCommand.h" -#include "cmCacheManager.h" //---------------------------------------------------------------------------- cmSetPropertyCommand::cmSetPropertyCommand() @@ -426,7 +425,7 @@ bool cmSetPropertyCommand::HandleCacheMode() } else if(this->PropertyName == "TYPE") { - if(!cmCacheManager::IsType(this->PropertyValue.c_str())) + if(!cmState::IsCacheEntryType(this->PropertyValue.c_str())) { std::ostringstream e; e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\""; diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 927888be3..20a61a046 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -88,7 +88,7 @@ bool cmSiteNameCommand AddCacheDefinition(args[0], siteName.c_str(), "Name of the computer/site where compile is being run", - cmCacheManager::STRING); + cmState::STRING); return true; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f5e3752ca..7602f6324 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -12,26 +12,59 @@ #include "cmState.h" #include "cmake.h" +#include "cmCacheManager.h" cmState::cmState(cmake* cm) : CMakeInstance(cm) { } -cmCacheManager::CacheEntryType -cmState::StringToCacheEntryType(const char* s) -{ - return cmCacheManager::StringToType(s); -} + +const char* cmCacheEntryTypes[] = +{ "BOOL", + "PATH", + "FILEPATH", + "STRING", + "INTERNAL", + "STATIC", + "UNINITIALIZED", + 0 +}; const char* -cmState::CacheEntryTypeToString(cmCacheManager::CacheEntryType t) +cmState::CacheEntryTypeToString(cmState::CacheEntryType type) { - return cmCacheManager::TypeToString(t); + if ( type > 6 ) + { + return cmCacheEntryTypes[6]; + } + return cmCacheEntryTypes[type]; +} + +cmState::CacheEntryType +cmState::StringToCacheEntryType(const char* s) +{ + int i = 0; + while(cmCacheEntryTypes[i]) + { + if(strcmp(s, cmCacheEntryTypes[i]) == 0) + { + return static_cast(i); + } + ++i; + } + return STRING; } bool cmState::IsCacheEntryType(std::string const& key) { - return cmCacheManager::IsType(key.c_str()); + for(int i=0; cmCacheEntryTypes[i]; ++i) + { + if(strcmp(key.c_str(), cmCacheEntryTypes[i]) == 0) + { + return true; + } + } + return false; } std::vector cmState::GetCacheEntryKeys() const @@ -64,7 +97,7 @@ cmState::GetInitializedCacheValue(std::string const& key) const return this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue(key); } -cmCacheManager::CacheEntryType +cmState::CacheEntryType cmState::GetCacheEntryType(std::string const& key) const { cmCacheManager::CacheIterator it = @@ -117,7 +150,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, void cmState::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmCacheManager::CacheEntryType type) + cmState::CacheEntryType type) { this->CMakeInstance->GetCacheManager()->AddCacheEntry(key, value, helpString, type); diff --git a/Source/cmState.h b/Source/cmState.h index 06b0ec69e..f2e8ef5e8 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -12,7 +12,7 @@ #ifndef cmState_h #define cmState_h -#include "cmCacheManager.h" +#include "cmStandardIncludes.h" class cmake; @@ -21,21 +21,21 @@ class cmState public: cmState(cmake* cm); - static cmCacheManager::CacheEntryType StringToCacheEntryType(const char*); - static const char* CacheEntryTypeToString(cmCacheManager::CacheEntryType); + enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, + UNINITIALIZED }; + static CacheEntryType StringToCacheEntryType(const char*); + static const char* CacheEntryTypeToString(CacheEntryType); static bool IsCacheEntryType(std::string const& key); std::vector GetCacheEntryKeys() const; const char* GetCacheEntryValue(std::string const& key) const; const char* GetInitializedCacheValue(std::string const& key) const; - cmCacheManager::CacheEntryType - GetCacheEntryType(std::string const& key) const; + CacheEntryType GetCacheEntryType(std::string const& key) const; void SetCacheEntryValue(std::string const& key, std::string const& value); void SetCacheValue(std::string const& key, std::string const& value); void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, - cmCacheManager::CacheEntryType type); + const char* helpString, CacheEntryType type); void RemoveCacheEntry(std::string const& key); void SetCacheEntryProperty(std::string const& key, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b3d115543..1702a7dfb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1181,7 +1181,7 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, if (this->RecordDependencies) { mf.AddCacheDefinition(depname, "", - "Dependencies for target", cmCacheManager::STATIC); + "Dependencies for target", cmState::STATIC); } else { @@ -1369,7 +1369,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, dependencies += ";"; mf.AddCacheDefinition( targetEntry, dependencies.c_str(), "Dependencies for the target", - cmCacheManager::STATIC ); + cmState::STATIC ); } } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 3f766ab96..bcc4a83c1 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmTryRunCommand.h" -#include "cmCacheManager.h" #include "cmTryCompileCommand.h" #include @@ -217,7 +216,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, } this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar, "Result of TRY_RUN", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } /* This is only used when cross compiling. Instead of running the @@ -262,7 +261,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, this->Makefile->AddCacheDefinition(this->RunResultVariable, "PLEASE_FILL_OUT-FAILED_TO_RUN", comment.c_str(), - cmCacheManager::STRING); + cmState::STRING); cmState* state = this->Makefile->GetState(); const char* existingValue @@ -290,7 +289,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, this->Makefile->AddCacheDefinition(internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), - cmCacheManager::STRING); + cmState::STRING); cmState* state = this->Makefile->GetState(); const char* existing = state->GetCacheEntryValue(internalRunOutputName); diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 2799a9be5..10122e9c1 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmUtilitySourceCommand.h" +#include "cmCacheManager.h" + // cmUtilitySourceCommand bool cmUtilitySourceCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) @@ -118,14 +120,14 @@ bool cmUtilitySourceCommand this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", - cmCacheManager::FILEPATH); + cmState::FILEPATH); // add a value into the cache that maps from the // full path to the name of the project cmSystemTools::ConvertToUnixSlashes(utilityExecutable); this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(), "Executable to project name.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a337b2c3e..b1eea989d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -338,7 +338,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } } std::string var, value; - cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + cmState::CacheEntryType type = cmState::UNINITIALIZED; if(cmCacheManager::ParseEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so @@ -409,8 +409,8 @@ bool cmake::SetCacheArgs(const std::vector& args) for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = this->State->GetCacheEntryType(*it); - if(t != cmCacheManager::STATIC) + cmState::CacheEntryType t = this->State->GetCacheEntryType(*it); + if(t != cmState::STATIC) { if (regex.find(it->c_str())) { @@ -975,14 +975,14 @@ int cmake::AddCMakePaths() // Save the value in the cache this->CacheManager->AddCacheEntry ("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(), - "Path to CMake executable.", cmCacheManager::INTERNAL); + "Path to CMake executable.", cmState::INTERNAL); #ifdef CMAKE_BUILD_WITH_CMAKE this->CacheManager->AddCacheEntry ("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(), - "Path to ctest program executable.", cmCacheManager::INTERNAL); + "Path to ctest program executable.", cmState::INTERNAL); this->CacheManager->AddCacheEntry ("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(), - "Path to cpack program executable.", cmCacheManager::INTERNAL); + "Path to cpack program executable.", cmState::INTERNAL); #endif if(!cmSystemTools::FileExists( (cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str())) @@ -996,7 +996,7 @@ int cmake::AddCMakePaths() } this->CacheManager->AddCacheEntry ("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(), - "Path to CMake installation.", cmCacheManager::INTERNAL); + "Path to CMake installation.", cmState::INTERNAL); return 1; } @@ -1238,7 +1238,7 @@ struct SaveCacheEntry std::string key; std::string value; std::string help; - cmCacheManager::CacheEntryType type; + cmState::CacheEntryType type; }; int cmake::HandleDeleteCacheVariables(const std::string& var) @@ -1311,7 +1311,7 @@ int cmake::Configure() AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } else { @@ -1319,7 +1319,7 @@ int cmake::Configure() AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } } int ret = this->ActualConfigure(); @@ -1355,7 +1355,7 @@ int cmake::ActualConfigure() this->GetHomeDirectory(), "Start directory with the top level CMakeLists.txt file for this " "project", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } // no generator specified on the command line @@ -1464,11 +1464,11 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), "Name of generator.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName().c_str(), "Name of external makefile project generator.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } if(const char* platformName = @@ -1496,7 +1496,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform.c_str(), "Name of generator platform.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } if(const char* tsName = @@ -1524,7 +1524,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset.c_str(), "Name of generator toolset.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } // reset any system configuration information, except for when we are @@ -1562,7 +1562,7 @@ int cmake::ActualConfigure() this->State->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", - cmCacheManager::PATH); + cmState::PATH); } if(!this->State ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) @@ -1570,7 +1570,7 @@ int cmake::ActualConfigure() this->State->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", - cmCacheManager::PATH); + cmState::PATH); } } if(!this->State @@ -1579,7 +1579,7 @@ int cmake::ActualConfigure() this->State->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", - cmCacheManager::BOOL); + cmState::BOOL); if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", "ADVANCED")) { @@ -1804,7 +1804,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, { this->CacheManager->AddCacheEntry(key, value, helpString, - cmCacheManager::CacheEntryType(type)); + cmState::CacheEntryType(type)); } const char* cmake::GetCacheDefinition(const std::string& name) const @@ -1876,7 +1876,7 @@ void cmake::AddDefaultGenerators() bool cmake::ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, - cmCacheManager::CacheEntryType& type) + cmState::CacheEntryType& type) { return cmCacheManager::ParseEntry(entry, var, value, type); } diff --git a/Source/cmake.h b/Source/cmake.h index 0b24ed6ef..bbeb95dc5 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -19,6 +19,7 @@ #include "cmPropertyMap.h" #include "cmInstalledFile.h" #include "cmCacheManager.h" +#include "cmState.h" class cmGlobalGeneratorFactory; class cmGlobalGenerator; @@ -178,7 +179,7 @@ class cmake static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, - cmCacheManager::CacheEntryType& type); + cmState::CacheEntryType& type); int LoadCache(); bool LoadCache(const std::string& path); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index f678c6a4b..c8cf2d43c 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -19,7 +19,6 @@ #include "cmake.h" #include "cmcmd.h" #include "cmState.h" -#include "cmCacheManager.h" #include "cmListFileCache.h" #include "cmSourceFile.h" #include "cmGlobalGenerator.h" @@ -330,15 +329,13 @@ int do_cmake(int ac, char const* const* av) if ( list_cached || list_all_cached ) { std::cout << "-- Cache values" << std::endl; - std::vector keys = - cm.GetState()->GetCacheEntryKeys(); + std::vector keys = cm.GetState()->GetCacheEntryKeys(); for (std::vector::const_iterator it = keys.begin(); it != keys.end(); ++it) { - cmCacheManager::CacheEntryType t = - cm.GetState()->GetCacheEntryType(*it); - if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && - t != cmCacheManager::UNINITIALIZED ) + cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it); + if (t != cmState::INTERNAL && t != cmState::STATIC && + t != cmState::UNINITIALIZED) { const char* advancedProp = cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED"); @@ -351,7 +348,7 @@ int do_cmake(int ac, char const* const* av) "HELPSTRING") << std::endl; } std::cout << *it << ":" << - cmCacheManager::TypeToString(t) + cmState::CacheEntryTypeToString(t) << "=" << cm.GetState()->GetCacheEntryValue(*it) << std::endl; if ( list_help ) From fef1f26749a7dc3839b1e461fb09eecbe97cca90 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Apr 2015 12:57:59 -0400 Subject: [PATCH 0528/1029] Help: Fix {GIT,P4}UpdateCustom documentation (#15512) The GITUpdateCustom and P4UpdateCustom options take only one command line with all arguments as a ;-list, not a ;-list of multiple command lines. Fix the incorrect documentation originally added by commit v3.1.0-rc1~463^2 (Help: Document ctest dashboard client usage, 2014-05-30). --- Help/manual/ctest.1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index dd3bcfb70..584786fd4 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -573,7 +573,7 @@ Configuration settings to specify the version control tool include: * :module:`CTest` module variable: ``GITCOMMAND`` ``GITUpdateCustom`` - Specify a semicolon-separated list of custom command lines to run + Specify a custom command line (as a semicolon-separated list) to run in the source tree (Git work tree) to update it instead of running the ``GITCommand``. @@ -617,7 +617,7 @@ Configuration settings to specify the version control tool include: * :module:`CTest` module variable: ``CTEST_P4_OPTIONS`` ``P4UpdateCustom`` - Specify a semicolon-separated list of custom command lines to run + Specify a custom command line (as a semicolon-separated list) to run in the source tree (Perforce tree) to update it instead of running the ``P4Command``. From b159bff732d4e34a683edd1740604428049d1819 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 4 Apr 2015 23:33:26 +0200 Subject: [PATCH 0529/1029] Move property definition to cmState. --- Source/cmCPluginAPI.cxx | 2 +- Source/cmDefinePropertyCommand.cxx | 3 +- Source/cmGetPropertyCommand.cxx | 6 ++-- Source/cmMakefile.cxx | 15 -------- Source/cmMakefile.h | 3 -- Source/cmPropertyMap.cxx | 4 ++- Source/cmState.cxx | 58 ++++++++++++++++++++++++++++++ Source/cmState.h | 19 ++++++++++ Source/cmTarget.cxx | 14 -------- Source/cmTarget.h | 3 -- Source/cmake.cxx | 39 +------------------- Source/cmake.h | 18 ---------- 12 files changed, 87 insertions(+), 97 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 5ae7d4ca2..6134c6f60 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -867,7 +867,7 @@ void CCONV DefineSourceFileProperty (void *arg, const char *name, int chained) { cmMakefile *mf = static_cast(arg); - mf->GetCMakeInstance()->DefineProperty(name,cmProperty::SOURCE_FILE, + mf->GetState()->DefineProperty(name,cmProperty::SOURCE_FILE, briefDocs, longDocs, chained != 0); } diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 5ff0186da..0efc7fcf5 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmDefinePropertyCommand.h" #include "cmake.h" +#include "cmState.h" bool cmDefinePropertyCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) @@ -127,7 +128,7 @@ bool cmDefinePropertyCommand } // Actually define the property. - this->Makefile->GetCMakeInstance()->DefineProperty + this->Makefile->GetState()->DefineProperty (this->PropertyName, scope, this->BriefDocs.c_str(), this->FullDocs.c_str(), inherited); diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 80edbcd22..a8481ad9d 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -143,7 +143,7 @@ bool cmGetPropertyCommand // Lookup brief documentation. std::string output; if(cmPropertyDefinition* def = - this->Makefile->GetCMakeInstance()-> + this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); @@ -159,7 +159,7 @@ bool cmGetPropertyCommand // Lookup full documentation. std::string output; if(cmPropertyDefinition* def = - this->Makefile->GetCMakeInstance()-> + this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); @@ -173,7 +173,7 @@ bool cmGetPropertyCommand else if(this->InfoType == OutDefined) { // Lookup if the property is defined - if(this->Makefile->GetCMakeInstance()-> + if(this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { this->Makefile->AddDefinition(this->Variable, "1"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ad3cce43c..b1e67f4bf 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4476,21 +4476,6 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) } } - -// define properties -void cmMakefile::DefineProperties(cmake *cm) -{ - cm->DefineProperty - ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY, - "", "", true); -} - //---------------------------------------------------------------------------- cmTarget* cmMakefile::AddImportedTarget(const std::string& name, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 57a418029..43c1b1a6b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -851,9 +851,6 @@ public: const std::vector& GetTestGenerators() const { return this->TestGenerators; } - // Define the properties - static void DefineProperties(cmake *cm); - // push and pop variable scopes void PushScope(); void PopScope(); diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index e335b3b55..070f6f1ed 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -12,6 +12,7 @@ #include "cmPropertyMap.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmState.h" cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) { @@ -73,7 +74,8 @@ const char *cmPropertyMap // should we chain up? if (this->CMakeInstance) { - chain = this->CMakeInstance->IsPropertyChained(name,scope); + chain = this->CMakeInstance->GetState()-> + IsPropertyChained(name,scope); } return 0; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7602f6324..3e88ecce3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -178,3 +178,61 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, this->CMakeInstance->GetCacheManager() ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0); } + +void cmState::Initialize() +{ + this->PropertyDefinitions.clear(); + this->DefineProperty + ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY, + "", "", true); + + this->DefineProperty + ("RULE_LAUNCH_COMPILE", cmProperty::TARGET, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_LINK", cmProperty::TARGET, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, + "", "", true); +} + +void cmState::DefineProperty(const std::string& name, + cmProperty::ScopeType scope, + const char *ShortDescription, + const char *FullDescription, + bool chained) +{ + this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription, + FullDescription, + chained); +} + +cmPropertyDefinition *cmState +::GetPropertyDefinition(const std::string& name, + cmProperty::ScopeType scope) +{ + if (this->IsPropertyDefined(name,scope)) + { + return &(this->PropertyDefinitions[scope][name]); + } + return 0; +} + +bool cmState::IsPropertyDefined(const std::string& name, + cmProperty::ScopeType scope) +{ + return this->PropertyDefinitions[scope].IsPropertyDefined(name); +} + +bool cmState::IsPropertyChained(const std::string& name, + cmProperty::ScopeType scope) +{ + return this->PropertyDefinitions[scope].IsPropertyChained(name); +} diff --git a/Source/cmState.h b/Source/cmState.h index f2e8ef5e8..310707dd9 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -13,6 +13,7 @@ #define cmState_h #include "cmStandardIncludes.h" +#include "cmPropertyDefinitionMap.h" class cmake; @@ -55,7 +56,25 @@ public: void RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName); + void Initialize(); + // Define a property + void DefineProperty(const std::string& name, cmProperty::ScopeType scope, + const char *ShortDescription, + const char *FullDescription, + bool chain = false); + + // get property definition + cmPropertyDefinition *GetPropertyDefinition + (const std::string& name, cmProperty::ScopeType scope); + + // Is a property defined? + bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); + bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); + + private: + std::map PropertyDefinitions; + cmake* CMakeInstance; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6711e86db..f1540d437 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -264,20 +264,6 @@ cmTarget::cmTarget() this->LinkImplementationLanguageIsContextDependent = true; } -//---------------------------------------------------------------------------- -void cmTarget::DefineProperties(cmake *cm) -{ - cm->DefineProperty - ("RULE_LAUNCH_COMPILE", cmProperty::TARGET, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_LINK", cmProperty::TARGET, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, - "", "", true); -} - void cmTarget::SetType(TargetType type, const std::string& name) { this->Name = name; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 55bf234b2..a03241466 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -489,9 +489,6 @@ public: const char** imp, std::string& suffix) const; - // Define the properties - static void DefineProperties(cmake *cm); - /** Get the macro to define when building sources in this target. If no macro should be defined null is returned. */ const char* GetExportMacro() const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8cdf96fe4..6adecee4f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -191,11 +191,8 @@ cmake::~cmake() void cmake::InitializeProperties() { this->Properties.clear(); - this->PropertyDefinitions.clear(); - // initialize properties - cmTarget::DefineProperties(this); - cmMakefile::DefineProperties(this); + this->State->Initialize(); } void cmake::CleanupCommandsAndMacros() @@ -2298,40 +2295,6 @@ void cmake::GenerateGraphViz(const char* fileName) const #endif } -void cmake::DefineProperty(const std::string& name, - cmProperty::ScopeType scope, - const char *ShortDescription, - const char *FullDescription, - bool chained) -{ - this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription, - FullDescription, - chained); -} - -cmPropertyDefinition *cmake -::GetPropertyDefinition(const std::string& name, - cmProperty::ScopeType scope) -{ - if (this->IsPropertyDefined(name,scope)) - { - return &(this->PropertyDefinitions[scope][name]); - } - return 0; -} - -bool cmake::IsPropertyDefined(const std::string& name, - cmProperty::ScopeType scope) -{ - return this->PropertyDefinitions[scope].IsPropertyDefined(name); -} - -bool cmake::IsPropertyChained(const std::string& name, - cmProperty::ScopeType scope) -{ - return this->PropertyDefinitions[scope].IsPropertyChained(name); -} - void cmake::SetProperty(const std::string& prop, const char* value) { this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); diff --git a/Source/cmake.h b/Source/cmake.h index e80cc1cc3..38c05c93a 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -15,7 +15,6 @@ #include "cmListFileCache.h" #include "cmSystemTools.h" -#include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmInstalledFile.h" #include "cmCacheManager.h" @@ -323,20 +322,6 @@ class cmake void MarkCliAsUsed(const std::string& variable); - // Define a property - void DefineProperty(const std::string& name, cmProperty::ScopeType scope, - const char *ShortDescription, - const char *FullDescription, - bool chain = false); - - // get property definition - cmPropertyDefinition *GetPropertyDefinition - (const std::string& name, cmProperty::ScopeType scope); - - // Is a property defined? - bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); - bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); - /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ std::vector GetDebugConfigs(); @@ -373,9 +358,6 @@ protected: int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; - std::map - PropertyDefinitions; - typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map Date: Sat, 11 Apr 2015 14:16:39 +0200 Subject: [PATCH 0530/1029] cmGlobalGenerator: Delegate storage of enabled languages to cmState. --- Source/cmGlobalGenerator.cxx | 15 ++++----------- Source/cmState.cxx | 27 +++++++++++++++++++++++++++ Source/cmState.h | 6 +++++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 171d62a07..56a0a4536 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -969,13 +969,7 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf) { - std::vector::iterator it = - std::lower_bound(this->LanguageEnabled.begin(), - this->LanguageEnabled.end(), l); - if (it == this->LanguageEnabled.end() || *it != l) - { - this->LanguageEnabled.insert(it, l); - } + this->CMakeInstance->GetState()->SetLanguageEnabled(l); // Fill the language-to-extension map with the current variable // settings to make sure it is available for the try_compile() @@ -1086,13 +1080,12 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { - return std::binary_search(this->LanguageEnabled.begin(), - this->LanguageEnabled.end(), l); + return this->CMakeInstance->GetState()->GetLanguageEnabled(l); } void cmGlobalGenerator::ClearEnabledLanguages() { - this->LanguageEnabled.clear(); + return this->CMakeInstance->GetState()->ClearEnabledLanguages(); } void cmGlobalGenerator::Configure() @@ -1966,7 +1959,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - lang = this->LanguageEnabled; + lang = this->CMakeInstance->GetState()->GetEnabledLanguages(); } int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3e88ecce3..c43262fe5 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -236,3 +236,30 @@ bool cmState::IsPropertyChained(const std::string& name, { return this->PropertyDefinitions[scope].IsPropertyChained(name); } + +void cmState::SetLanguageEnabled(std::string const& l) +{ + std::vector::iterator it = + std::lower_bound(this->EnabledLanguages.begin(), + this->EnabledLanguages.end(), l); + if (it == this->EnabledLanguages.end() || *it != l) + { + this->EnabledLanguages.insert(it, l); + } +} + +bool cmState::GetLanguageEnabled(std::string const& l) const +{ + return std::binary_search(this->EnabledLanguages.begin(), + this->EnabledLanguages.end(), l); +} + +std::vector cmState::GetEnabledLanguages() const +{ + return this->EnabledLanguages; +} + +void cmState::ClearEnabledLanguages() +{ + this->EnabledLanguages.clear(); +} diff --git a/Source/cmState.h b/Source/cmState.h index 310707dd9..b1f143072 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -71,10 +71,14 @@ public: bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); + void SetLanguageEnabled(std::string const& l); + bool GetLanguageEnabled(std::string const& l) const; + std::vector GetEnabledLanguages() const; + void ClearEnabledLanguages(); private: std::map PropertyDefinitions; - + std::vector EnabledLanguages; cmake* CMakeInstance; }; From db8425be18439c899c08294dde117cc137c75d23 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 14:16:44 +0200 Subject: [PATCH 0531/1029] cmake: Get enabled languages from cmState. The check for a global generator is redundant - the enabled languages are only populated by the global generator. --- Source/cmake.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6adecee4f..94b0ae0c7 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2343,14 +2343,9 @@ const char *cmake::GetProperty(const std::string& prop, } else if ( prop == "ENABLED_LANGUAGES" ) { - std::string lang; - if(this->GlobalGenerator) - { - std::vector enLangs; - this->GlobalGenerator->GetEnabledLanguages(enLangs); - lang = cmJoin(enLangs, ";"); - } - this->SetProperty("ENABLED_LANGUAGES", lang.c_str()); + std::string langs; + langs = cmJoin(this->State->GetEnabledLanguages(), ";"); + this->SetProperty("ENABLED_LANGUAGES", langs.c_str()); } #define STRING_LIST_ELEMENT(F) ";" #F if (prop == "CMAKE_C_KNOWN_FEATURES") From 62854e9966a3fe308cff4a76c89f6bf72f76551c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:16:54 +0200 Subject: [PATCH 0532/1029] cmState: Move try_compile state from cmake class. --- Source/cmState.cxx | 13 ++++++++++++- Source/cmState.h | 4 ++++ Source/cmake.cxx | 13 ++++++------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c43262fe5..be6a76646 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -15,7 +15,8 @@ #include "cmCacheManager.h" cmState::cmState(cmake* cm) - : CMakeInstance(cm) + : CMakeInstance(cm), + IsInTryCompile(false) { } @@ -263,3 +264,13 @@ void cmState::ClearEnabledLanguages() { this->EnabledLanguages.clear(); } + +bool cmState::GetIsInTryCompile() const +{ + return this->IsInTryCompile; +} + +void cmState::SetIsInTryCompile(bool b) +{ + this->IsInTryCompile = b; +} diff --git a/Source/cmState.h b/Source/cmState.h index b1f143072..6df618253 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -76,10 +76,14 @@ public: std::vector GetEnabledLanguages() const; void ClearEnabledLanguages(); + bool GetIsInTryCompile() const; + void SetIsInTryCompile(bool b); + private: std::map PropertyDefinitions; std::vector EnabledLanguages; cmake* CMakeInstance; + bool IsInTryCompile; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 94b0ae0c7..0dcf9be09 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -151,7 +151,6 @@ cmake::cmake() #endif this->Verbose = false; - this->InTryCompile = false; this->CacheManager = new cmCacheManager(this); this->GlobalGenerator = 0; this->ProgressCallback = 0; @@ -1272,7 +1271,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true); // erase the property to avoid infinite recursion this->SetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", ""); - if(this->GetIsInTryCompile()) + if(this->State->GetIsInTryCompile()) { return 0; } @@ -1555,7 +1554,7 @@ int cmake::ActualConfigure() // reset any system configuration information, except for when we are // InTryCompile. With TryCompile the system info is taken from the parent's // info to save time - if (!this->InTryCompile) + if (!this->State->GetIsInTryCompile()) { this->GlobalGenerator->ClearEnabledLanguages(); @@ -1958,7 +1957,7 @@ void cmake::SetProgressCallback(ProgressCallbackType f, void *cd) void cmake::UpdateProgress(const char *msg, float prog) { - if(this->ProgressCallback && !this->InTryCompile) + if(this->ProgressCallback && !this->State->GetIsInTryCompile()) { (*this->ProgressCallback)(msg, prog, this->ProgressCallbackClientData); return; @@ -1967,12 +1966,12 @@ void cmake::UpdateProgress(const char *msg, float prog) bool cmake::GetIsInTryCompile() const { - return this->InTryCompile; + return this->State->GetIsInTryCompile(); } void cmake::SetIsInTryCompile(bool b) { - this->InTryCompile = b; + this->State->SetIsInTryCompile(b); } void cmake::GetGeneratorDocumentation(std::vector& v) @@ -2339,7 +2338,7 @@ const char *cmake::GetProperty(const std::string& prop, else if ( prop == "IN_TRY_COMPILE" ) { this->SetProperty("IN_TRY_COMPILE", - this->GetIsInTryCompile()? "1":"0"); + this->State->GetIsInTryCompile() ? "1" : "0"); } else if ( prop == "ENABLED_LANGUAGES" ) { From 1e738bcf9c7952bc9ae9bfb1be831c9f16998f54 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 13 Apr 2015 20:48:48 +0200 Subject: [PATCH 0533/1029] cmake: Simplify RemoveUnscriptableCommands algorithm. Remove obsolete RemoveCommand method. --- Source/cmake.cxx | 30 ++++++++---------------------- Source/cmake.h | 1 - 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0dcf9be09..b852e0070 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -261,17 +261,6 @@ void cmake::RenameCommand(const std::string& oldName, this->Commands.erase(pos); } -void cmake::RemoveCommand(const std::string& name) -{ - std::string sName = cmSystemTools::LowerCase(name); - RegisteredCommandsMap::iterator pos = this->Commands.find(sName); - if ( pos != this->Commands.end() ) - { - delete pos->second; - this->Commands.erase(pos); - } -} - void cmake::AddCommand(cmCommand* command) { std::string name = cmSystemTools::LowerCase(command->GetName()); @@ -289,22 +278,19 @@ void cmake::AddCommand(cmCommand* command) void cmake::RemoveUnscriptableCommands() { std::vector unscriptableCommands; - for (cmake::RegisteredCommandsMap::const_iterator + for (cmake::RegisteredCommandsMap::iterator pos = this->Commands.begin(); - pos != this->Commands.end(); - ++pos) + pos != this->Commands.end(); ) { if (!pos->second->IsScriptable()) { - unscriptableCommands.push_back(pos->first); + delete pos->second; + this->Commands.erase(pos++); + } + else + { + ++pos; } - } - - for(std::vector::const_iterator it=unscriptableCommands.begin(); - it != unscriptableCommands.end(); - ++it) - { - this->RemoveCommand(*it); } } diff --git a/Source/cmake.h b/Source/cmake.h index 38c05c93a..455b54eca 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -222,7 +222,6 @@ class cmake */ void AddCommand(cmCommand* ); void RenameCommand(const std::string& oldName, const std::string& newName); - void RemoveCommand(const std::string& name); void RemoveUnscriptableCommands(); /** From 97e53ebb3cd728e6091f93cb7d4eac91ae417bdb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 10:48:17 +0200 Subject: [PATCH 0534/1029] cmake: Simplify command clean up loop. --- Source/cmake.cxx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b852e0070..6518207e3 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -197,27 +197,20 @@ void cmake::InitializeProperties() void cmake::CleanupCommandsAndMacros() { this->InitializeProperties(); - std::vector commands; for(RegisteredCommandsMap::iterator j = this->Commands.begin(); - j != this->Commands.end(); ++j) + j != this->Commands.end(); ) { - if ( !j->second->IsA("cmMacroHelperCommand") && - !j->second->IsA("cmFunctionHelperCommand")) + if (j->second->IsA("cmMacroHelperCommand") || + j->second->IsA("cmFunctionHelperCommand")) { - commands.push_back(j->second); + delete j->second; + this->Commands.erase(j++); } else { - delete j->second; + ++j; } } - this->Commands.clear(); - std::vector::iterator it; - for ( it = commands.begin(); it != commands.end(); - ++ it ) - { - this->Commands[cmSystemTools::LowerCase((*it)->GetName())] = *it; - } } bool cmake::CommandExists(const std::string& name) const From 96f8c5f9a3bd60f553af054b43e06ce4864269e0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:30:26 +0200 Subject: [PATCH 0535/1029] cmState: Move cmCommand-related methods from cmake class. --- Source/cmState.cxx | 110 +++++++++++++++++++++++++++++++++++++++++++++ Source/cmState.h | 10 +++++ Source/cmake.cxx | 88 ++++-------------------------------- Source/cmake.h | 2 - 4 files changed, 128 insertions(+), 82 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index be6a76646..17b6cf20b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -13,6 +13,10 @@ #include "cmake.h" #include "cmCacheManager.h" +#include "cmCommand.h" +#include "cmAlgorithms.h" + +#include cmState::cmState(cmake* cm) : CMakeInstance(cm), @@ -20,6 +24,11 @@ cmState::cmState(cmake* cm) { } +cmState::~cmState() +{ + cmDeleteAll(this->Commands); +} + const char* cmCacheEntryTypes[] = { "BOOL", "PATH", @@ -274,3 +283,104 @@ void cmState::SetIsInTryCompile(bool b) { this->IsInTryCompile = b; } + +void cmState::RenameCommand(std::string const& oldName, + std::string const& newName) +{ + // if the command already exists, free the old one + std::string sOldName = cmSystemTools::LowerCase(oldName); + std::string sNewName = cmSystemTools::LowerCase(newName); + std::map::iterator pos = + this->Commands.find(sOldName); + if ( pos == this->Commands.end() ) + { + return; + } + cmCommand* cmd = pos->second; + + pos = this->Commands.find(sNewName); + if (pos != this->Commands.end()) + { + delete pos->second; + this->Commands.erase(pos); + } + this->Commands.insert(std::make_pair(sNewName, cmd)); + pos = this->Commands.find(sOldName); + this->Commands.erase(pos); +} + +void cmState::AddCommand(cmCommand* command) +{ + std::string name = cmSystemTools::LowerCase(command->GetName()); + // if the command already exists, free the old one + std::map::iterator pos = this->Commands.find(name); + if (pos != this->Commands.end()) + { + delete pos->second; + this->Commands.erase(pos); + } + this->Commands.insert(std::make_pair(name, command)); +} + +void cmState::RemoveUnscriptableCommands() +{ + std::vector unscriptableCommands; + for (std::map::iterator + pos = this->Commands.begin(); + pos != this->Commands.end(); ) + { + if (!pos->second->IsScriptable()) + { + delete pos->second; + this->Commands.erase(pos++); + } + else + { + ++pos; + } + } +} + +cmCommand* cmState::GetCommand(std::string const& name) const +{ + cmCommand* command = 0; + std::string sName = cmSystemTools::LowerCase(name); + std::map::const_iterator pos = + this->Commands.find(sName); + if (pos != this->Commands.end()) + { + command = (*pos).second; + } + return command; +} + +std::vector cmState::GetCommandNames() const +{ + std::vector commandNames; + commandNames.reserve(this->Commands.size()); + std::map::const_iterator cmds + = this->Commands.begin(); + for ( ; cmds != this->Commands.end(); ++ cmds ) + { + commandNames.push_back(cmds->first); + } + return commandNames; +} + +void cmState::RemoveUserDefinedCommands() +{ + for(std::map::iterator j = this->Commands.begin(); + j != this->Commands.end(); ) + { + if (j->second->IsA("cmMacroHelperCommand") || + j->second->IsA("cmFunctionHelperCommand")) + { + delete j->second; + this->Commands.erase(j++); + } + else + { + ++j; + } + } +} diff --git a/Source/cmState.h b/Source/cmState.h index 6df618253..a7a17eef3 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -16,11 +16,13 @@ #include "cmPropertyDefinitionMap.h" class cmake; +class cmCommand; class cmState { public: cmState(cmake* cm); + ~cmState(); enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, UNINITIALIZED }; @@ -79,9 +81,17 @@ public: bool GetIsInTryCompile() const; void SetIsInTryCompile(bool b); + cmCommand* GetCommand(std::string const& name) const; + void AddCommand(cmCommand* command); + void RemoveUnscriptableCommands(); + void RenameCommand(std::string const& oldName, std::string const& newName); + void RemoveUserDefinedCommands(); + std::vector GetCommandNames() const; + private: std::map PropertyDefinitions; std::vector EnabledLanguages; + std::map Commands; cmake* CMakeInstance; bool IsInTryCompile; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6518207e3..89d5feac8 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -179,7 +179,6 @@ cmake::~cmake() delete this->GlobalGenerator; this->GlobalGenerator = 0; } - cmDeleteAll(this->Commands); cmDeleteAll(this->Generators); #ifdef CMAKE_BUILD_WITH_CMAKE delete this->VariableWatch; @@ -197,94 +196,33 @@ void cmake::InitializeProperties() void cmake::CleanupCommandsAndMacros() { this->InitializeProperties(); - for(RegisteredCommandsMap::iterator j = this->Commands.begin(); - j != this->Commands.end(); ) - { - if (j->second->IsA("cmMacroHelperCommand") || - j->second->IsA("cmFunctionHelperCommand")) - { - delete j->second; - this->Commands.erase(j++); - } - else - { - ++j; - } - } + this->State->RemoveUserDefinedCommands(); } bool cmake::CommandExists(const std::string& name) const { - return this->GetCommand(name) ? true : false; + return this->State->GetCommand(name) ? true : false; } cmCommand *cmake::GetCommand(const std::string& name) const { - cmCommand* command = 0; - std::string sName = cmSystemTools::LowerCase(name); - RegisteredCommandsMap::const_iterator pos = this->Commands.find(sName); - if (pos != this->Commands.end()) - { - command = (*pos).second; - } - return command; + return this->State->GetCommand(name); } void cmake::RenameCommand(const std::string& oldName, const std::string& newName) { - // if the command already exists, free the old one - std::string sOldName = cmSystemTools::LowerCase(oldName); - RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName); - if ( pos == this->Commands.end() ) - { - return; - } - std::string sNewName = cmSystemTools::LowerCase(newName); - cmCommand* cmd = pos->second; - - pos = this->Commands.find(sNewName); - if (pos != this->Commands.end()) - { - delete pos->second; - this->Commands.erase(pos); - } - this->Commands.insert(std::make_pair(sNewName, cmd)); - pos = this->Commands.find(sOldName); - this->Commands.erase(pos); + this->State->RenameCommand(oldName, newName); } void cmake::AddCommand(cmCommand* command) { - std::string name = cmSystemTools::LowerCase(command->GetName()); - // if the command already exists, free the old one - RegisteredCommandsMap::iterator pos = this->Commands.find(name); - if (pos != this->Commands.end()) - { - delete pos->second; - this->Commands.erase(pos); - } - this->Commands.insert(std::make_pair(name, command)); + this->State->AddCommand(command); } - void cmake::RemoveUnscriptableCommands() { - std::vector unscriptableCommands; - for (cmake::RegisteredCommandsMap::iterator - pos = this->Commands.begin(); - pos != this->Commands.end(); ) - { - if (!pos->second->IsScriptable()) - { - delete pos->second; - this->Commands.erase(pos++); - } - else - { - ++pos; - } - } + this->State->RemoveUnscriptableCommands(); } // Parse the args @@ -2301,18 +2239,8 @@ const char *cmake::GetProperty(const std::string& prop, } else if ( prop == "COMMANDS" ) { - cmake::RegisteredCommandsMap::iterator cmds - = this->Commands.begin(); - for (unsigned int cc=0 ; cmds != this->Commands.end(); ++ cmds ) - { - if ( cc > 0 ) - { - output += ";"; - } - output += cmds->first.c_str(); - cc++; - } - this->SetProperty("COMMANDS",output.c_str()); + std::vector commands = this->State->GetCommandNames(); + this->SetProperty("COMMANDS", cmJoin(commands, ";").c_str()); } else if ( prop == "IN_TRY_COMPILE" ) { diff --git a/Source/cmake.h b/Source/cmake.h index 455b54eca..e7a8acb81 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -93,7 +93,6 @@ class cmake */ FIND_PACKAGE_MODE }; - typedef std::map RegisteredCommandsMap; typedef std::map InstalledFilesMap; /// Default constructor @@ -362,7 +361,6 @@ protected: typedef std::map RegisteredExtraGeneratorsMap; typedef std::vector RegisteredGeneratorsVector; - RegisteredCommandsMap Commands; RegisteredGeneratorsVector Generators; RegisteredExtraGeneratorsMap ExtraGenerators; void AddDefaultCommands(); From cdc53b62c20605467334ecb80c474533e04ff26c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 14 Apr 2015 00:01:06 -0400 Subject: [PATCH 0536/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f91acbe57..84e2e4998 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150413) +set(CMake_VERSION_PATCH 20150414) #set(CMake_VERSION_RC 1) From baef72f2b369b77507969e3362edfc8d7171c43a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Apr 2015 11:03:48 -0400 Subject: [PATCH 0537/1029] Tests: Update Preprocess test for XL compiler limitations --- Tests/Preprocess/CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index 8ff0cfde7..15e2aca7c 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -134,6 +134,15 @@ if((NOT MSVC OR PP_NMAKE) AND set(EXPR_OP1 "%") endif() +# XL: )( +# The XL compiler cannot pass unbalanced parens correctly to a tool +# it launches internally. +if(CMAKE_C_COMPILER_ID STREQUAL "XL") + set(STRING_EXTRA "${STRING_EXTRA}()") +else() + set(STRING_EXTRA "${STRING_EXTRA})(") +endif() + # General: \" # Make tools do not reliably accept \\\" syntax: # - MinGW and MSYS make tools crash with \\\" @@ -141,7 +150,10 @@ endif() # or $(BACKSLASH)\" where BACKSLASH is a variable set to \\ # - VS IDE gets confused about the bounds of the definition value \\\" # - NMake is okay with just \\\" -if(PP_NMAKE OR PP_UMAKE) +# - The XL compiler does not re-escape \\\" when launching an +# internal tool to do preprocessing . +if((PP_NMAKE OR PP_UMAKE) AND + NOT CMAKE_C_COMPILER_ID STREQUAL "XL") set(STRING_EXTRA "${STRING_EXTRA}\\\"") endif() @@ -160,7 +172,7 @@ endif() # support it and it is not an operator it is not worthwhile. # Compose the final test string. -set(STRING_VALUE "hello`~!@$*)(_+-=}{][:'.?/${STRING_EXTRA}world") +set(STRING_VALUE "hello`~!@$*_+-=}{][:'.?/${STRING_EXTRA}world") #----------------------------------------------------------------------------- # Function-style macro command-line support: From 9ac05683902c7412476c4514588bff5c016d6ce1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Apr 2015 13:14:50 -0400 Subject: [PATCH 0538/1029] Ninja: Drop 'experimental' label in documentation This generator is no longer experimental and has been fairly mature for several releases already. --- Help/generator/Ninja.rst | 2 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Help/generator/Ninja.rst b/Help/generator/Ninja.rst index 08f74fbfd..920abcbfa 100644 --- a/Help/generator/Ninja.rst +++ b/Help/generator/Ninja.rst @@ -1,7 +1,7 @@ Ninja ----- -Generates build.ninja files (experimental). +Generates build.ninja files. A build.ninja file is generated into the build tree. Recent versions of the ninja program can build the project through the "all" target. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f74f1e065..9a00fa6bb 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -507,7 +507,7 @@ void cmGlobalNinjaGenerator ::GetDocumentation(cmDocumentationEntry& entry) { entry.Name = cmGlobalNinjaGenerator::GetActualName(); - entry.Brief = "Generates build.ninja files (experimental)."; + entry.Brief = "Generates build.ninja files."; } // Implemented in all cmGlobaleGenerator sub-classes. From ff742f6823acb14b7ec03ef6e87d717e5493ef12 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 15 Apr 2015 00:01:05 -0400 Subject: [PATCH 0539/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 84e2e4998..649f23050 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150414) +set(CMake_VERSION_PATCH 20150415) #set(CMake_VERSION_RC 1) From 85c2626babf40d704f133fe49506d25f0a674b5f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Apr 2015 15:48:34 -0400 Subject: [PATCH 0540/1029] Deprecate Visual Studio 6 generator Update documentation to mark the generator deprecated. Add a warning at the end of generation plus an option to turn off the warning. --- Help/generator/Visual Studio 6.rst | 8 +++++++- Help/release/dev/vs6-deprecate.rst | 5 +++++ Source/cmGlobalVisualStudio6Generator.cxx | 18 +++++++++++++++++- .../CommandLine/DeprecateVS6-WARN-OFF.cmake | 0 .../DeprecateVS6-WARN-ON-stderr.txt | 5 +++++ .../CommandLine/DeprecateVS6-WARN-ON.cmake | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 7 +++++++ Tests/RunCMake/RunCMake.cmake | 3 +++ 8 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/vs6-deprecate.rst create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS6-WARN-OFF.cmake create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON.cmake diff --git a/Help/generator/Visual Studio 6.rst b/Help/generator/Visual Studio 6.rst index d61935466..855589c93 100644 --- a/Help/generator/Visual Studio 6.rst +++ b/Help/generator/Visual Studio 6.rst @@ -1,4 +1,10 @@ Visual Studio 6 --------------- -Generates Visual Studio 6 project files. +Deprected. Generates Visual Studio 6 project files. + +.. note:: + This generator is deprecated and will be removed + in a future version of CMake. It will still be + possible to build with VS 6 tools using the + :generator:`NMake Makefiles` generator. diff --git a/Help/release/dev/vs6-deprecate.rst b/Help/release/dev/vs6-deprecate.rst new file mode 100644 index 000000000..83f9afb09 --- /dev/null +++ b/Help/release/dev/vs6-deprecate.rst @@ -0,0 +1,5 @@ +vs6-deprecate +------------- + +* The :generator:`Visual Studio 6` generator is now deprecated + and will be removed in a future version of CMake. diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 62a308e1d..e2b2bbd4e 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -185,6 +185,22 @@ void cmGlobalVisualStudio6Generator::Generate() // Now write out the DSW this->OutputDSWFile(); + + if (!this->CMakeInstance->GetIsInTryCompile()) + { + const char* cmakeWarnVS6 = + this->CMakeInstance->GetState()->GetCacheEntryValue("CMAKE_WARN_VS6"); + if (!cmakeWarnVS6 || !cmSystemTools::IsOff(cmakeWarnVS6)) + { + this->CMakeInstance->IssueMessage( + cmake::WARNING, + "The \"Visual Studio 6\" generator is deprecated " + "and will be removed in a future version of CMake." + "\n" + "Add CMAKE_WARN_VS6=OFF to the cache to disable this warning." + ); + } + } } // Write a DSW file to the stream @@ -411,7 +427,7 @@ void cmGlobalVisualStudio6Generator ::GetDocumentation(cmDocumentationEntry& entry) { entry.Name = cmGlobalVisualStudio6Generator::GetActualName(); - entry.Brief = "Generates Visual Studio 6 project files."; + entry.Brief = "Deprecated. Generates Visual Studio 6 project files."; } //---------------------------------------------------------------------------- diff --git a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-OFF.cmake new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt new file mode 100644 index 000000000..1b6a51052 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning: + The "Visual Studio 6" generator is deprecated and will be removed in a + future version of CMake. + + Add CMAKE_WARN_VS6=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS6-WARN-ON.cmake new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f047baf20..4242723d5 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -40,6 +40,13 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") unset(RunCMake_TEST_NO_CLEAN) endif() +if(RunCMake_GENERATOR STREQUAL "Visual Studio 6") + set(RunCMake_WARN_VS6 1) + run_cmake(DeprecateVS6-WARN-ON) + unset(RunCMake_WARN_VS6) + run_cmake(DeprecateVS6-WARN-OFF) +endif() + if(UNIX) run_cmake_command(E_create_symlink-no-arg ${CMAKE_COMMAND} -E create_symlink diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 6333703a7..e5d3590fd 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -51,6 +51,9 @@ function(run_cmake test) if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() + if(RunCMake_GENERATOR STREQUAL "Visual Studio 6" AND NOT RunCMake_WARN_VS6) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS6=OFF) + endif() if(RunCMake_MAKE_PROGRAM) list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() From 7b8e7c4ac3885b9a58ce1c238b045d5580f83c27 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Apr 2015 09:20:12 -0400 Subject: [PATCH 0541/1029] Deprecate Visual Studio 7 generator (.NET 2002) Update documentation to mark the generator deprecated. Add a warning at the end of generation plus an option to turn off the warning. --- Help/generator/Visual Studio 7.rst | 8 +++++++- Help/release/dev/vs70-deprecate.rst | 5 +++++ Source/cmGlobalVisualStudio7Generator.cxx | 19 ++++++++++++++++++- .../CommandLine/DeprecateVS70-WARN-OFF.cmake | 0 .../DeprecateVS70-WARN-ON-stderr.txt | 5 +++++ .../CommandLine/DeprecateVS70-WARN-ON.cmake | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 5 +++++ Tests/RunCMake/RunCMake.cmake | 3 +++ 8 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/vs70-deprecate.rst create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS70-WARN-OFF.cmake create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON.cmake diff --git a/Help/generator/Visual Studio 7.rst b/Help/generator/Visual Studio 7.rst index d0eb719e5..eb426f47a 100644 --- a/Help/generator/Visual Studio 7.rst +++ b/Help/generator/Visual Studio 7.rst @@ -1,4 +1,10 @@ Visual Studio 7 --------------- -Generates Visual Studio .NET 2002 project files. +Deprected. Generates Visual Studio .NET 2002 project files. + +.. note:: + This generator is deprecated and will be removed + in a future version of CMake. It will still be + possible to build with VS 7.0 tools using the + :generator:`NMake Makefiles` generator. diff --git a/Help/release/dev/vs70-deprecate.rst b/Help/release/dev/vs70-deprecate.rst new file mode 100644 index 000000000..fb9411027 --- /dev/null +++ b/Help/release/dev/vs70-deprecate.rst @@ -0,0 +1,5 @@ +vs70-deprecate +-------------- + +* The :generator:`Visual Studio 7` generator (.NET 2002) is now + deprecated and will be removed in a future version of CMake. diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 6a3a145f2..0d7dfd742 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -351,6 +351,23 @@ void cmGlobalVisualStudio7Generator::Generate() { this->CallVisualStudioMacro(MacroReload); } + + if (!this->CMakeInstance->GetIsInTryCompile() && + this->GetName() == "Visual Studio 7") + { + const char* cmakeWarnVS70 = + this->CMakeInstance->GetState()->GetCacheEntryValue("CMAKE_WARN_VS70"); + if (!cmakeWarnVS70 || !cmSystemTools::IsOff(cmakeWarnVS70)) + { + this->CMakeInstance->IssueMessage( + cmake::WARNING, + "The \"Visual Studio 7\" generator is deprecated " + "and will be removed in a future version of CMake." + "\n" + "Add CMAKE_WARN_VS70=OFF to the cache to disable this warning." + ); + } + } } void cmGlobalVisualStudio7Generator @@ -983,7 +1000,7 @@ void cmGlobalVisualStudio7Generator ::GetDocumentation(cmDocumentationEntry& entry) { entry.Name = cmGlobalVisualStudio7Generator::GetActualName(); - entry.Brief = "Generates Visual Studio .NET 2002 project files."; + entry.Brief = "Deprecated. Generates Visual Studio .NET 2002 project files."; } //---------------------------------------------------------------------------- diff --git a/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-OFF.cmake new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON-stderr.txt new file mode 100644 index 000000000..ea31ef315 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning: + The "Visual Studio 7" generator is deprecated and will be removed in a + future version of CMake. + + Add CMAKE_WARN_VS70=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS70-WARN-ON.cmake new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 4242723d5..644e5ae99 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -45,6 +45,11 @@ if(RunCMake_GENERATOR STREQUAL "Visual Studio 6") run_cmake(DeprecateVS6-WARN-ON) unset(RunCMake_WARN_VS6) run_cmake(DeprecateVS6-WARN-OFF) +elseif(RunCMake_GENERATOR STREQUAL "Visual Studio 7") + set(RunCMake_WARN_VS70 1) + run_cmake(DeprecateVS70-WARN-ON) + unset(RunCMake_WARN_VS70) + run_cmake(DeprecateVS70-WARN-OFF) endif() if(UNIX) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index e5d3590fd..b24ae0b0e 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -54,6 +54,9 @@ function(run_cmake test) if(RunCMake_GENERATOR STREQUAL "Visual Studio 6" AND NOT RunCMake_WARN_VS6) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS6=OFF) endif() + if(RunCMake_GENERATOR STREQUAL "Visual Studio 7" AND NOT RunCMake_WARN_VS70) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_WARN_VS70=OFF) + endif() if(RunCMake_MAKE_PROGRAM) list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() From 885ab9ab37b1f4c094036814882886f5ec9efaf4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Apr 2015 09:30:14 -0400 Subject: [PATCH 0542/1029] VS: Drop reload macros for VS >= 10 (#11258,#14680) We never implemented them for VS 11 (2012), 12 (2013), or 14 (2015). For VS 10 (2010) the reload macro does not work correctly when run from inside a build launched through the IDE because stopping the build kills the CMake that is driving the reload. Fortunately VS >= 10 know how to reload the whole solution anyway. --- Help/release/dev/vs10-no-macros.rst | 9 ++++++ Source/cmGlobalVisualStudio10Generator.cxx | 33 ---------------------- Source/cmGlobalVisualStudio10Generator.h | 15 ++-------- Source/cmGlobalVisualStudio11Generator.h | 2 -- Source/cmGlobalVisualStudio12Generator.h | 3 -- Source/cmGlobalVisualStudio14Generator.h | 3 -- Source/cmGlobalVisualStudioGenerator.h | 4 +-- 7 files changed, 14 insertions(+), 55 deletions(-) create mode 100644 Help/release/dev/vs10-no-macros.rst diff --git a/Help/release/dev/vs10-no-macros.rst b/Help/release/dev/vs10-no-macros.rst new file mode 100644 index 000000000..89377dcc2 --- /dev/null +++ b/Help/release/dev/vs10-no-macros.rst @@ -0,0 +1,9 @@ +vs10-no-macros +-------------- + +* The :generator:`Visual Studio 10 2010` generator no longer checks + for running VS IDEs with the project open or asks them to reload. + This was originally done for VS 10 because it had been done for + VS 7 through 9 to avoid prompting for every project in a solution. + Since VS >= 10 allow the whole solution to reload at once they + do not need CMake to help them. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 1c6ac8871..231b6796d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -370,39 +370,6 @@ const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const return 0; } -//---------------------------------------------------------------------------- -std::string cmGlobalVisualStudio10Generator::GetUserMacrosDirectory() -{ - std::string base; - std::string path; - - // base begins with the VisualStudioProjectsLocation reg value... - if (cmSystemTools::ReadRegistryValue( - "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0;" - "VisualStudioProjectsLocation", - base)) - { - cmSystemTools::ConvertToUnixSlashes(base); - - // 9.0 macros folder: - path = base + "/VSMacros80"; - // *NOT* a typo; right now in Visual Studio 2008 beta the macros - // folder is VSMacros80... They may change it to 90 before final - // release of 2008 or they may not... we'll have to keep our eyes - // on it - } - - // path is (correctly) still empty if we did not read the base value from - // the Registry value - return path; -} - -//---------------------------------------------------------------------------- -std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase() -{ - return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros"; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 92202ba6d..f0dd7d7d2 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -84,18 +84,6 @@ public: bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; } - /** - * Where does this version of Visual Studio look for macros for the - * current user? Returns the empty string if this version of Visual - * Studio does not implement support for VB macros. - */ - virtual std::string GetUserMacrosDirectory(); - - /** - * What is the reg key path to "vsmacros" for this version of Visual - * Studio? - */ - virtual std::string GetUserMacrosRegKeyBase(); virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)";} bool Find64BitTools(cmMakefile* mf); @@ -156,5 +144,8 @@ private: virtual std::string FindMSBuildCommand(); virtual std::string FindDevEnvCommand(); virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); } + + // We do not use the reload macros for VS >= 10. + virtual std::string GetUserMacrosDirectory() { return ""; } }; #endif diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index c79dc977b..6d434eb75 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -31,8 +31,6 @@ public: ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); - /** TODO: VS 11 user macro support. */ - virtual std::string GetUserMacrosDirectory() { return ""; } protected: virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index a81516fd8..5e5b5f7b7 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -31,9 +31,6 @@ public: ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); - /** TODO: VS 12 user macro support. */ - virtual std::string GetUserMacrosDirectory() { return ""; } - //in Visual Studio 2013 they detached the MSBuild tools version //from the .Net Framework version and instead made it have it's own //version number diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 3fd60a0bb..ad1a460be 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -31,9 +31,6 @@ public: ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); - /** TODO: VS 14 user macro support. */ - virtual std::string GetUserMacrosDirectory() { return ""; } - virtual const char* GetToolsVersion() { return "14.0"; } protected: virtual const char* GetIDEVersion() { return "14.0"; } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 356f4d418..cb54132d9 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -51,8 +51,8 @@ public: * Call the ReloadProjects macro if necessary based on * GetFilesReplacedDuringGenerate results. */ - virtual void CallVisualStudioMacro(MacroName m, - const char* vsSolutionFile = 0); + void CallVisualStudioMacro(MacroName m, + const char* vsSolutionFile = 0); // return true if target is fortran only bool TargetIsFortranOnly(cmTarget const& t); From dd7e31bc15471b5c3ea31fcbe2002650780e78b6 Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Wed, 15 Apr 2015 11:37:48 -0400 Subject: [PATCH 0543/1029] UseSWIG: Fix module name detection with relative source file (#15508) When SWIG_GET_EXTRA_OUTPUT_FILES checks to see if a source file exists for use in reading the module name, it must pass an absolute path to the if(EXISTS) command. Teach SWIG_ADD_SOURCE_TO_MODULE to give it the absolute path it already knows. --- Modules/UseSWIG.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 742341813..186287675 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -156,7 +156,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} swig_extra_generated_files "${swig_outdir}" - "${infile}") + "${swig_source_file_fullname}") set(swig_generated_file_fullname "${swig_outdir}/${swig_source_file_name_we}") # add the language into the name of the file (i.e. TCL_wrap) From 0aec49132885be07e1d92a4a1db58f4c6c4c2844 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 12:52:14 +0200 Subject: [PATCH 0544/1029] Port cmCommand consumers to cmState. --- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 4 ++-- Source/CTest/cmCTestTestHandler.cxx | 8 ++++---- Source/cmCPluginAPI.cxx | 2 +- Source/cmConditionEvaluator.cxx | 4 +++- Source/cmFunctionCommand.cxx | 5 ++--- Source/cmLoadCommandCommand.cxx | 2 +- Source/cmMacroCommand.cxx | 5 ++--- Source/cmMakefile.cxx | 13 +------------ Source/cmMakefile.h | 8 -------- Source/cmake.cxx | 2 +- 11 files changed, 18 insertions(+), 37 deletions(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 00b23cd85..a9cabf18d 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -198,7 +198,7 @@ int main (int argc, char const* const* argv) "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; - cminst.RemoveUnscriptableCommands(); + cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); cmsys::auto_ptr cmlg(cmgg.CreateLocalGenerator()); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 379295379..783941b74 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -214,7 +214,7 @@ void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command) cmCTestCommand* newCom = command; newCom->CTest = this->CTest; newCom->CTestScriptHandler = this; - this->CMake->AddCommand(newCom); + this->CMake->GetState()->AddCommand(newCom); } int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) @@ -353,7 +353,7 @@ void cmCTestScriptHandler::CreateCMake() // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts - this->CMake->RemoveUnscriptableCommands(); + this->CMake->GetState()->RemoveUnscriptableCommands(); // add any ctest specific commands, probably should have common superclass // for ctest commands to clean this up. If a couple more commands are diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 0e84fbf8b..c50ea884e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1585,25 +1585,25 @@ void cmCTestTestHandler::GetListOfTests() // Add handler for ADD_TEST cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand; newCom1->TestHandler = this; - cm.AddCommand(newCom1); + cm.GetState()->AddCommand(newCom1); // Add handler for SUBDIRS cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand; newCom2->TestHandler = this; - cm.AddCommand(newCom2); + cm.GetState()->AddCommand(newCom2); // Add handler for ADD_SUBDIRECTORY cmCTestAddSubdirectoryCommand* newCom3 = new cmCTestAddSubdirectoryCommand; newCom3->TestHandler = this; - cm.AddCommand(newCom3); + cm.GetState()->AddCommand(newCom3); // Add handler for SET_SOURCE_FILES_PROPERTIES cmCTestSetTestsPropertiesCommand* newCom4 = new cmCTestSetTestsPropertiesCommand; newCom4->TestHandler = this; - cm.AddCommand(newCom4); + cm.GetState()->AddCommand(newCom4); const char* testFilename; if( cmSystemTools::FileExists("CTestTestfile.cmake") ) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 6134c6f60..77cd6c687 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -164,7 +164,7 @@ int CCONV cmIsOn(void *arg, const char* name) int CCONV cmCommandExists(void *arg, const char* name) { cmMakefile *mf = static_cast(arg); - return static_cast(mf->CommandExists(name)); + return static_cast(mf->GetState()->GetCommand(name) ? 1 : 0); } void CCONV cmAddDefineFlag(void *arg, const char* definition) diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index eb4f3a131..0a71c60a6 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -481,8 +481,10 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, // does a command exist if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) { + cmCommand* command = + this->Makefile.GetState()->GetCommand(argP1->c_str()); this->HandlePredicate( - this->Makefile.CommandExists(argP1->c_str()), + command ? true : false, reducible, arg, newArgs, argP1, argP2); } // does a policy exist diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 9297688c5..fdd1018e6 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -193,9 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0], - newName); - mf.AddCommand(f); + mf.GetState()->RenameCommand(this->Args[0], newName); + mf.GetState()->AddCommand(f); // remove the function blocker now that the function is defined mf.RemoveFunctionBlocker(this, lff); diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index cdfd00c9f..403f7fcc8 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -273,7 +273,7 @@ bool cmLoadCommandCommand // create a function blocker and set it up cmLoadedCommand *f = new cmLoadedCommand(); (*initFunction)(&f->info); - this->Makefile->AddCommand(f); + this->Makefile->GetState()->AddCommand(f); return true; } this->SetError("Attempt to load command failed. " diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index b7cbae6e3..7ac44320c 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -232,9 +232,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, f->Functions = this->Functions; mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0], - newName); - mf.AddCommand(f); + mf.GetState()->RenameCommand(this->Args[0], newName); + mf.GetState()->AddCommand(f); // remove the function blocker now that the macro is defined mf.RemoveFunctionBlocker(this, lff); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b1e67f4bf..be3bcdcb0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -244,12 +244,6 @@ void cmMakefile::Print() const #endif } -bool cmMakefile::CommandExists(const char* name) const -{ - return this->GetCMakeInstance()->CommandExists(name); -} - - //---------------------------------------------------------------------------- void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const @@ -340,7 +334,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, static_cast(stack_manager); // Lookup the command prototype. - if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name)) + if(cmCommand* proto = this->GetState()->GetCommand(name)) { // Clone the prototype. cmsys::auto_ptr pcmd(proto->Clone()); @@ -718,11 +712,6 @@ void cmMakefile::EnforceDirectoryLevelRules() const } } -void cmMakefile::AddCommand(cmCommand* wg) -{ - this->GetCMakeInstance()->AddCommand(wg); -} - // Set the make file void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 43c1b1a6b..299d550a2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -746,14 +746,6 @@ public: bool ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus &status); - /** Check if a command exists. */ - bool CommandExists(const char* name) const; - - /** - * Add a command to this cmake instance - */ - void AddCommand(cmCommand* ); - ///! Enable support for named language, if nil then all languages are ///enabled. void EnableLanguage(std::vectorconst& languages, bool optional); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 89d5feac8..a0f813ecb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1758,7 +1758,7 @@ void cmake::AddDefaultCommands() for(std::vector::iterator i = commands.begin(); i != commands.end(); ++i) { - this->AddCommand(*i); + this->State->AddCommand(*i); } } From 24b7f31d3a2a464cef5955648e4a152a19d44890 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 13:13:57 +0200 Subject: [PATCH 0545/1029] cmake: Remove unused cmCommand methods. --- Source/cmake.cxx | 26 -------------------------- Source/cmake.h | 16 ---------------- 2 files changed, 42 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a0f813ecb..e28629539 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -199,32 +199,6 @@ void cmake::CleanupCommandsAndMacros() this->State->RemoveUserDefinedCommands(); } -bool cmake::CommandExists(const std::string& name) const -{ - return this->State->GetCommand(name) ? true : false; -} - -cmCommand *cmake::GetCommand(const std::string& name) const -{ - return this->State->GetCommand(name); -} - -void cmake::RenameCommand(const std::string& oldName, - const std::string& newName) -{ - this->State->RenameCommand(oldName, newName); -} - -void cmake::AddCommand(cmCommand* command) -{ - this->State->AddCommand(command); -} - -void cmake::RemoveUnscriptableCommands() -{ - this->State->RemoveUnscriptableCommands(); -} - // Parse the args bool cmake::SetCacheArgs(const std::vector& args) { diff --git a/Source/cmake.h b/Source/cmake.h index e7a8acb81..359e7bf22 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -24,7 +24,6 @@ class cmGlobalGeneratorFactory; class cmGlobalGenerator; class cmLocalGenerator; class cmMakefile; -class cmCommand; class cmVariableWatch; class cmFileTimeComparison; class cmExternalMakefileProjectGenerator; @@ -216,21 +215,6 @@ class cmake */ int GetSystemInformation(std::vector&); - /** - * Add a command to this cmake instance - */ - void AddCommand(cmCommand* ); - void RenameCommand(const std::string& oldName, const std::string& newName); - void RemoveUnscriptableCommands(); - - /** - * Get a command by its name - */ - cmCommand *GetCommand(const std::string& name) const; - - /** Check if a command exists. */ - bool CommandExists(const std::string& name) const; - ///! Parse command line arguments void SetArgs(const std::vector&, bool directoriesSetBefore = false); From 0076b5d8340be81057195e70853d33e8fb66c1db Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 13 Apr 2015 21:20:25 +0200 Subject: [PATCH 0546/1029] cmake: Remove the happy global property scope pattern. Global properties are already global in scope, so remove the overload for specifying it and port users of the API. The call from cmMakefile::GetProperty can be simplified because the scope is only used during chaining, and there is no further chaining after processing global properties. --- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- Source/cmCTest.cxx | 6 +++--- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmLocalNinjaGenerator.cxx | 3 +-- Source/cmMakefile.cxx | 2 +- Source/cmake.cxx | 10 ++-------- Source/cmake.h | 2 -- 7 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index d585863d0..4cdcd45a9 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -1132,7 +1132,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, cmCTestScriptHandler* ch = static_cast(this->CTest->GetHandler("script")); cmake* cm = ch->GetCMake(); - const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL); + const char* subproject = cm->GetProperty("SubProject"); // TODO: Encode values for a URL instead of trusting caller. std::ostringstream str; str << "project=" diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 67156384e..d54a65174 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1558,12 +1558,12 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) return; } // This code should go when cdash is changed to use labels only - const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL); + const char* subproject = cm->GetProperty("SubProject"); if(subproject) { ostr << "\n"; const char* labels = - ch->GetCMake()->GetProperty("SubProjectLabels", cmProperty::GLOBAL); + ch->GetCMake()->GetProperty("SubProjectLabels"); if(labels) { ostr << " \n"; @@ -1581,7 +1581,7 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) } // This code should stay when cdash only does label based sub-projects - const char* label = cm->GetProperty("Label", cmProperty::GLOBAL); + const char* label = cm->GetProperty("Label"); if(label) { ostr << "\n"; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 35b70e8f0..16d511948 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -470,7 +470,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() } if (const char *extraNaturesProp = mf->GetCMakeInstance()-> - GetProperty("ECLIPSE_EXTRA_NATURES", cmProperty::GLOBAL)) + GetProperty("ECLIPSE_EXTRA_NATURES")) { std::vector extraNatures; cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 640c1b367..124e849fe 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -234,8 +234,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); - const char* jobpools = this->GetCMakeInstance() - ->GetProperty("JOB_POOLS", cmProperty::GLOBAL); + const char* jobpools = this->GetCMakeInstance()->GetProperty("JOB_POOLS"); if (jobpools) { cmGlobalNinjaGenerator::WriteComment(os, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index be3bcdcb0..2fe1e332f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4239,7 +4239,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, return this->LocalGenerator->GetParent()->GetMakefile()-> GetProperty(prop, scope); } - return this->GetCMakeInstance()->GetProperty(prop,scope); + return this->GetCMakeInstance()->GetProperty(prop); } return retVal; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e28629539..a83596d27 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1514,7 +1514,7 @@ int cmake::ActualConfigure() cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); if (mf->IsOn("CTEST_USE_LAUNCHERS") - && !this->GetProperty("RULE_LAUNCH_COMPILE", cmProperty::GLOBAL)) + && !this->GetProperty("RULE_LAUNCH_COMPILE")) { cmSystemTools::Error("CTEST_USE_LAUNCHERS is enabled, but the " "RULE_LAUNCH_COMPILE global property is not defined.\n" @@ -2197,12 +2197,6 @@ void cmake::AppendProperty(const std::string& prop, } const char *cmake::GetProperty(const std::string& prop) -{ - return this->GetProperty(prop, cmProperty::GLOBAL); -} - -const char *cmake::GetProperty(const std::string& prop, - cmProperty::ScopeType scope) { // watch for special properties std::string output = ""; @@ -2238,7 +2232,7 @@ const char *cmake::GetProperty(const std::string& prop, } #undef STRING_LIST_ELEMENT bool dummy = false; - return this->Properties.GetPropertyValue(prop, scope, dummy); + return this->Properties.GetPropertyValue(prop, cmProperty::GLOBAL, dummy); } bool cmake::GetPropertyAsBool(const std::string& prop) diff --git a/Source/cmake.h b/Source/cmake.h index 359e7bf22..27f28ac6d 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -253,8 +253,6 @@ class cmake void AppendProperty(const std::string& prop, const char *value,bool asString=false); const char *GetProperty(const std::string& prop); - const char *GetProperty(const std::string& prop, - cmProperty::ScopeType scope); bool GetPropertyAsBool(const std::string& prop); ///! Get or create an cmInstalledFile instance and return a pointer to it From 9b5f80a83c07b4c840b190f4f9057f2cf0fa03d4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 14:17:46 +0200 Subject: [PATCH 0547/1029] Move global properties to cmState. --- Source/cmState.cxx | 59 ++++++++++++++++++++++++++++++++++++++++++++++ Source/cmState.h | 8 +++++++ Source/cmake.cxx | 42 +++------------------------------ Source/cmake.h | 2 -- 4 files changed, 70 insertions(+), 41 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 17b6cf20b..e46846e23 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -191,6 +191,8 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, void cmState::Initialize() { + this->GlobalProperties.clear(); + this->PropertyDefinitions.clear(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -384,3 +386,60 @@ void cmState::RemoveUserDefinedCommands() } } } + +void cmState::SetGlobalProperty(const std::string& prop, const char* value) +{ + this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL); +} + +void cmState::AppendGlobalProperty(const std::string& prop, + const char* value, bool asString) +{ + this->GlobalProperties.AppendProperty(prop, value, + cmProperty::GLOBAL, asString); +} + +const char *cmState::GetGlobalProperty(const std::string& prop) +{ + // watch for special properties + std::string output = ""; + if ( prop == "CACHE_VARIABLES" ) + { + std::vector cacheKeys = this->GetCacheEntryKeys(); + this->SetGlobalProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); + } + else if ( prop == "COMMANDS" ) + { + std::vector commands = this->GetCommandNames(); + this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";").c_str()); + } + else if ( prop == "IN_TRY_COMPILE" ) + { + this->SetGlobalProperty("IN_TRY_COMPILE", + this->IsInTryCompile ? "1" : "0"); + } + else if ( prop == "ENABLED_LANGUAGES" ) + { + std::string langs; + langs = cmJoin(this->EnabledLanguages, ";"); + this->SetGlobalProperty("ENABLED_LANGUAGES", langs.c_str()); + } +#define STRING_LIST_ELEMENT(F) ";" #F + if (prop == "CMAKE_C_KNOWN_FEATURES") + { + return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1; + } + if (prop == "CMAKE_CXX_KNOWN_FEATURES") + { + return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; + } +#undef STRING_LIST_ELEMENT + bool dummy = false; + return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL, + dummy); +} + +bool cmState::GetGlobalPropertyAsBool(const std::string& prop) +{ + return cmSystemTools::IsOn(this->GetGlobalProperty(prop)); +} diff --git a/Source/cmState.h b/Source/cmState.h index a7a17eef3..34b2ccf06 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" #include "cmPropertyDefinitionMap.h" +#include "cmPropertyMap.h" class cmake; class cmCommand; @@ -88,10 +89,17 @@ public: void RemoveUserDefinedCommands(); std::vector GetCommandNames() const; + void SetGlobalProperty(const std::string& prop, const char *value); + void AppendGlobalProperty(const std::string& prop, + const char *value,bool asString=false); + const char *GetGlobalProperty(const std::string& prop); + bool GetGlobalPropertyAsBool(const std::string& prop); + private: std::map PropertyDefinitions; std::vector EnabledLanguages; std::map Commands; + cmPropertyMap GlobalProperties; cmake* CMakeInstance; bool IsInTryCompile; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a83596d27..7d02505c4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -188,8 +188,6 @@ cmake::~cmake() void cmake::InitializeProperties() { - this->Properties.clear(); - this->State->Initialize(); } @@ -2187,52 +2185,18 @@ void cmake::GenerateGraphViz(const char* fileName) const void cmake::SetProperty(const std::string& prop, const char* value) { - this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); + this->State->SetGlobalProperty(prop, value); } void cmake::AppendProperty(const std::string& prop, const char* value, bool asString) { - this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); + this->State->AppendGlobalProperty(prop, value, asString); } const char *cmake::GetProperty(const std::string& prop) { - // watch for special properties - std::string output = ""; - if ( prop == "CACHE_VARIABLES" ) - { - std::vector cacheKeys = this->State->GetCacheEntryKeys(); - this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); - } - else if ( prop == "COMMANDS" ) - { - std::vector commands = this->State->GetCommandNames(); - this->SetProperty("COMMANDS", cmJoin(commands, ";").c_str()); - } - else if ( prop == "IN_TRY_COMPILE" ) - { - this->SetProperty("IN_TRY_COMPILE", - this->State->GetIsInTryCompile() ? "1" : "0"); - } - else if ( prop == "ENABLED_LANGUAGES" ) - { - std::string langs; - langs = cmJoin(this->State->GetEnabledLanguages(), ";"); - this->SetProperty("ENABLED_LANGUAGES", langs.c_str()); - } -#define STRING_LIST_ELEMENT(F) ";" #F - if (prop == "CMAKE_C_KNOWN_FEATURES") - { - return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1; - } - if (prop == "CMAKE_CXX_KNOWN_FEATURES") - { - return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; - } -#undef STRING_LIST_ELEMENT - bool dummy = false; - return this->Properties.GetPropertyValue(prop, cmProperty::GLOBAL, dummy); + return this->State->GetGlobalProperty(prop); } bool cmake::GetPropertyAsBool(const std::string& prop) diff --git a/Source/cmake.h b/Source/cmake.h index 27f28ac6d..352850dfd 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -15,7 +15,6 @@ #include "cmListFileCache.h" #include "cmSystemTools.h" -#include "cmPropertyMap.h" #include "cmInstalledFile.h" #include "cmCacheManager.h" #include "cmState.h" @@ -336,7 +335,6 @@ protected: void RunCheckForUnusedVariables(); void InitializeProperties(); int HandleDeleteCacheVariables(const std::string& var); - cmPropertyMap Properties; typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); From de722d7d63866613aaa8105b52ee90ffe2721136 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 19:47:21 +0200 Subject: [PATCH 0548/1029] Move property initialization to cmState. --- Source/cmState.cxx | 1 + Source/cmake.cxx | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index e46846e23..96f8a51ad 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -22,6 +22,7 @@ cmState::cmState(cmake* cm) : CMakeInstance(cm), IsInTryCompile(false) { + this->Initialize(); } cmState::~cmState() diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7d02505c4..96b6a2284 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -136,8 +136,6 @@ cmake::cmake() this->Policies = new cmPolicies(); this->State = new cmState(this); - this->InitializeProperties(); - #ifdef __APPLE__ struct rlimit rlp; if(!getrlimit(RLIMIT_STACK, &rlp)) @@ -186,14 +184,9 @@ cmake::~cmake() delete this->FileComparison; } -void cmake::InitializeProperties() -{ - this->State->Initialize(); -} - void cmake::CleanupCommandsAndMacros() { - this->InitializeProperties(); + this->State->Initialize(); this->State->RemoveUserDefinedCommands(); } From 5d056c0dd85934e7a985cb49f97c343e38f20929 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 11 Apr 2015 14:15:55 +0200 Subject: [PATCH 0549/1029] Port Global property interaction to cmState. --- Source/CTest/cmCTestSubmitHandler.cxx | 3 ++- Source/cmAddLibraryCommand.cxx | 3 ++- Source/cmCTest.cxx | 9 ++++--- Source/cmComputeLinkInformation.cxx | 21 +++++++++------- Source/cmComputeTargetDepends.cxx | 7 ++++-- Source/cmExtraEclipseCDT4Generator.cxx | 4 +-- Source/cmFindLibraryCommand.cxx | 8 +++--- Source/cmFindPackageCommand.cxx | 35 +++++++++++++------------- Source/cmGetCMakePropertyCommand.cxx | 4 ++- Source/cmGetPropertyCommand.cxx | 3 ++- Source/cmGlobalGenerator.cxx | 15 +++++------ Source/cmLocalNinjaGenerator.cxx | 4 ++- Source/cmMakefile.cxx | 5 ++-- Source/cmMakefileTargetGenerator.cxx | 4 ++- Source/cmQtAutoGenerators.cxx | 9 ++++--- Source/cmake.cxx | 14 ++++++----- 16 files changed, 86 insertions(+), 62 deletions(-) diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 4cdcd45a9..1e12f15c4 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -17,6 +17,7 @@ #include "cmGeneratedFileStream.h" #include "cmCTest.h" #include "cmXMLParser.h" +#include "cmState.h" #include #include @@ -1132,7 +1133,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, cmCTestScriptHandler* ch = static_cast(this->CTest->GetHandler("script")); cmake* cm = ch->GetCMake(); - const char* subproject = cm->GetProperty("SubProject"); + const char* subproject = cm->GetState()->GetGlobalProperty("SubProject"); // TODO: Encode values for a URL instead of trusting caller. std::ostringstream str; str << "project=" diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index edf82bdbc..74e1a93f4 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -12,6 +12,7 @@ #include "cmAddLibraryCommand.h" #include "cmake.h" +#include "cmState.h" // cmLibraryCommand bool cmAddLibraryCommand @@ -330,7 +331,7 @@ bool cmAddLibraryCommand yet its linker language. */ if ((type == cmTarget::SHARED_LIBRARY || type == cmTarget::MODULE_LIBRARY) && - (this->Makefile->GetCMakeInstance()->GetPropertyAsBool( + (this->Makefile->GetState()->GetGlobalPropertyAsBool( "TARGET_SUPPORTS_SHARED_LIBS") == false)) { std::ostringstream w; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d54a65174..cd2cd7cbf 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -27,6 +27,7 @@ #include "cmCTestCommand.h" #include "cmCTestStartCommand.h" #include "cmAlgorithms.h" +#include "cmState.h" #include "cmCTestBuildHandler.h" #include "cmCTestBuildAndTestHandler.h" @@ -1558,12 +1559,14 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) return; } // This code should go when cdash is changed to use labels only - const char* subproject = cm->GetProperty("SubProject"); + const char* subproject = cm->GetState() + ->GetGlobalProperty("SubProject"); if(subproject) { ostr << "\n"; const char* labels = - ch->GetCMake()->GetProperty("SubProjectLabels"); + ch->GetCMake()->GetState() + ->GetGlobalProperty("SubProjectLabels"); if(labels) { ostr << " \n"; @@ -1581,7 +1584,7 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) } // This code should stay when cdash only does label based sub-projects - const char* label = cm->GetProperty("Label"); + const char* label = cm->GetState()->GetGlobalProperty("Label"); if(label) { ostr << "\n"; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 888066732..83d38ef06 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -15,6 +15,7 @@ #include "cmOrderDirectories.h" #include "cmGlobalGenerator.h" +#include "cmState.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmTarget.h" @@ -250,8 +251,8 @@ cmComputeLinkInformation this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // Check whether to recognize OpenBSD-style library versioned names. - this->OpenBSD = this->Makefile->GetCMakeInstance() - ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); + this->OpenBSD = this->Makefile->GetState() + ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); // The configuration being linked. this->Config = config; @@ -796,9 +797,8 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, void cmComputeLinkInformation::ComputeLinkTypeInfo() { // Check whether archives may actually be shared libraries. - this->ArchivesMayBeShared = - this->CMakeInstance->GetPropertyAsBool( - "TARGET_ARCHIVES_MAY_BE_SHARED_LIBS"); + this->ArchivesMayBeShared = this->CMakeInstance->GetState() + ->GetGlobalPropertyAsBool("TARGET_ARCHIVES_MAY_BE_SHARED_LIBS"); // First assume we cannot do link type stuff. this->LinkTypeEnabled = false; @@ -1527,9 +1527,10 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, // Print the warning at most once for this item. std::string wid = "CMP0008-WARNING-GIVEN-"; wid += item; - if(!this->CMakeInstance->GetPropertyAsBool(wid)) + if(!this->CMakeInstance->GetState() + ->GetGlobalPropertyAsBool(wid)) { - this->CMakeInstance->SetProperty(wid, "1"); + this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1"); std::ostringstream w; w << (this->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0008)) << "\n" @@ -1576,9 +1577,11 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() switch(this->Target->GetPolicyStatusCMP0003()) { case cmPolicies::WARN: - if(!this->CMakeInstance->GetPropertyAsBool("CMP0003-WARNING-GIVEN")) + if(!this->CMakeInstance->GetState() + ->GetGlobalPropertyAsBool("CMP0003-WARNING-GIVEN")) { - this->CMakeInstance->SetProperty("CMP0003-WARNING-GIVEN", "1"); + this->CMakeInstance->GetState() + ->SetGlobalProperty("CMP0003-WARNING-GIVEN", "1"); std::ostringstream w; this->PrintLinkPolicyDiagnosis(w); this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index bbffd5da0..11056cd8e 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmSourceFile.h" #include "cmTarget.h" @@ -98,8 +99,10 @@ cmComputeTargetDepends::cmComputeTargetDepends(cmGlobalGenerator* gg) { this->GlobalGenerator = gg; cmake* cm = this->GlobalGenerator->GetCMakeInstance(); - this->DebugMode = cm->GetPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE"); - this->NoCycles = cm->GetPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES"); + this->DebugMode = cm->GetState() + ->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE"); + this->NoCycles = cm->GetState() + ->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES"); } //---------------------------------------------------------------------------- diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 16d511948..2aa4d935c 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -469,8 +469,8 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() fout << "\t\t" << *nit << "\n"; } - if (const char *extraNaturesProp = mf->GetCMakeInstance()-> - GetProperty("ECLIPSE_EXTRA_NATURES")) + if (const char *extraNaturesProp = mf->GetState() + ->GetGlobalProperty("ECLIPSE_EXTRA_NATURES")) { std::vector extraNatures; cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures); diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index ef8340bac..507d011a7 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -54,8 +54,8 @@ bool cmFindLibraryCommand } } - if(this->Makefile->GetCMakeInstance() - ->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS")) + if(this->Makefile->GetState() + ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS")) { // add special 64 bit paths if this is a 64 bit compile. if(this->Makefile->PlatformIs64Bit()) @@ -226,8 +226,8 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf): // Check whether to use OpenBSD-style library version comparisons. this->OpenBSD = - this->Makefile->GetCMakeInstance() - ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); + this->Makefile->GetState() + ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); } //---------------------------------------------------------------------------- diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index b32f5fdcc..e1074b0ef 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -120,8 +120,8 @@ bool cmFindPackageCommand // Lookup whether lib64 paths should be used. if(this->Makefile->PlatformIs64Bit() && - this->Makefile->GetCMakeInstance() - ->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS")) + this->Makefile->GetState() + ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS")) { this->UseLib64Paths = true; } @@ -1015,8 +1015,8 @@ bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) void cmFindPackageCommand::AppendToFoundProperty(bool found) { std::vector foundContents; - const char *foundProp = - this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_FOUND"); + const char *foundProp = this->Makefile->GetState() + ->GetGlobalProperty("PACKAGES_FOUND"); if (foundProp && *foundProp) { std::string tmp = foundProp; @@ -1032,7 +1032,8 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found) std::vector notFoundContents; const char *notFoundProp = - this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_NOT_FOUND"); + this->Makefile->GetState() + ->GetGlobalProperty("PACKAGES_NOT_FOUND"); if (notFoundProp && *notFoundProp) { std::string tmp = notFoundProp; @@ -1057,12 +1058,12 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found) std::string tmp = cmJoin(foundContents, ";"); - this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND", - tmp.c_str()); + this->Makefile->GetState() + ->SetGlobalProperty("PACKAGES_FOUND", tmp.c_str()); tmp = cmJoin(notFoundContents, ";"); - this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND", - tmp.c_str()); + this->Makefile->GetState() + ->SetGlobalProperty("PACKAGES_NOT_FOUND", tmp.c_str()); } //---------------------------------------------------------------------------- @@ -1071,8 +1072,8 @@ void cmFindPackageCommand::AppendSuccessInformation() { std::string transitivePropName = "_CMAKE_"; transitivePropName += this->Name + "_TRANSITIVE_DEPENDENCY"; - this->Makefile->GetCMakeInstance() - ->SetProperty(transitivePropName, "False"); + this->Makefile->GetState() + ->SetGlobalProperty(transitivePropName, "False"); } std::string found = this->Name; found += "_FOUND"; @@ -1090,8 +1091,8 @@ void cmFindPackageCommand::AppendSuccessInformation() std::string quietInfoPropName = "_CMAKE_"; quietInfoPropName += this->Name; quietInfoPropName += "_QUIET"; - this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName, - this->Quiet ? "TRUE" : "FALSE"); + this->Makefile->GetState() + ->SetGlobalProperty(quietInfoPropName, this->Quiet ? "TRUE" : "FALSE"); // set a global property to record the required version of this package std::string versionInfoPropName = "_CMAKE_"; @@ -1104,15 +1105,15 @@ void cmFindPackageCommand::AppendSuccessInformation() versionInfo += " "; versionInfo += this->Version; } - this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName, - versionInfo.c_str()); + this->Makefile->GetState() + ->SetGlobalProperty(versionInfoPropName, versionInfo.c_str()); if (this->Required) { std::string requiredInfoPropName = "_CMAKE_"; requiredInfoPropName += this->Name; requiredInfoPropName += "_TYPE"; - this->Makefile->GetCMakeInstance()->SetProperty( - requiredInfoPropName, "REQUIRED"); + this->Makefile->GetState() + ->SetGlobalProperty(requiredInfoPropName, "REQUIRED"); } diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 85aa31fbf..b0357505b 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmake.h" +#include "cmState.h" #include "cmAlgorithms.h" // cmGetCMakePropertyCommand @@ -53,7 +54,8 @@ bool cmGetCMakePropertyCommand else { const char *prop = - this->Makefile->GetCMakeInstance()->GetProperty(args[1]); + this->Makefile->GetState() + ->GetGlobalProperty(args[1]); if (prop) { output = prop; diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index a8481ad9d..3e1d08eca 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -237,7 +237,8 @@ bool cmGetPropertyCommand::HandleGlobalMode() // Get the property. cmake* cm = this->Makefile->GetCMakeInstance(); - return this->StoreResult(cm->GetProperty(this->PropertyName)); + return this->StoreResult(cm->GetState() + ->GetGlobalProperty(this->PropertyName)); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 56a0a4536..ab044c1f1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -200,7 +200,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, if (cnameString != pathString) { const char* cvars = - this->GetCMakeInstance()->GetProperty( + this->GetCMakeInstance()->GetState()->GetGlobalProperty( "__CMAKE_DELETE_CACHE_CHANGE_VARS_"); if(cvars) { @@ -210,7 +210,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, changeVars += langComp; changeVars += ";"; changeVars += cname; - this->GetCMakeInstance()->SetProperty( + this->GetCMakeInstance()->GetState()->SetGlobalProperty( "__CMAKE_DELETE_CACHE_CHANGE_VARS_", changeVars.c_str()); } @@ -1170,8 +1170,8 @@ void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target) bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { // If the property is not enabled then okay. - if(!this->CMakeInstance - ->GetPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS")) + if(!this->CMakeInstance->GetState() + ->GetGlobalPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS")) { return true; } @@ -2391,8 +2391,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) //---------------------------------------------------------------------------- const char* cmGlobalGenerator::GetPredefinedTargetsFolder() { - const char* prop = - this->GetCMakeInstance()->GetProperty("PREDEFINED_TARGETS_FOLDER"); + const char* prop = this->GetCMakeInstance()->GetState() + ->GetGlobalProperty("PREDEFINED_TARGETS_FOLDER"); if (prop) { @@ -2405,7 +2405,8 @@ const char* cmGlobalGenerator::GetPredefinedTargetsFolder() //---------------------------------------------------------------------------- bool cmGlobalGenerator::UseFolderProperty() { - const char* prop = this->GetCMakeInstance()->GetProperty("USE_FOLDERS"); + const char* prop = this->GetCMakeInstance()->GetState() + ->GetGlobalProperty("USE_FOLDERS"); // If this property is defined, let the setter turn this on or off... // diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 124e849fe..645d32a91 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -18,6 +18,7 @@ #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" #include "cmake.h" +#include "cmState.h" #include @@ -234,7 +235,8 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); - const char* jobpools = this->GetCMakeInstance()->GetProperty("JOB_POOLS"); + const char* jobpools = this->GetCMakeInstance()->GetState() + ->GetGlobalProperty("JOB_POOLS"); if (jobpools) { cmGlobalNinjaGenerator::WriteComment(os, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2fe1e332f..205508bca 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4239,7 +4239,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, return this->LocalGenerator->GetParent()->GetMakefile()-> GetProperty(prop, scope); } - return this->GetCMakeInstance()->GetProperty(prop); + return this->GetState()->GetGlobalProperty(prop); } return retVal; @@ -4585,7 +4585,8 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); if(isCustom && existing->GetType() == cmTarget::UTILITY && this != existing->GetMakefile() && - cm->GetPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS")) + cm->GetState() + ->GetGlobalPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS")) { return true; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index bd9c57951..0076cafd6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmState.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorExpression.h" @@ -51,7 +52,8 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target); cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; - if(const char* ruleStatus = cm->GetProperty("RULE_MESSAGES")) + if(const char* ruleStatus = cm->GetState() + ->GetGlobalProperty("RULE_MESSAGES")) { this->NoRuleMessages = cmSystemTools::IsOff(ruleStatus); } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 4cb49c8a9..4d0b3f4ad 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" +#include "cmState.h" #include "cmAlgorithms.h" #if defined(_WIN32) && !defined(__CYGWIN__) @@ -472,12 +473,12 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) } // Set target folder - const char* autogenFolder = makefile->GetCMakeInstance()->GetProperty( - "AUTOMOC_TARGETS_FOLDER"); + const char* autogenFolder = makefile->GetState() + ->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER"); if (!autogenFolder) { - autogenFolder = makefile->GetCMakeInstance()->GetProperty( - "AUTOGEN_TARGETS_FOLDER"); + autogenFolder = makefile->GetState() + ->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER"); } if (autogenFolder && *autogenFolder) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 96b6a2284..a542a24b4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1152,7 +1152,8 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) std::vector argsSplit; cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true); // erase the property to avoid infinite recursion - this->SetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", ""); + this->State + ->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", ""); if(this->State->GetIsInTryCompile()) { return 0; @@ -1229,8 +1230,8 @@ int cmake::Configure() } } int ret = this->ActualConfigure(); - const char* delCacheVars = - this->GetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_"); + const char* delCacheVars = this->State + ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_"); if(delCacheVars && delCacheVars[0] != 0) { return this->HandleDeleteCacheVariables(delCacheVars); @@ -1505,7 +1506,7 @@ int cmake::ActualConfigure() cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); if (mf->IsOn("CTEST_USE_LAUNCHERS") - && !this->GetProperty("RULE_LAUNCH_COMPILE")) + && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) { cmSystemTools::Error("CTEST_USE_LAUNCHERS is enabled, but the " "RULE_LAUNCH_COMPILE global property is not defined.\n" @@ -2194,7 +2195,7 @@ const char *cmake::GetProperty(const std::string& prop) bool cmake::GetPropertyAsBool(const std::string& prop) { - return cmSystemTools::IsOn(this->GetProperty(prop)); + return this->State->GetGlobalPropertyAsBool(prop); } cmInstalledFile *cmake::GetOrCreateInstalledFile( @@ -2590,7 +2591,8 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, std::vector cmake::GetDebugConfigs() { std::vector configs; - if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) + if(const char* config_list = + this->State->GetGlobalProperty("DEBUG_CONFIGURATIONS")) { // Expand the specified list and convert to upper-case. cmSystemTools::ExpandListArgument(config_list, configs); From 532644ea14135753d1b52b8883c7c6cd380b4dfa Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 16 Apr 2015 00:01:04 -0400 Subject: [PATCH 0550/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 649f23050..056368b2b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150415) +set(CMake_VERSION_PATCH 20150416) #set(CMake_VERSION_RC 1) From 4556640855515b287dd8a5a0f7fb1a85218267a8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Apr 2015 13:57:17 -0400 Subject: [PATCH 0551/1029] Tests/QtAutogen: Require CMake 3.1 to set policies everywhere We want CMP0020 set in the autorcc_depends test. Also the test should now only run when we can support per-config source files. --- Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/autorcc_depends/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 0dc98e3ab..87ade2c64 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.1) project(QtAutogen) diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt index afd95bcad..0ba86cff2 100644 --- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.1) project(autorcc_depends) set(CMAKE_AUTORCC ON) From 26b5cc5e79320dd73e93e117fffd0d4554e89dbc Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Apr 2015 13:30:32 -0400 Subject: [PATCH 0552/1029] Tests/QtAutogen: Enable per-config source tests when possible Pass CMAKE_BUILD_TYPE into the test on generators that use it so that the per-config part of the test can activate as needed. Do not make the per-config part conditional on the Debug configuration because the generator expressions evaluate to empty in other configurations. Skip the per-config source case with the Ninja generator because it does not currently work. cmQtAutoGenerators::InitializeAutogenTarget needs to know the list of source files on a target, but generator expressions in the list cannot be evaluated until after CreateGeneratorTargets has been called. That cannot happen until after Autogen targets have been generated. It is a chicken-and-egg problem. --- Tests/CMakeLists.txt | 9 +++++++-- Tests/QtAutogen/CMakeLists.txt | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 41032f8f6..1655f12ab 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1173,10 +1173,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(run_autogen_test QtAutogen) set(run_autouic_test QtAutoUicInterface) endif() + if(NOT CMAKE_CONFIGURATION_TYPES) + set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$) + endif() find_package(Qt5Widgets QUIET NO_MODULE) if(Qt5Widgets_FOUND) - add_test(Qt5Autogen ${CMAKE_CTEST_COMMAND} + add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" "${CMake_BINARY_DIR}/Tests/Qt5Autogen" @@ -1186,6 +1189,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --force-new-ctest-process --build-options ${build_options} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 + ${QtAutogen_BUILD_OPTIONS} --test-command ${run_autogen_test} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") @@ -1205,7 +1209,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface") endif() if(QT4_WORKS AND QT_QTGUI_FOUND) - add_test(Qt4Autogen ${CMAKE_CTEST_COMMAND} + add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" "${CMake_BINARY_DIR}/Tests/Qt4Autogen" @@ -1215,6 +1219,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --force-new-ctest-process --build-options ${build_options} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4 + ${QtAutogen_BUILD_OPTIONS} --test-command ${run_autogen_test} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 87ade2c64..7b46619ba 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -67,10 +67,9 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" ) -message("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") -if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" AND NOT CMAKE_CONFIGURATION_TYPES) +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) set(debug_srcs "$<$:debug_class.cpp>" $<$:debug_resource.qrc>) - add_definitions(-DTEST_DEBUG_CLASS) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:TEST_DEBUG_CLASS>) endif() # The -no-protection option disables the generation of include guards. Verify From 3f7c7c65968b6d04babd261dab952ee40e0c9ca9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Apr 2015 13:54:54 -0400 Subject: [PATCH 0553/1029] Tests/QtAutogen: Help Qt5Autogen test find Qt5 on Windows Set CMAKE_PREFIX_PATH to tell find_package(Qt5) where to look. --- Tests/QtAutogen/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 7b46619ba..81a70f461 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.1) project(QtAutogen) +# Tell find_package(Qt5) where to find Qt. +if(QT_QMAKE_EXECUTABLE) + get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) + get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) + set(CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) +endif() + if (QT_TEST_VERSION STREQUAL 4) find_package(Qt4 REQUIRED) @@ -124,6 +131,7 @@ try_compile(RCC_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends" autorcc_depends CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" OUTPUT_VARIABLE output ) if (NOT RCC_DEPENDS) From 15f1a6b49958cc7757f951839b02a00e8c820154 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Apr 2015 13:56:23 -0400 Subject: [PATCH 0554/1029] Tests/QtAutogen: Avoid touching files in the source tree --- Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/autorcc_depends/CMakeLists.txt | 5 ++++- Tests/QtAutogen/autorcc_depends/{res1.qrc => res1.qrc.in} | 0 .../autorcc_depends/{res1_input.txt => res1_input.txt.in} | 0 4 files changed, 5 insertions(+), 2 deletions(-) rename Tests/QtAutogen/autorcc_depends/{res1.qrc => res1.qrc.in} (100%) rename Tests/QtAutogen/autorcc_depends/{res1_input.txt => res1_input.txt.in} (100%) diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 81a70f461..67e0f7e81 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -147,7 +147,7 @@ set(timeformat "%Y%j%H%M%S") file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}") execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends/res1_input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1_input.txt") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt index 0ba86cff2..9faf80383 100644 --- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -15,9 +15,12 @@ else() set(QT_CORE_TARGET Qt5::Core) endif() +configure_file(res1.qrc.in res1.qrc @ONLY) +configure_file(res1_input.txt.in res1_input.txt @ONLY) + add_executable(test_res1 test_res1.cpp - res1.qrc + ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc ) target_link_libraries(test_res1 ${QT_CORE_TARGET}) add_custom_command(TARGET test_res1 POST_BUILD COMMAND diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc b/Tests/QtAutogen/autorcc_depends/res1.qrc.in similarity index 100% rename from Tests/QtAutogen/autorcc_depends/res1.qrc rename to Tests/QtAutogen/autorcc_depends/res1.qrc.in diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt b/Tests/QtAutogen/autorcc_depends/res1_input.txt.in similarity index 100% rename from Tests/QtAutogen/autorcc_depends/res1_input.txt rename to Tests/QtAutogen/autorcc_depends/res1_input.txt.in From e8fdd5f12a379ce91adcb88acdb4354bc271c911 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Apr 2015 12:51:05 -0400 Subject: [PATCH 0555/1029] QtAutogen: Workaround rcc CRCRLF newlines on Windows (#15459) The 'rcc --list' operation may print newlines of the form CRCRLF, so strip any trailing CR characters found on each line. Update the Tests/QtAutogen test to use a resource named in a subdirectory. This causes 'rcc --list' to display a blank line and tests that it is correctly filtered out. --- Source/cmQtAutoGenerators.cxx | 7 +++++++ Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/autorcc_depends/CMakeLists.txt | 2 +- Tests/QtAutogen/autorcc_depends/res1.qrc.in | 2 +- .../{res1_input.txt.in => res1/input.txt.in} | 0 5 files changed, 10 insertions(+), 3 deletions(-) rename Tests/QtAutogen/autorcc_depends/{res1_input.txt.in => res1/input.txt.in} (100%) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 4cb49c8a9..a5238f57f 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -201,6 +201,13 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf, std::string oline; while(std::getline(ostr, oline)) { + // Strip CR characters rcc may have printed (possibly more than one!). + std::string::size_type cr = oline.find('\r'); + if (cr != oline.npos) + { + oline = oline.substr(0, cr); + } + if (oline.empty()) { // The output of rcc --list contains many empty lines. diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 67e0f7e81..f76d11e0a 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -147,7 +147,7 @@ set(timeformat "%Y%j%H%M%S") file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}") execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1_input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1/input.txt") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt index 9faf80383..fbe71addd 100644 --- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -16,7 +16,7 @@ else() endif() configure_file(res1.qrc.in res1.qrc @ONLY) -configure_file(res1_input.txt.in res1_input.txt @ONLY) +configure_file(res1/input.txt.in res1/input.txt @ONLY) add_executable(test_res1 test_res1.cpp diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc.in b/Tests/QtAutogen/autorcc_depends/res1.qrc.in index cfea618ad..2a5417bbb 100644 --- a/Tests/QtAutogen/autorcc_depends/res1.qrc.in +++ b/Tests/QtAutogen/autorcc_depends/res1.qrc.in @@ -1,5 +1,5 @@ - res1_input.txt + res1/input.txt diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt.in b/Tests/QtAutogen/autorcc_depends/res1/input.txt.in similarity index 100% rename from Tests/QtAutogen/autorcc_depends/res1_input.txt.in rename to Tests/QtAutogen/autorcc_depends/res1/input.txt.in From ed0b06308523e56f6df5de9abdb5211e908ce772 Mon Sep 17 00:00:00 2001 From: Raffi Enficiaud Date: Thu, 16 Apr 2015 22:14:51 +0200 Subject: [PATCH 0556/1029] CPack: Fix single component packaging Refine logic added in commit 0ffd3534 (CPack single component packaging, 2015-04-02). Component packaging should be enabled if either at least one component or one group is set and should not require both. --- Source/CPack/cmCPackGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 995eb0d97..4f370419c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1501,8 +1501,8 @@ bool cmCPackGenerator::WantsComponentInstallation() const { return (!IsOn("CPACK_MONOLITHIC_INSTALL") && SupportsComponentInstallation() - // check that package at least has components - && !(this->ComponentGroups.empty() || this->Components.empty())); + // check that we have at least one group or component + && (!this->ComponentGroups.empty() || !this->Components.empty())); } //---------------------------------------------------------------------- From a4d201a747c6d56205aa180b19aab64f5880322c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 17 Apr 2015 00:01:05 -0400 Subject: [PATCH 0557/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 056368b2b..85c699204 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150416) +set(CMake_VERSION_PATCH 20150417) #set(CMake_VERSION_RC 1) From d1a6d15bcd4df3d3e347411bd457be32275fb594 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 23 Feb 2015 22:23:11 +0100 Subject: [PATCH 0558/1029] FPHSA: Always populate the ExactCase_FOUND variable (#15412). The UPPERCASE name was inconsistent with config-packages, the find_dependency macro, and even FPHSA itself, which expects components to be specified with names matching ExactCase. The FOUND_VAR was only permitted to have two possible values, and now both are set for compatibility. Document it as obsolete, and adjust the code for the same. Users of the variable should just remove it. --- Help/release/dev/FPHSA-ExactCase-name.rst | 10 ++++ Modules/FindPackageHandleStandardArgs.cmake | 59 +++++++++---------- Tests/FindPackageTest/CMakeLists.txt | 10 +++- Tests/FindPackageTest/FindSomePackage.cmake | 3 +- .../FindUpperCasePackage.cmake | 3 +- 5 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 Help/release/dev/FPHSA-ExactCase-name.rst diff --git a/Help/release/dev/FPHSA-ExactCase-name.rst b/Help/release/dev/FPHSA-ExactCase-name.rst new file mode 100644 index 000000000..675547cff --- /dev/null +++ b/Help/release/dev/FPHSA-ExactCase-name.rst @@ -0,0 +1,10 @@ +FPHSA-ExactCase-name +-------------------- + +* The :module:`FindPackageHandleStandardArgs` module + ``FIND_PACKAGE_HANDLE_STANDARD_ARGS`` function now + always populates the both ``_FOUND`` + and ``_FOUND`` variables (the latter + for backwards compatibility). The ``FOUND_VAR`` + option is now ignored except to enforce its allowed + values. diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index bcbd17d8a..bf5e92185 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -8,9 +8,9 @@ # # This function is intended to be used in FindXXX.cmake modules files. # It handles the REQUIRED, QUIET and version-related arguments to -# find_package(). It also sets the _FOUND variable. The -# package is considered found if all variables ... listed contain -# valid results, e.g. valid filepaths. +# find_package(PackageName). It also sets the _FOUND +# variable. The package is considered found if all variables ... +# listed contain valid results, e.g. valid filepaths. # # There are two modes of this function. The first argument in both # modes is the name of the Find-module where it is called (in original @@ -24,7 +24,7 @@ # (DEFAULT_MSG|"Custom failure message") ... ) # # If the variables to are all valid, then -# _FOUND will be set to TRUE. If DEFAULT_MSG is given +# _FOUND will be set to TRUE. If DEFAULT_MSG is given # as second argument, then the function will generate itself useful # success and error messages. You can also supply a custom error # message for the failure case. This is not recommended. @@ -41,16 +41,12 @@ # [CONFIG_MODE] # [FAIL_MESSAGE "Custom failure message"] ) # -# In this mode, the name of the result-variable can be set either to -# either _FOUND or _FOUND using the -# FOUND_VAR option. Other names for the result-variable are not -# allowed. So for a Find-module named FindFooBar.cmake, the two -# possible names are FooBar_FOUND and FOOBAR_FOUND. It is recommended -# to use the original case version. If the FOUND_VAR option is not -# used, the default is _FOUND. +# The FOUND_VAR option is obsolete. ``FIND_PACKAGE_HANDLE_STANDARD_ARGS`` +# always populates ``_FOUND``. For backward compatibility, +# it also always populates ``_FOUND``. # # As in the simple mode, if through are all valid, -# _FOUND will be set to TRUE. After REQUIRED_VARS the +# _FOUND will be set to TRUE. After REQUIRED_VARS the # variables which are required for this package are listed. Following # VERSION_VAR the name of the variable can be specified which holds the # version of the package which has been found. If this is done, this @@ -61,7 +57,7 @@ # version is ok or not. If the package supports components, use the # HANDLE_COMPONENTS option to enable handling them. In this case, # find_package_handle_standard_args() will report which components have -# been found and which are missing, and the _FOUND variable +# been found and which are missing, and the _FOUND variable # will be set to FALSE if any of the required components (i.e. not the # ones listed after OPTIONAL_COMPONENTS) are missing. Use the option # CONFIG_MODE if your FindXXX.cmake module is a wrapper for a @@ -81,7 +77,7 @@ # # # LibXml2 is considered to be found, if both LIBXML2_LIBRARY and -# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to +# LIBXML2_INCLUDE_DIR are valid. Then also LibXml2_FOUND is set to # TRUE. If it is not found and REQUIRED was used, it fails with # FATAL_ERROR, independent whether QUIET was used or not. If it is # found, success will be reported, including the content of . On @@ -92,16 +88,14 @@ # :: # # find_package_handle_standard_args(LibXslt -# FOUND_VAR LibXslt_FOUND # REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS # VERSION_VAR LibXslt_VERSION_STRING) # # In this case, LibXslt is considered to be found if the variable(s) # listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and -# LibXslt_INCLUDE_DIRS in this case. The result will then be stored in -# LibXslt_FOUND . Also the version of LibXslt will be checked by using -# the version contained in LibXslt_VERSION_STRING. Since no -# FAIL_MESSAGE is given, the default messages will be printed. +# LibXslt_INCLUDE_DIRS in this case. Also the version of LibXslt will be +# checked by using the version contained in LibXslt_VERSION_STRING. Since +# no FAIL_MESSAGE is given, the default messages will be printed. # # Another example for mode 2: # @@ -111,9 +105,8 @@ # find_package_handle_standard_args(Automoc4 CONFIG_MODE) # # In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 -# NO_MODULE) and adds an additional search directory for automoc4. Here -# the result will be stored in AUTOMOC4_FOUND. The following -# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# NO_MODULE) and adds an additional search directory for automoc4. The +# following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper # success/error message. #============================================================================= @@ -239,17 +232,21 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) set(MISSING_VARS "") set(DETAILS "") # check if all passed variables are valid - unset(${_FOUND_VAR}) + set(FPHSA_FOUND_${_NAME} TRUE) foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) if(NOT ${_CURRENT_VAR}) - set(${_FOUND_VAR} FALSE) + set(FPHSA_FOUND_${_NAME} FALSE) set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") else() set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") endif() endforeach() - if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE") - set(${_FOUND_VAR} TRUE) + if(FPHSA_FOUND_${_NAME}) + set(${_NAME}_FOUND TRUE) + set(${_NAME_UPPER}_FOUND TRUE) + else() + set(${_NAME}_FOUND FALSE) + set(${_NAME_UPPER}_FOUND FALSE) endif() # component handling @@ -273,7 +270,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_FOUND_VAR} FALSE) + set(${_NAME}_FOUND FALSE) set(MISSING_VARS "${MISSING_VARS} ${comp}") endif() @@ -356,12 +353,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) if(VERSION_OK) set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") else() - set(${_FOUND_VAR} FALSE) + set(${_NAME}_FOUND FALSE) endif() # print the result: - if (${_FOUND_VAR}) + if (${_NAME}_FOUND) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") else () @@ -377,6 +374,6 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) endif () - set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE) - + set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) + set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) endfunction() diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index f311fb9dd..8fafa3b70 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -45,12 +45,18 @@ endif() find_package(SomePackage) if(NOT SomePackage_FOUND) - message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !") + message(SEND_ERROR "SomePackage not found !") +endif() +if(NOT SOMEPACKAGE_FOUND) + message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!") endif() find_package(UpperCasePackage) +if(NOT UpperCasePackage_FOUND) + message(SEND_ERROR "UpperCasePackage not found!") +endif() if(NOT UPPERCASEPACKAGE_FOUND) - message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !") + message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!") endif() #----------------------------------------------------------------------------- diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake index 7283d247e..746c08776 100644 --- a/Tests/FindPackageTest/FindSomePackage.cmake +++ b/Tests/FindPackageTest/FindSomePackage.cmake @@ -2,5 +2,4 @@ set(SOP_FOO TRUE) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO - FOUND_VAR SomePackage_FOUND ) +find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO) diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake index 425d41769..5e349da5d 100644 --- a/Tests/FindPackageTest/FindUpperCasePackage.cmake +++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake @@ -2,5 +2,4 @@ set(UCP_FOO TRUE) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO - FOUND_VAR UPPERCASEPACKAGE_FOUND ) +find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO) From a3ad275ce08784493267604d57207fce14602c48 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Apr 2015 11:30:28 -0400 Subject: [PATCH 0559/1029] FPHSA: Revise and format documentation Use better reStructuredText markup and add cross-references. --- Modules/FindPackageHandleStandardArgs.cmake | 233 +++++++++++--------- 1 file changed, 123 insertions(+), 110 deletions(-) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index bf5e92185..a88eaecd2 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -1,113 +1,126 @@ -#.rst: -# FindPackageHandleStandardArgs -# ----------------------------- -# -# -# -# FIND_PACKAGE_HANDLE_STANDARD_ARGS( ... ) -# -# This function is intended to be used in FindXXX.cmake modules files. -# It handles the REQUIRED, QUIET and version-related arguments to -# find_package(PackageName). It also sets the _FOUND -# variable. The package is considered found if all variables ... -# listed contain valid results, e.g. valid filepaths. -# -# There are two modes of this function. The first argument in both -# modes is the name of the Find-module where it is called (in original -# casing). -# -# The first simple mode looks like this: -# -# :: -# -# FIND_PACKAGE_HANDLE_STANDARD_ARGS( -# (DEFAULT_MSG|"Custom failure message") ... ) -# -# If the variables to are all valid, then -# _FOUND will be set to TRUE. If DEFAULT_MSG is given -# as second argument, then the function will generate itself useful -# success and error messages. You can also supply a custom error -# message for the failure case. This is not recommended. -# -# The second mode is more powerful and also supports version checking: -# -# :: -# -# FIND_PACKAGE_HANDLE_STANDARD_ARGS( -# [FOUND_VAR ] -# [REQUIRED_VARS ...] -# [VERSION_VAR ] -# [HANDLE_COMPONENTS] -# [CONFIG_MODE] -# [FAIL_MESSAGE "Custom failure message"] ) -# -# The FOUND_VAR option is obsolete. ``FIND_PACKAGE_HANDLE_STANDARD_ARGS`` -# always populates ``_FOUND``. For backward compatibility, -# it also always populates ``_FOUND``. -# -# As in the simple mode, if through are all valid, -# _FOUND will be set to TRUE. After REQUIRED_VARS the -# variables which are required for this package are listed. Following -# VERSION_VAR the name of the variable can be specified which holds the -# version of the package which has been found. If this is done, this -# version will be checked against the (potentially) specified required -# version used in the find_package() call. The EXACT keyword is also -# handled. The default messages include information about the required -# version and the version which has been actually found, both if the -# version is ok or not. If the package supports components, use the -# HANDLE_COMPONENTS option to enable handling them. In this case, -# find_package_handle_standard_args() will report which components have -# been found and which are missing, and the _FOUND variable -# will be set to FALSE if any of the required components (i.e. not the -# ones listed after OPTIONAL_COMPONENTS) are missing. Use the option -# CONFIG_MODE if your FindXXX.cmake module is a wrapper for a -# find_package(... NO_MODULE) call. In this case VERSION_VAR will be -# set to _VERSION and the macro will automatically check whether -# the Config module was found. Via FAIL_MESSAGE a custom failure -# message can be specified, if this is not used, the default message -# will be displayed. -# -# Example for mode 1: -# -# :: -# -# find_package_handle_standard_args(LibXml2 DEFAULT_MSG -# LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) -# -# -# -# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and -# LIBXML2_INCLUDE_DIR are valid. Then also LibXml2_FOUND is set to -# TRUE. If it is not found and REQUIRED was used, it fails with -# FATAL_ERROR, independent whether QUIET was used or not. If it is -# found, success will be reported, including the content of . On -# repeated Cmake runs, the same message won't be printed again. -# -# Example for mode 2: -# -# :: -# -# find_package_handle_standard_args(LibXslt -# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS -# VERSION_VAR LibXslt_VERSION_STRING) -# -# In this case, LibXslt is considered to be found if the variable(s) -# listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and -# LibXslt_INCLUDE_DIRS in this case. Also the version of LibXslt will be -# checked by using the version contained in LibXslt_VERSION_STRING. Since -# no FAIL_MESSAGE is given, the default messages will be printed. -# -# Another example for mode 2: -# -# :: -# -# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) -# find_package_handle_standard_args(Automoc4 CONFIG_MODE) -# -# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 -# NO_MODULE) and adds an additional search directory for automoc4. The -# following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper -# success/error message. +#[=======================================================================[.rst: +FindPackageHandleStandardArgs +----------------------------- + +This module provides a function intended to be used in :ref:`Find Modules` +implementing :command:`find_package()` calls. It handles the +``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. +It also sets the ``_FOUND`` variable. The package is +considered found if all variables listed contain valid results, e.g. +valid filepaths. + +.. command:: find_package_handle_standard_args + + There are two signatures:: + + find_package_handle_standard_args( + (DEFAULT_MSG|) + ... + ) + + find_package_handle_standard_args( + [FOUND_VAR ] + [REQUIRED_VARS ...] + [VERSION_VAR ] + [HANDLE_COMPONENTS] + [CONFIG_MODE] + [FAIL_MESSAGE ] + ) + + The ``_FOUND`` variable will be set to ``TRUE`` if all + the variables ``...`` are valid and any optional + constraints are satisfied, and ``FALSE`` otherwise. A success or + failure message may be displayed based on the results and on + whether the ``REQUIRED`` and/or ``QUIET`` option was given to + the :command:`find_package` call. + + The options are: + + ``(DEFAULT_MSG|)`` + In the simple signature this specifies the failure message. + Use ``DEFAULT_MSG`` to ask for a default message to be computed + (recommended). Not valid in the full signature. + + ``FOUND_VAR `` + Obselete. Specifies either ``_FOUND`` or + ``_FOUND`` as the result variable. This exists only + for compatibility with older versions of CMake and is now ignored. + Result variables of both names are always set for compatibility. + + ``REQUIRED_VARS ...`` + Specify the variables which are required for this package. + + ``VERSION_VAR `` + Specify the name of a variable that holds the version of the package + that has been found. This version will be checked against the + (potentially) specified required version given to the + :command:`find_package` call, including its ``EXACT`` option. + The default messages include information about the required + version and the version which has been actually found, both + if the version is ok or not. + + ``HANDLE_COMPONENTS`` + Enable handling of package components. In this case, the command + will report which components have been found and which are missing, + and the ``_FOUND`` variable will be set to ``FALSE`` + if any of the required components (i.e. not the ones listed after + the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are + missing. + + ``CONFIG_MODE`` + Specify that the calling find module is a wrapper around a + call to ``find_package( NO_MODULE)``. This implies + a ``VERSION_VAR`` value of ``_VERSION``. The command + will automatically check whether the package configuration file + was found. + + ``FAIL_MESSAGE `` + Specify a custom failure message instead of using the default + generated message. Not recommended. + +Example for the simple signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibXml2 DEFAULT_MSG + LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) + +The ``LibXml2`` package is considered to be found if both +``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. +Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found +and ``REQUIRED`` was used, it fails with a +:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was +used or not. If it is found, success will be reported, including +the content of the first ````. On repeated CMake runs, +the same message will not be printed again. + +Example for the full signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibArchive + REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR + VERSION_VAR LibArchive_VERSION) + +In this case, the ``LibArchive`` package is considered to be found if +both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. +Also the version of ``LibArchive`` will be checked by using the version +contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, +the default messages will be printed. + +Another example for the full signature: + +.. code-block:: cmake + + find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) + find_package_handle_standard_args(Automoc4 CONFIG_MODE) + +In this case, a ``FindAutmoc4.cmake`` module wraps a call to +``find_package(Automoc4 NO_MODULE)`` and adds an additional search +directory for ``automoc4``. Then the call to +``find_package_handle_standard_args`` produces a proper success/failure +message. +#]=======================================================================] #============================================================================= # Copyright 2007-2009 Kitware, Inc. From 84f06d0c84a7db85561cca044780d3ca92c9c3a3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Apr 2015 11:32:26 -0400 Subject: [PATCH 0560/1029] FPHSA: Document REQUIRED_VARS recommendation (#15352) State explicitly that the variables specified are user-facing. --- Modules/FindPackageHandleStandardArgs.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index a88eaecd2..1be38af2b 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -49,6 +49,10 @@ valid filepaths. ``REQUIRED_VARS ...`` Specify the variables which are required for this package. + These may be named in the generated failure message asking the + user to set the missing variable values. Therefore these should + typically be cache entries such as ``FOO_LIBRARY`` and not output + variables like ``FOO_LIBRARIES``. ``VERSION_VAR `` Specify the name of a variable that holds the version of the package From 164f1df26d1c3b66678a8e585e1ebc1783f9a6fb Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Apr 2015 11:00:56 -0400 Subject: [PATCH 0561/1029] Help: Clarify PDB_NAME fallback behavior (#15518) It uses the OUTPUT_NAME if set, not always the target name. --- Help/prop_tgt/PDB_NAME.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Help/prop_tgt/PDB_NAME.rst b/Help/prop_tgt/PDB_NAME.rst index 479dec3f9..3a6579669 100644 --- a/Help/prop_tgt/PDB_NAME.rst +++ b/Help/prop_tgt/PDB_NAME.rst @@ -5,7 +5,8 @@ Output name for the MS debug symbol ``.pdb`` file generated by the linker for an executable or shared library target. This property specifies the base name for the debug symbols file. -If not set, the logical target name is used by default. +If not set, the :prop_tgt:`OUTPUT_NAME` target property value or +logical target name is used by default. .. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME` .. include:: PDB_NOTE.txt From 7b68c8df6b78951e6d04eea62c3d5cc056796993 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 7 Apr 2015 19:14:52 +0200 Subject: [PATCH 0562/1029] Xcode: Sort Xcode objects by Id this patch series aims to minimize deltas between the CMake Xcode generator and Xcode itself. It was started by the observation that if one makes any change to the project within Xcode (e.g. to see how a variable is called internally) the user cannot diff the CMake project and the one stored by Xcode afterwards. Xcode keeps the objects ordered by the object id. Because cmake stores them into an unordered container at creation time they must be sorted before writing the pbxproj file. I tested this series with Xcode 6.3 and Xcode 3.2. Both show a reduced diff after this series was applied. --- Source/cmGlobalXCodeGenerator.cxx | 16 ++++++++++++++++ Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 17 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0561a0542..be40c66df 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -591,6 +591,20 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( mf->GetHomeOutputDirectory()) << "\n"; } +//---------------------------------------------------------------------------- + +static bool objectIdLessThan(cmXCodeObject* l, cmXCodeObject* r) +{ + return l->GetId() < r->GetId(); +} + +//---------------------------------------------------------------------------- +void cmGlobalXCodeGenerator::SortXCodeObjects() +{ + std::sort(this->XCodeObjects.begin(), this->XCodeObjects.end(), + objectIdLessThan); +} + //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::ClearXCodeObjects() { @@ -3713,6 +3727,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* , std::vector& ) { + SortXCodeObjects(); + fout << "// !$*UTF8*$!\n"; fout << "{\n"; cmXCodeObject::Indent(1, fout); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index b272f6a94..1a69fce82 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -150,6 +150,7 @@ private: cmXCodeObject* buildSettings, const std::string& buildType); std::string ExtractFlag(const char* flag, std::string& flags); + void SortXCodeObjects(); // delete all objects in the this->XCodeObjects vector. void ClearXCodeObjects(); bool CreateXCodeObjects(cmLocalGenerator* root, From 2e0e205e28922c6584a35ce6ec9966485df47b0d Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 7 Apr 2015 19:13:57 +0200 Subject: [PATCH 0563/1029] Xcode: Indent using tabs --- Source/cmXCodeObject.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 5a90fd96f..33ce8cc2e 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -81,7 +81,7 @@ void cmXCodeObject::Indent(int level, std::ostream& out) { while(level) { - out << " "; + out << "\t"; level--; } } From 2fe8bca58089fb03f0ffa16792cc15fb741bd22c Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 7 Apr 2015 19:19:00 +0200 Subject: [PATCH 0564/1029] Xcode: Add comment after root object --- Source/cmGlobalXCodeGenerator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index be40c66df..2e13692fe 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3756,7 +3756,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCodeObject::PrintList(this->XCodeObjects, fout); } cmXCodeObject::Indent(1, fout); - fout << "rootObject = " << this->RootObject->GetId() << ";\n"; + fout << "rootObject = " << this->RootObject->GetId() + << " /* Project object */;\n"; fout << "}\n"; } From a723427b6450c1ec77226fb58aa3070a341891a2 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 7 Apr 2015 19:20:54 +0200 Subject: [PATCH 0565/1029] Xcode: Remove extra space in PBXProject comment --- Source/cmGlobalXCodeGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2e13692fe..4d9835952 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3386,7 +3386,7 @@ bool cmGlobalXCodeGenerator } configlist->AddAttribute("buildConfigurations", buildConfigurations); - std::string comment = "Build configuration list for PBXProject "; + std::string comment = "Build configuration list for PBXProject"; comment += " \""; comment += this->CurrentProject; comment += "\""; From 5cb4c8380d9a0f5922a2eed60f6a1fd1274e9141 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 7 Apr 2015 20:47:10 +0200 Subject: [PATCH 0566/1029] Xcode: Properly indent PBXFileReference and PBXBuildFile Move indent factor change behind indention of start-of-line. --- Source/cmXCodeObject.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 33ce8cc2e..519545ac9 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -91,13 +91,13 @@ void cmXCodeObject::Print(std::ostream& out) { std::string separator = "\n"; int indentFactor = 1; + cmXCodeObject::Indent(2*indentFactor, out); if(this->Version > 15 && (this->IsA == PBXFileReference || this->IsA == PBXBuildFile)) { separator = " "; indentFactor = 0; } - cmXCodeObject::Indent(2*indentFactor, out); out << this->Id << " "; if(!(this->IsA == PBXGroup && this->Comment.size() == 0)) { From 4bd2544b25655b6e20e5098a5f4cdd973288c106 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 7 Apr 2015 22:00:29 +0200 Subject: [PATCH 0567/1029] Xcode: Do not add whitespace after attribute group opening brace This suppresses the extra space that would be generated if the separator is a space. The conditional block is also used in this form elsewhere. --- Source/cmXCodeObject.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 519545ac9..72d8e99ba 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -139,7 +139,11 @@ void cmXCodeObject::Print(std::ostream& out) else if(object->TypeValue == ATTRIBUTE_GROUP) { std::map::iterator j; - out << i->first << " = {" << separator; + out << i->first << " = {"; + if(separator == "\n") + { + out << separator; + } for(j = object->ObjectAttributes.begin(); j != object->ObjectAttributes.end(); ++j) { From 6e8952c19385acb0ff9f58c2a462d91dd0624e05 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 9 Apr 2015 10:14:47 +0200 Subject: [PATCH 0568/1029] Xcode: PrintComment will prepend a whitespace itself before the comment --- Source/cmXCode21Object.cxx | 2 +- Source/cmXCodeObject.cxx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx index 855e1ad2f..96f7b0fdd 100644 --- a/Source/cmXCode21Object.cxx +++ b/Source/cmXCode21Object.cxx @@ -31,7 +31,7 @@ void cmXCode21Object::PrintComment(std::ostream& out) cmSystemTools::ReplaceString(this->Comment, "\"", ""); } } - out << "/* "; + out << " /* "; out << this->Comment; out << " */"; } diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 72d8e99ba..e41f282f2 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -98,7 +98,7 @@ void cmXCodeObject::Print(std::ostream& out) separator = " "; indentFactor = 0; } - out << this->Id << " "; + out << this->Id; if(!(this->IsA == PBXGroup && this->Comment.size() == 0)) { this->PrintComment(out); @@ -129,7 +129,7 @@ void cmXCodeObject::Print(std::ostream& out) for(unsigned int k = 0; k < i->second->List.size(); k++) { cmXCodeObject::Indent(4*indentFactor, out); - out << i->second->List[k]->Id << " "; + out << i->second->List[k]->Id; i->second->List[k]->PrintComment(out); out << "," << separator; } @@ -192,7 +192,6 @@ void cmXCodeObject::Print(std::ostream& out) out << " = " << object->Object->Id; if(object->Object->HasComment() && i->first != "remoteGlobalIDString") { - out << " "; object->Object->PrintComment(out); } out << ";" << separator; From a6331eb851c132d3d0496e738886ad76e13a92a0 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 9 Apr 2015 10:48:33 +0200 Subject: [PATCH 0569/1029] Xcode: Let PrintComment decide if the comment is non-empty --- Source/cmXCode21Object.cxx | 4 ++++ Source/cmXCodeObject.cxx | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx index 96f7b0fdd..f30f70002 100644 --- a/Source/cmXCode21Object.cxx +++ b/Source/cmXCode21Object.cxx @@ -31,6 +31,10 @@ void cmXCode21Object::PrintComment(std::ostream& out) cmSystemTools::ReplaceString(this->Comment, "\"", ""); } } + if(this->Comment.empty()) + { + return; + } out << " /* "; out << this->Comment; out << " */"; diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index e41f282f2..b9c41f38f 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -99,10 +99,7 @@ void cmXCodeObject::Print(std::ostream& out) indentFactor = 0; } out << this->Id; - if(!(this->IsA == PBXGroup && this->Comment.size() == 0)) - { - this->PrintComment(out); - } + this->PrintComment(out); out << " = {"; if(separator == "\n") { From 6693590f8144a905b423ca03fa8ed98df4468bae Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 9 Apr 2015 11:04:35 +0200 Subject: [PATCH 0570/1029] Xcode: Refine quoting rules for Strings $ and . do not need to be quoted, but brackets and * must be to not confuse the Xcode parser. --- Source/cmXCodeObject.cxx | 2 +- Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index b9c41f38f..e72d315a7 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -243,7 +243,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) bool needQuote = (String.empty() || String.find("//") != String.npos || - String.find_first_of(" <>.+-=@$[],") != String.npos); + String.find_first_of(" <>+-*=@[](){},") != String.npos); const char* quote = needQuote? "\"" : ""; // Print the string, quoted and escaped as necessary. diff --git a/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake b/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake index 7882d7f13..1847bc986 100644 --- a/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake @@ -1,6 +1,6 @@ set(expect-default "explicitFileType = sourcecode") -set(expect-explicit "explicitFileType = \"sourcecode.c.h\"") -set(expect-lastKnown "lastKnownFileType = \"sourcecode.c.h\"") +set(expect-explicit "explicitFileType = sourcecode.c.h") +set(expect-lastKnown "lastKnownFileType = sourcecode.c.h") foreach(src default explicit lastKnown) file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeFileType.xcodeproj/project.pbxproj actual-${src} REGEX "PBXFileReference.*src-${src}") From a0bc4a999d2be105fe2cf18deb6f4849381c6573 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 18 Apr 2015 00:01:06 -0400 Subject: [PATCH 0571/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 85c699204..2b56fe7d6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150417) +set(CMake_VERSION_PATCH 20150418) #set(CMake_VERSION_RC 1) From fc7ab8874b0e5c2c010fb73718ae8702b8853ca0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:31 +0200 Subject: [PATCH 0572/1029] CPack: Read the config listfile in the normal way. This is a unique function call in CMake, and it was likely a programming error when introduced. All other similar calls to ReadListFile use a null first paramter. The effect of this patch is to no-longer define CMAKE_PARENT_LIST_FILE to the config file itself while evaluating it. The ReadListFile method also no longer hits a condition that it uses CollapseFullPath on the input file. However, as cpack does not set the StartDirectory anyway, this has no effect. See bug 15522. --- Source/CPack/cmCPackGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4f370419c..a2edab564 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1163,7 +1163,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if(config) { - mf->ReadListFile(config); + mf->ReadListFile(0, config); } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccuredFlag()) From 5bb4248a807029053156dbf4a3cdba4427766306 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:31 +0200 Subject: [PATCH 0573/1029] cmMakefile: Remove fullPath parameter from ReadListFile. There is no reason for this to be a responsibility of ReadListFile. Additionally, the only user of it already computes it itself. --- Source/cmFindPackageCommand.cxx | 2 +- Source/cmIncludeCommand.cxx | 6 ++---- Source/cmMakefile.cxx | 9 --------- Source/cmMakefile.h | 1 - 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index e1074b0ef..af99b1c32 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -999,7 +999,7 @@ bool cmFindPackageCommand::FindAppBundleConfig() //---------------------------------------------------------------------------- bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) { - if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f, 0, + if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f, !this->PolicyScope || psr == NoPolicyScope)) { return true; diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index c15d46efe..0c2e73ac5 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -130,17 +130,15 @@ bool cmIncludeCommand gg->GenerateImportFile(fname_abs); } - std::string fullFilePath; bool readit = this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), - fname.c_str(), &fullFilePath, - noPolicyScope); + fname.c_str(), noPolicyScope); // add the location of the included file if a result variable was given if (!resultVarName.empty()) { this->Makefile->AddDefinition(resultVarName, - readit?fullFilePath.c_str():"NOTFOUND"); + readit?fname_abs.c_str():"NOTFOUND"); } if(!optional && !readit && !cmSystemTools::GetFatalErrorOccured()) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 205508bca..8bc4ac8a1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -527,7 +527,6 @@ void cmMakefile::IncludeScope::EnforceCMP0011() // bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in, - std::string* fullPath, bool noPolicyScope) { std::string currentParentFile @@ -598,19 +597,11 @@ bool cmMakefile::ReadListFile(const char* filename_in, // push the listfile onto the stack this->ListFileStack.push_back(filenametoread); - if(fullPath!=0) - { - *fullPath=filenametoread; - } cmListFile cacheFile; if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) ) { // pop the listfile off the stack this->ListFileStack.pop_back(); - if(fullPath!=0) - { - *fullPath = ""; - } this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 299d550a2..ce21c60d4 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -87,7 +87,6 @@ public: */ bool ReadListFile(const char* listfile, const char* external= 0, - std::string* fullPath= 0, bool noPolicyScope = true); /** From 68f791cd06983e8fd375edfba74a9d821231e269 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:31 +0200 Subject: [PATCH 0574/1029] cmMakefile: Add a method for processing buildsystem files. These are different from other ListFiles in that a project() command is required if it is top-level. --- Source/cmLocalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 24 ++++++++---------------- Source/cmMakefile.h | 5 ++++- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c143bce83..56e17ec09 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -181,7 +181,7 @@ void cmLocalGenerator::ReadInputFile() currentStart += "/CMakeLists.txt"; if(cmSystemTools::FileExists(currentStart.c_str(), true)) { - this->Makefile->ReadListFile(currentStart.c_str()); + this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); return; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8bc4ac8a1..b08725edd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -522,12 +522,19 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } +bool cmMakefile::ProcessBuildsystemFile(const char* listfile) +{ + return this->ReadListFile(listfile, 0, true, + this->cmStartDirectory == this->cmHomeDirectory); +} + //---------------------------------------------------------------------------- // Parse the given CMakeLists.txt file executing all commands // bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in, - bool noPolicyScope) + bool noPolicyScope, + bool requireProjectCommand) { std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); @@ -580,21 +587,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, cmSystemTools::GetFilenamePath(filenametoread).c_str()); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - // try to see if the list file is the top most - // list file for a project, and if it is, then it - // must have a project command. If there is not - // one, then cmake will provide one via the - // cmListFileCache class. - bool requireProjectCommand = false; - if(!external && this->cmStartDirectory == this->cmHomeDirectory) - { - if(cmSystemTools::LowerCase( - cmSystemTools::GetFilenameName(filename)) == "cmakelists.txt") - { - requireProjectCommand = true; - } - } - // push the listfile onto the stack this->ListFileStack.push_back(filenametoread); cmListFile cacheFile; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ce21c60d4..33c4b20a3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -87,7 +87,10 @@ public: */ bool ReadListFile(const char* listfile, const char* external= 0, - bool noPolicyScope = true); + bool noPolicyScope = true, + bool requireProjectCommand = false); + + bool ProcessBuildsystemFile(const char* listfile); /** * Add a function blocker to this makefile From a2f2aeee2f4d4af1f25f4a5b86bacb8a81a7dec4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:32 +0200 Subject: [PATCH 0575/1029] cmMakefile: Add wrapper for reading listfiles which have an origin. Such files are delegates from other files, and so they set the CMAKE_PARENT_LIST_FILE to the originator. They also may set a policy scope. --- Source/CTest/cmCTestTestHandler.cxx | 8 ++------ Source/cmCTest.cxx | 3 +-- Source/cmFindPackageCommand.cxx | 4 ++-- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmIncludeCommand.cxx | 3 +-- Source/cmMakefile.cxx | 6 ++++++ Source/cmMakefile.h | 2 ++ Source/cmProjectCommand.cxx | 3 +-- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c50ea884e..59c5e92b4 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -117,9 +117,7 @@ bool cmCTestSubdirCommand } fname += "/"; fname += testFilename; - bool readit = - this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), - fname.c_str()); + bool readit = this->Makefile->ReadDependentFile(fname.c_str()); cmSystemTools::ChangeDirectory(cwd); if(!readit) { @@ -205,9 +203,7 @@ bool cmCTestAddSubdirectoryCommand } fname += "/"; fname += testFilename; - bool readit = - this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), - fname.c_str()); + bool readit = this->Makefile->ReadDependentFile(fname.c_str()); cmSystemTools::ChangeDirectory(cwd); if(!readit) { diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index cd2cd7cbf..91ae889de 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -687,8 +687,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: " << fname << std::endl, command->ShouldBeQuiet()); - bool readit = mf->ReadListFile(mf->GetCurrentListFile(), - fname.c_str() ); + bool readit = mf->ReadDependentFile(fname.c_str()); if(!readit) { std::string m = "Could not find include file: "; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index af99b1c32..aecd230af 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -999,8 +999,8 @@ bool cmFindPackageCommand::FindAppBundleConfig() //---------------------------------------------------------------------------- bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) { - if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), f, - !this->PolicyScope || psr == NoPolicyScope)) + const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope; + if(this->Makefile->ReadDependentFile(f, noPolicyScope)) { return true; } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index e2b2bbd4e..e26885227 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -60,7 +60,7 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf) fname += "/Templates"; } fname += "/CMakeVisualStudio6Configurations.cmake"; - if(!mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str())) + if(!mf->ReadDependentFile(fname.c_str())) { cmSystemTools::Error("Cannot open ", fname.c_str(), ". Please copy this file from the main " diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 0c2e73ac5..18e3585ed 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -131,8 +131,7 @@ bool cmIncludeCommand } bool readit = - this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), - fname.c_str(), noPolicyScope); + this->Makefile->ReadDependentFile(fname.c_str(), noPolicyScope); // add the location of the included file if a result variable was given if (!resultVarName.empty()) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b08725edd..29e564f98 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -528,6 +528,12 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) this->cmStartDirectory == this->cmHomeDirectory); } +bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) +{ + return this->ReadListFile(this->GetCurrentListFile(), listfile, + noPolicyScope); +} + //---------------------------------------------------------------------------- // Parse the given CMakeLists.txt file executing all commands // diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 33c4b20a3..3d925fa78 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -90,6 +90,8 @@ public: bool noPolicyScope = true, bool requireProjectCommand = false); + bool ReadDependentFile(const char* listfile, bool noPolicyScope = true); + bool ProcessBuildsystemFile(const char* listfile); /** diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 601dc54f9..43b02bc4b 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -236,8 +236,7 @@ bool cmProjectCommand { std::string fullFilePath; bool readit = - this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), - include); + this->Makefile->ReadDependentFile(include); if(!readit && !cmSystemTools::GetFatalErrorOccured()) { std::string m = From 846608f2678b4bced696857b5ca45e11bc86aa2c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:32 +0200 Subject: [PATCH 0576/1029] cmMakefile: Remove useless condition. --- Source/cmMakefile.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 29e564f98..2b4b896ad 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -573,10 +573,7 @@ bool cmMakefile::ReadListFile(const char* filename_in, // keep track of the current file being read if (filename) { - if(this->cmCurrentListFile != filename) - { - this->cmCurrentListFile = filename; - } + this->cmCurrentListFile = filename; } // Now read the input file From 0d9555779d7bd2a8d068f5b9af431bcf9673453a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:32 +0200 Subject: [PATCH 0577/1029] cmMakefile: Delegate ListFile reading to internal method. --- Source/cmMakefile.cxx | 9 +++++++++ Source/cmMakefile.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2b4b896ad..02115918c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -541,6 +541,15 @@ bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in, bool noPolicyScope, bool requireProjectCommand) +{ + return this->ReadListFileInternal(filename_in, external_in, + noPolicyScope, requireProjectCommand); +} + +bool cmMakefile::ReadListFileInternal(const char* filename_in, + const char* external_in, + bool noPolicyScope, + bool requireProjectCommand) { std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 3d925fa78..88faed924 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -991,6 +991,12 @@ protected: private: void Initialize(); + + bool ReadListFileInternal(const char* filename_in, + const char* external_in, + bool noPolicyScope, + bool requireProjectCommand); + bool ParseDefineFlag(std::string const& definition, bool remove); bool EnforceUniqueDir(const std::string& srcPath, From 5c201f1ee6cc19e0f1871048a6a6af9056c5780f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:33 +0200 Subject: [PATCH 0578/1029] cmMakefile: Remove duplication in ReadListFile. --- Source/cmMakefile.cxx | 60 ++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 02115918c..38e94e239 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -542,8 +542,34 @@ bool cmMakefile::ReadListFile(const char* filename_in, bool noPolicyScope, bool requireProjectCommand) { - return this->ReadListFileInternal(filename_in, external_in, - noPolicyScope, requireProjectCommand); + std::string currentParentFile + = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); + std::string currentFile + = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + + bool res = this->ReadListFileInternal(filename_in, external_in, + noPolicyScope, requireProjectCommand); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_DIR", + cmSystemTools::GetFilenamePath(currentFile).c_str()); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); + + this->ListFileStack.pop_back(); + + if (res) + { + // Check for unused variables + this->CheckForUnusedVariables(); + } + + return res; } bool cmMakefile::ReadListFileInternal(const char* filename_in, @@ -551,13 +577,6 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, bool noPolicyScope, bool requireProjectCommand) { - std::string currentParentFile - = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); - std::string currentFile - = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - const char* external = 0; std::string external_abs; @@ -604,15 +623,6 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, cmListFile cacheFile; if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) ) { - // pop the listfile off the stack - this->ListFileStack.pop_back(); - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); return false; } // add this list file to the list of dependencies @@ -651,20 +661,6 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, this->EnforceDirectoryLevelRules(); } - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - // pop the listfile off the stack - this->ListFileStack.pop_back(); - - // Check for unused variables - this->CheckForUnusedVariables(); - return true; } From 813cd719c41b05df7a22ad3ebd267cc9bfc2505e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:33 +0200 Subject: [PATCH 0579/1029] cmMakefile: Determine the file to read before calling Internal. --- Source/cmMakefile.cxx | 69 +++++++++++++++++++++---------------------- Source/cmMakefile.h | 4 +-- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 38e94e239..dafbfef76 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -541,41 +541,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in, bool noPolicyScope, bool requireProjectCommand) -{ - std::string currentParentFile - = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); - std::string currentFile - = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); - - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - - bool res = this->ReadListFileInternal(filename_in, external_in, - noPolicyScope, requireProjectCommand); - - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - this->ListFileStack.pop_back(); - - if (res) - { - // Check for unused variables - this->CheckForUnusedVariables(); - } - - return res; -} - -bool cmMakefile::ReadListFileInternal(const char* filename_in, - const char* external_in, - bool noPolicyScope, - bool requireProjectCommand) { const char* external = 0; std::string external_abs; @@ -612,6 +577,40 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, filenametoread= external; } + std::string currentParentFile + = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); + std::string currentFile + = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + + bool res = this->ReadListFileInternal(filenametoread, + noPolicyScope, requireProjectCommand); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_DIR", + cmSystemTools::GetFilenamePath(currentFile).c_str()); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); + + this->ListFileStack.pop_back(); + + if (res) + { + // Check for unused variables + this->CheckForUnusedVariables(); + } + + return res; +} + +bool cmMakefile::ReadListFileInternal(const char* filenametoread, + bool noPolicyScope, + bool requireProjectCommand) +{ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->AddDefinition("CMAKE_CURRENT_LIST_DIR", diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 88faed924..2664d8e29 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -992,8 +992,8 @@ private: void Initialize(); - bool ReadListFileInternal(const char* filename_in, - const char* external_in, + + bool ReadListFileInternal(const char* filenametoread, bool noPolicyScope, bool requireProjectCommand); From 524ce895427557312eef52d837f0afdb39a0dab6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:33 +0200 Subject: [PATCH 0580/1029] cmMakefile: Change condition to its equivalent. This makes it easier to reason about follow-up commits. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dafbfef76..bb0b8cb54 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -572,7 +572,7 @@ bool cmMakefile::ReadListFile(const char* filename_in, // Now read the input file const char *filenametoread= filename; - if( external) + if(external_in) { filenametoread= external; } From bdd4c5f5ba6d3bf60b4e3bc620b146784e1559f1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:33 +0200 Subject: [PATCH 0581/1029] cmMakefile: Move variable definition above a condition. --- Source/cmMakefile.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bb0b8cb54..67138bae3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -563,15 +563,14 @@ bool cmMakefile::ReadListFile(const char* filename_in, } } + const char *filenametoread = filename; + // keep track of the current file being read if (filename) { this->cmCurrentListFile = filename; } - // Now read the input file - const char *filenametoread= filename; - if(external_in) { filenametoread= external; From 2d6121a9a709e319cca733787bcc21bac593a232 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:34 +0200 Subject: [PATCH 0582/1029] cmMakefile: Remove use of intermediate variable. --- Source/cmMakefile.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 67138bae3..46a10a934 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -566,9 +566,9 @@ bool cmMakefile::ReadListFile(const char* filename_in, const char *filenametoread = filename; // keep track of the current file being read - if (filename) + if (filenametoread) { - this->cmCurrentListFile = filename; + this->cmCurrentListFile = filenametoread; } if(external_in) From e4f8f1f1b706d7efc9964826ff4572d27a3062d3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:34 +0200 Subject: [PATCH 0583/1029] cmMakefile: Remove intermediate variable. --- Source/cmMakefile.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 46a10a934..ac71ea50e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -545,7 +545,7 @@ bool cmMakefile::ReadListFile(const char* filename_in, const char* external = 0; std::string external_abs; - const char* filename = filename_in; + const char* filenametoread = filename_in; std::string filename_abs; if (external_in) @@ -559,12 +559,10 @@ bool cmMakefile::ReadListFile(const char* filename_in, filename_abs = cmSystemTools::CollapseFullPath(filename_in, this->cmStartDirectory.c_str()); - filename = filename_abs.c_str(); + filenametoread = filename_abs.c_str(); } } - const char *filenametoread = filename; - // keep track of the current file being read if (filenametoread) { From 3dc4fe02e63422532486320739e0cf4abddaa270 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:34 +0200 Subject: [PATCH 0584/1029] cmMakefile: Re-order independent variable setting. --- Source/cmMakefile.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ac71ea50e..029fd3ded 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -550,10 +550,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, if (external_in) { - external_abs = - cmSystemTools::CollapseFullPath(external_in, - this->cmStartDirectory.c_str()); - external = external_abs.c_str(); if (filename_in) { filename_abs = @@ -561,6 +557,10 @@ bool cmMakefile::ReadListFile(const char* filename_in, this->cmStartDirectory.c_str()); filenametoread = filename_abs.c_str(); } + external_abs = + cmSystemTools::CollapseFullPath(external_in, + this->cmStartDirectory.c_str()); + external = external_abs.c_str(); } // keep track of the current file being read From 08da8742709d6da74d1a17de46990ec5aaf3ad0f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:34 +0200 Subject: [PATCH 0585/1029] cmMakefile: Split a conditional. --- Source/cmMakefile.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 029fd3ded..5ab1928a8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -557,6 +557,10 @@ bool cmMakefile::ReadListFile(const char* filename_in, this->cmStartDirectory.c_str()); filenametoread = filename_abs.c_str(); } + } + + if (external_in) + { external_abs = cmSystemTools::CollapseFullPath(external_in, this->cmStartDirectory.c_str()); From f0dae032ee44283d08869c2a948f001dc211bfd5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:35 +0200 Subject: [PATCH 0586/1029] cmMakefile: Re-order independent statements. --- Source/cmMakefile.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5ab1928a8..042ffc058 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -559,6 +559,11 @@ bool cmMakefile::ReadListFile(const char* filename_in, } } + if (filenametoread) + { + this->cmCurrentListFile = filenametoread; + } + if (external_in) { external_abs = @@ -567,12 +572,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, external = external_abs.c_str(); } - // keep track of the current file being read - if (filenametoread) - { - this->cmCurrentListFile = filenametoread; - } - if(external_in) { filenametoread= external; From 3a1ad1713f87ed7219c934dcb32c4d41573807c4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:35 +0200 Subject: [PATCH 0587/1029] cmMakefile: Combine duplicate condition. --- Source/cmMakefile.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 042ffc058..037d69782 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -570,10 +570,7 @@ bool cmMakefile::ReadListFile(const char* filename_in, cmSystemTools::CollapseFullPath(external_in, this->cmStartDirectory.c_str()); external = external_abs.c_str(); - } - if(external_in) - { filenametoread= external; } From e2d0e0fbeb1bf7b43dc55ce55c6000819d108aee Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:35 +0200 Subject: [PATCH 0588/1029] cmMakefile: Remove intermediate variable. --- Source/cmMakefile.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 037d69782..eeba6aa20 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -542,7 +542,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, bool noPolicyScope, bool requireProjectCommand) { - const char* external = 0; std::string external_abs; const char* filenametoread = filename_in; @@ -569,9 +568,8 @@ bool cmMakefile::ReadListFile(const char* filename_in, external_abs = cmSystemTools::CollapseFullPath(external_in, this->cmStartDirectory.c_str()); - external = external_abs.c_str(); - filenametoread= external; + filenametoread = external_abs.c_str(); } std::string currentParentFile From 5947d9b031444b48a7d7a9c70ef02d2333aeabee Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:36 +0200 Subject: [PATCH 0589/1029] cmMakefile: Convert filenametoread into a std::string. Remove other intermediate variables. --- Source/cmMakefile.cxx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eeba6aa20..851e40723 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -542,34 +542,32 @@ bool cmMakefile::ReadListFile(const char* filename_in, bool noPolicyScope, bool requireProjectCommand) { - std::string external_abs; - - const char* filenametoread = filename_in; - std::string filename_abs; + std::string filenametoread; + if (filename_in) + { + filenametoread = filename_in; + } if (external_in) { if (filename_in) { - filename_abs = + filenametoread = cmSystemTools::CollapseFullPath(filename_in, this->cmStartDirectory.c_str()); - filenametoread = filename_abs.c_str(); } } - if (filenametoread) + if (!filenametoread.empty()) { this->cmCurrentListFile = filenametoread; } if (external_in) { - external_abs = + filenametoread = cmSystemTools::CollapseFullPath(external_in, this->cmStartDirectory.c_str()); - - filenametoread = external_abs.c_str(); } std::string currentParentFile @@ -580,7 +578,7 @@ bool cmMakefile::ReadListFile(const char* filename_in, this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - bool res = this->ReadListFileInternal(filenametoread, + bool res = this->ReadListFileInternal(filenametoread.c_str(), noPolicyScope, requireProjectCommand); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); From 3a8ac2423ef658e87e366a143428835be48bf88f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:36 +0200 Subject: [PATCH 0590/1029] cmMakefile: Collapse nested conditional. --- Source/cmMakefile.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 851e40723..9a572231c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -548,14 +548,11 @@ bool cmMakefile::ReadListFile(const char* filename_in, filenametoread = filename_in; } - if (external_in) + if (external_in && filename_in) { - if (filename_in) - { - filenametoread = - cmSystemTools::CollapseFullPath(filename_in, - this->cmStartDirectory.c_str()); - } + filenametoread = + cmSystemTools::CollapseFullPath(filename_in, + this->cmStartDirectory.c_str()); } if (!filenametoread.empty()) From 5d4480a8c711a3d5971e100cc1a8984b6305c509 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:36 +0200 Subject: [PATCH 0591/1029] cmMakefile: Populate CMAKE_PARENT_LIST_FILE in callers. Because all external callers of this method pass a null first parameter, this change has no effect for them. This also makes it obvious that the CMAKE_PARENT_LIST_FILE is set to the name of the file being read itself for CMakeLists.txt files, which may not make any sense. --- Source/cmMakefile.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9a572231c..7f4fbc195 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -524,12 +524,14 @@ void cmMakefile::IncludeScope::EnforceCMP0011() bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { + this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); return this->ReadListFile(listfile, 0, true, this->cmStartDirectory == this->cmHomeDirectory); } bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) { + this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile()); return this->ReadListFile(this->GetCurrentListFile(), listfile, noPolicyScope); } @@ -572,7 +574,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, std::string currentFile = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); bool res = this->ReadListFileInternal(filenametoread.c_str(), From 9db15954104455fef54d59c7aa029d798075bf0e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:36 +0200 Subject: [PATCH 0592/1029] cmMakefile: Move condition to the only calling context where it is true. Call the Internal method with equivalent parameters, passing a null first argument. A duplicate path computation exists inside the external_in condition now, but that is harmless at this point. --- Source/cmMakefile.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7f4fbc195..9b2ee352b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -532,7 +532,11 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile()); - return this->ReadListFile(this->GetCurrentListFile(), listfile, + std::string filenametoread = + cmSystemTools::CollapseFullPath(listfile, + this->cmStartDirectory.c_str()); + this->cmCurrentListFile = filenametoread; + return this->ReadListFile(0, filenametoread.c_str(), noPolicyScope); } @@ -550,13 +554,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, filenametoread = filename_in; } - if (external_in && filename_in) - { - filenametoread = - cmSystemTools::CollapseFullPath(filename_in, - this->cmStartDirectory.c_str()); - } - if (!filenametoread.empty()) { this->cmCurrentListFile = filenametoread; From 7d248547361bbacb4f5b532ef2ce4f4935c97dc8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:37 +0200 Subject: [PATCH 0593/1029] cmMakefile: Remove intermediate variable. --- Source/cmMakefile.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9b2ee352b..d3ea55a04 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -532,11 +532,10 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile()); - std::string filenametoread = + this->cmCurrentListFile = cmSystemTools::CollapseFullPath(listfile, this->cmStartDirectory.c_str()); - this->cmCurrentListFile = filenametoread; - return this->ReadListFile(0, filenametoread.c_str(), + return this->ReadListFile(0, this->cmCurrentListFile.c_str(), noPolicyScope); } From 95a27267daee021514df8c93ffd6d9b9e55dea51 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:37 +0200 Subject: [PATCH 0594/1029] cmMakefile: Extract conditional code to caller. --- Source/cmMakefile.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d3ea55a04..bc225ffd9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -525,6 +525,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); + this->cmCurrentListFile = listfile; return this->ReadListFile(listfile, 0, true, this->cmStartDirectory == this->cmHomeDirectory); } @@ -553,11 +554,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, filenametoread = filename_in; } - if (!filenametoread.empty()) - { - this->cmCurrentListFile = filenametoread; - } - if (external_in) { filenametoread = From d21ebcb2444a4b6001c5997f7004bd5cf917d71b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:37 +0200 Subject: [PATCH 0595/1029] cmMakefile: Swap parameters of calls to ReadListFile. The version with a null first parameter is now equivalent. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bc225ffd9..51f9a5740 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -526,7 +526,7 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); this->cmCurrentListFile = listfile; - return this->ReadListFile(listfile, 0, true, + return this->ReadListFile(0, listfile, true, this->cmStartDirectory == this->cmHomeDirectory); } From 6e23a4bdddd2bfee668c682a9ab4081b5e6fcfa2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:37 +0200 Subject: [PATCH 0596/1029] cmMakefile: Remove always-null first parameter to ReadListFile. --- Source/CPack/cmCPackGenerator.cxx | 8 ++++---- Source/CPack/cpack.cxx | 6 +++--- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 4 ++-- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCTest.cxx | 4 ++-- Source/cmGlobalGenerator.cxx | 24 ++++++++++++------------ Source/cmGraphVizWriter.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmMakefile.cxx | 22 ++++++---------------- Source/cmMakefile.h | 1 - Source/cmQtAutoGenerators.cxx | 4 ++-- Source/cmake.cxx | 6 +++--- 13 files changed, 39 insertions(+), 50 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index a2edab564..2b18c4158 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -525,7 +525,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( tempInstallDirectory.c_str()); this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", tempInstallDirectory.c_str()); - int res = this->MakefileMap->ReadListFile(0, installScript.c_str()); + int res = this->MakefileMap->ReadListFile(installScript.c_str()); if ( cmSystemTools::GetErrorOccuredFlag() || !res ) { return 0; @@ -888,7 +888,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( "1"); } // do installation - int res = mf->ReadListFile(0, installFile.c_str()); + int res = mf->ReadListFile(installFile.c_str()); // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES // to CPack (may be used by generators like CPack RPM or DEB) // in order to transparently handle ABSOLUTE PATH @@ -980,7 +980,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName) { bool retval; std::string fullPath = this->MakefileMap->GetModulesFile(moduleName); - retval = this->MakefileMap->ReadListFile(0, fullPath.c_str()); + retval = this->MakefileMap->ReadListFile(fullPath.c_str()); // include FATAL_ERROR and ERROR in the return status retval = retval && (! cmSystemTools::GetErrorOccuredFlag()); return retval; @@ -1163,7 +1163,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if(config) { - mf->ReadListFile(0, config); + mf->ReadListFile(config); } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccuredFlag()) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a9cabf18d..275227009 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -244,7 +244,7 @@ int main (int argc, char const* const* argv) // paths, so FIND_XXX() commands can be used in scripts std::string systemFile = globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) + if (!globalMF->ReadListFile(systemFile.c_str())) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error reading CMakeDetermineSystem.cmake" << std::endl); @@ -253,7 +253,7 @@ int main (int argc, char const* const* argv) systemFile = globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) + if (!globalMF->ReadListFile(systemFile.c_str())) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); @@ -272,7 +272,7 @@ int main (int argc, char const* const* argv) cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Read CPack configuration file: " << cpackConfigFile << std::endl); - if ( !globalMF->ReadListFile(0, cpackConfigFile.c_str()) ) + if ( !globalMF->ReadListFile(cpackConfigFile.c_str()) ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Problem reading CPack config file: \"" diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 62fa2befe..de6ecde3a 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -757,7 +757,7 @@ void cmCTestLaunch::LoadConfig() std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; if(cmSystemTools::FileExists(fname.c_str()) && - mf->ReadListFile(0, fname.c_str())) + mf->ReadListFile(fname.c_str())) { this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY"); cmSystemTools::ConvertToUnixSlashes(this->SourceDir); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 783941b74..7f9825c17 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -433,7 +433,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) ctest scripting easier. */ std::string systemFile = this->Makefile->GetModulesFile("CTestScriptMode.cmake"); - if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || + if (!this->Makefile->ReadListFile(systemFile.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" @@ -451,7 +451,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) } // finally read in the script - if (!this->Makefile->ReadListFile(0, script.c_str()) || + if (!this->Makefile->ReadListFile(script.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { // Reset the error flag so that it can run more than diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 59c5e92b4..d77825374 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1617,7 +1617,7 @@ void cmCTestTestHandler::GetListOfTests() return; } - if ( !mf->ReadListFile(0, testFilename) ) + if ( !mf->ReadListFile(testFilename) ) { return; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 91ae889de..3697aa4b2 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2576,7 +2576,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) bool erroroc = cmSystemTools::GetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag(); - if ( !mf->ReadListFile(0, fname.c_str()) || + if ( !mf->ReadListFile(fname.c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { cmCTestLog(this, ERROR_MESSAGE, @@ -2606,7 +2606,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " << *fileIt << std::endl); - if ( !mf->ReadListFile(0, fileIt->c_str()) || + if ( !mf->ReadListFile(fileIt->c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { cmCTestLog(this, ERROR_MESSAGE, diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ab044c1f1..4a9f62803 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -278,7 +278,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) mf->GetModulesFile(this->FindMakeProgramFile.c_str()); if(!setMakeProgram.empty()) { - mf->ReadListFile(0, setMakeProgram.c_str()); + mf->ReadListFile(setMakeProgram.c_str()); } } if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM") @@ -428,7 +428,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, fpath += "/CMakeSystem.cmake"; if(cmSystemTools::FileExists(fpath.c_str())) { - mf->ReadListFile(0,fpath.c_str()); + mf->ReadListFile(fpath.c_str()); } } // Load the CMakeDetermineSystem.cmake file and find out @@ -456,12 +456,12 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, #endif // Read the DetermineSystem file std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake"); - mf->ReadListFile(0, systemFile.c_str()); + mf->ReadListFile(systemFile.c_str()); // load the CMakeSystem.cmake from the binary directory // this file is configured by the CMakeDetermineSystem.cmake file fpath = rootBin; fpath += "/CMakeSystem.cmake"; - mf->ReadListFile(0,fpath.c_str()); + mf->ReadListFile(fpath.c_str()); } if(readCMakeSystem) @@ -495,7 +495,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) { fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake"); - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: " "CMakeSystemSpecificInitialize.cmake"); @@ -533,7 +533,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // to avoid duplicate compiler tests. if(cmSystemTools::FileExists(fpath.c_str())) { - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); @@ -563,7 +563,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, determineCompiler += "Compiler.cmake"; std::string determineFile = mf->GetModulesFile(determineCompiler.c_str()); - if(!mf->ReadListFile(0,determineFile.c_str())) + if(!mf->ReadListFile(determineFile.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", determineCompiler.c_str()); @@ -597,7 +597,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, fpath += "/CMake"; fpath += lang; fpath += "Compiler.cmake"; - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); @@ -616,7 +616,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) { fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: " "CMakeSystemSpecificInformation.cmake"); @@ -707,7 +707,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); } - else if(!mf->ReadListFile(0, informationFile.c_str())) + else if(!mf->ReadListFile(informationFile.c_str())) { cmSystemTools::Error("Could not process cmake module file: ", informationFile.c_str()); @@ -732,7 +732,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, testLang += lang; testLang += "Compiler.cmake"; std::string ifpath = mf->GetModulesFile(testLang.c_str()); - if(!mf->ReadListFile(0,ifpath.c_str())) + if(!mf->ReadListFile(ifpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", testLang.c_str()); @@ -777,7 +777,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, projectCompatibility += "Compatibility.cmake"; if(cmSystemTools::FileExists(projectCompatibility.c_str())) { - mf->ReadListFile(0,projectCompatibility.c_str()); + mf->ReadListFile(projectCompatibility.c_str()); } // Inform any extra generator of the new language. if (this->ExtraGenerator) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index af88d1c7b..99542a904 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -81,7 +81,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, } } - if ( !mf->ReadListFile(0, inFileName) ) + if ( !mf->ReadListFile(inFileName) ) { cmSystemTools::Error("Problem opening GraphViz options file: ", inFileName); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 8938e67d8..153ed0935 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1475,7 +1475,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, bool color) { // read in the target info file - if(!this->Makefile->ReadListFile(0, tgtInfo) || + if(!this->Makefile->ReadListFile(tgtInfo) || cmSystemTools::GetErrorOccuredFlag()) { cmSystemTools::Error("Target DependInfo.cmake file not found"); @@ -1592,7 +1592,7 @@ cmLocalUnixMakefileGenerator3 std::string dirInfoFile = this->Makefile->GetStartOutputDirectory(); dirInfoFile += cmake::GetCMakeFilesDirectory(); dirInfoFile += "/CMakeDirectoryInformation.cmake"; - if(mf->ReadListFile(0, dirInfoFile.c_str()) && + if(mf->ReadListFile(dirInfoFile.c_str()) && !cmSystemTools::GetErrorOccuredFlag()) { haveDirectoryInfo = true; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 51f9a5740..7790b8a45 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -526,7 +526,7 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); this->cmCurrentListFile = listfile; - return this->ReadListFile(0, listfile, true, + return this->ReadListFile(listfile, true, this->cmStartDirectory == this->cmHomeDirectory); } @@ -536,30 +536,20 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) this->cmCurrentListFile = cmSystemTools::CollapseFullPath(listfile, this->cmStartDirectory.c_str()); - return this->ReadListFile(0, this->cmCurrentListFile.c_str(), + return this->ReadListFile(this->cmCurrentListFile.c_str(), noPolicyScope); } //---------------------------------------------------------------------------- // Parse the given CMakeLists.txt file executing all commands // -bool cmMakefile::ReadListFile(const char* filename_in, - const char *external_in, +bool cmMakefile::ReadListFile(const char* listfile, bool noPolicyScope, bool requireProjectCommand) { - std::string filenametoread; - if (filename_in) - { - filenametoread = filename_in; - } - - if (external_in) - { - filenametoread = - cmSystemTools::CollapseFullPath(external_in, - this->cmStartDirectory.c_str()); - } + std::string filenametoread = + cmSystemTools::CollapseFullPath(listfile, + this->cmStartDirectory.c_str()); std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2664d8e29..73d6910a9 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -86,7 +86,6 @@ public: * Read and parse a CMakeLists.txt file. */ bool ReadListFile(const char* listfile, - const char* external= 0, bool noPolicyScope = true, bool requireProjectCommand = false); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d49e99787..3d5103f72 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1243,7 +1243,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutogenInfo.cmake"; - if (!makefile->ReadListFile(0, filename.c_str())) + if (!makefile->ReadListFile(filename.c_str())) { cmSystemTools::Error("Error processing file: ", filename.c_str()); return false; @@ -1413,7 +1413,7 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; - if (makefile->ReadListFile(0, filename.c_str())) + if (makefile->ReadListFile(filename.c_str())) { this->OldCompileSettingsStr = makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS"); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a542a24b4..c4f7c4ec3 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -388,7 +388,7 @@ void cmake::ReadListFile(const std::vector& args, lg->GetMakefile()->SetArgcArgv(args); } - if (!lg->GetMakefile()->ReadListFile(0, path)) + if (!lg->GetMakefile()->ReadListFile(path)) { cmSystemTools::Error("Error processing file: ", path); } @@ -424,7 +424,7 @@ bool cmake::FindPackage(const std::vector& args) mf->SetArgcArgv(args); std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake"); - mf->ReadListFile(0, systemFile.c_str()); + mf->ReadListFile(systemFile.c_str()); std::string language = mf->GetSafeDefinition("LANGUAGE"); std::string mode = mf->GetSafeDefinition("MODE"); @@ -1965,7 +1965,7 @@ int cmake::CheckBuildSystem() gg.SetCMakeInstance(&cm); cmsys::auto_ptr lg(gg.CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); - if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) || + if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { if(verbose) From 05245b42294a38c5f7be9b40a918e42575b7dbd7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:38 +0200 Subject: [PATCH 0597/1029] cmMakefile: Move some preamble out of the Internal method. --- Source/cmMakefile.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7790b8a45..7be920d6c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -556,7 +556,15 @@ bool cmMakefile::ReadListFile(const char* listfile, std::string currentFile = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); + this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_DIR", + cmSystemTools::GetFilenamePath(filenametoread).c_str()); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); + + this->ListFileStack.push_back(filenametoread); bool res = this->ReadListFileInternal(filenametoread.c_str(), noPolicyScope, requireProjectCommand); @@ -584,14 +592,6 @@ bool cmMakefile::ReadListFileInternal(const char* filenametoread, bool noPolicyScope, bool requireProjectCommand) { - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(filenametoread).c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - // push the listfile onto the stack - this->ListFileStack.push_back(filenametoread); cmListFile cacheFile; if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) ) { From 4c00a372893e4aa8aa4a5a66573175af9122b508 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 19 Apr 2015 00:01:06 -0400 Subject: [PATCH 0598/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2b56fe7d6..add4222a8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150418) +set(CMake_VERSION_PATCH 20150419) #set(CMake_VERSION_RC 1) From 152e9b3250d2b75d91b1058e01dfc4b46bb486cd Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 12 Apr 2015 20:50:05 +0200 Subject: [PATCH 0599/1029] CPackRPM package content list code move Move rpm package content list code to a separate function. --- Modules/CPackRPM.cmake | 147 +++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 70 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index b8d518c17..c283d2335 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -538,6 +538,82 @@ function(cpack_rpm_prepare_relocation_paths) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) endfunction() +function(cpack_rpm_prepare_content_list) + # if we are creating a relocatable package, omit parent directories of + # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" + # which is passed to the find command that generates the content-list + if(CPACK_RPM_PACKAGE_RELOCATABLE) + # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are + # destinct parent paths of other relocation paths and remove the + # final element (so the install-prefix dir itself is not omitted + # from the RPM's content-list) + set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") + list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) + set(_DISTINCT_PATH "NOT_SET") + foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) + if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") + set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") + + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) + unset(_TMP_LIST) + # Now generate all of the parent dirs of the relocation path + foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) + list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") + string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") + list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) + if(_DUPLICATE_FOUND EQUAL -1) + set(_OMIT_DIR "-o -path ${_OMIT_DIR}") + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + endif() + endforeach() + endif() + endforeach() + endif() + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") + endif() + + if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) + if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) + message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") + endif() + endif() + + if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") + endif() + foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) + list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") + endforeach() + endif() + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") + endif() + + # Use files tree to construct files command (spec file) + # We should not forget to include symlinks (thus -o -type l) + # We should include directory as well (thus -type d) + # but not the main local dir "." (thus -a -not -name ".") + # We must remove the './' due to the local search and escape the + # file name by enclosing it between double quotes (thus the sed) + # Then we must authorize any man pages extension (adding * at the end) + # because rpmbuild may automatically compress those files + execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) + COMMAND sed s:.*/man.*/.*:&*: + COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}" PARENT_SCOPE) +endfunction() + function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") @@ -1285,76 +1361,7 @@ function(cpack_rpm_generate_package) #string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") - # if we are creating a relocatable package, omit parent directories of - # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" - # which is passed to the find command that generates the content-list - if(CPACK_RPM_PACKAGE_RELOCATABLE) - # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are - # destinct parent paths of other relocation paths and remove the - # final element (so the install-prefix dir itself is not omitted - # from the RPM's content-list) - set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") - list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) - set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) - if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") - set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") - - string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - unset(_TMP_LIST) - # Now generate all of the parent dirs of the relocation path - foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) - list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") - string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") - list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) - if(_DUPLICATE_FOUND EQUAL -1) - set(_OMIT_DIR "-o -path ${_OMIT_DIR}") - separate_arguments(_OMIT_DIR) - list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) - endif() - endforeach() - endif() - endforeach() - endif() - - if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") - endif() - - if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) - if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) - message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") - list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") - endif() - endif() - - if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") - endif() - foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) - list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") - endforeach() - endif() - if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") - endif() - - # Use files tree to construct files command (spec file) - # We should not forget to include symlinks (thus -o -type l) - # We should include directory as well (thus -type d) - # but not the main local dir "." (thus -a -not -name ".") - # We must remove the './' due to the local search and escape the - # file name by enclosing it between double quotes (thus the sed) - # Then we must authorize any man pages extension (adding * at the end) - # because rpmbuild may automatically compress those files - execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) - COMMAND sed s:.*/man.*/.*:&*: - COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ - WORKING_DIRECTORY "${WDIR}" - OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + cpack_rpm_prepare_content_list() # In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_ # into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL From 76080c32e167b2eadf4305fb3af56ba1c7503c44 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sun, 19 Apr 2015 18:22:18 +0200 Subject: [PATCH 0600/1029] CPackRPM content listing refactor Refactoring of content list that removes use of find and sed to make listing algorithm more clear and remove external dependencies. Patch also limits man pages handling to locations listed in brp-compress rpm script by default - fixes bug report #14660. --- Modules/CPackRPM.cmake | 110 +++++++++++++----- Tests/CPackComponentsForAll/CMakeLists.txt | 7 ++ .../RunCPackVerifyResult.cmake | 9 +- Tests/CPackComponentsForAll/mylib | 17 +++ 4 files changed, 113 insertions(+), 30 deletions(-) create mode 100644 Tests/CPackComponentsForAll/mylib diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index c283d2335..fdba90eb2 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -419,6 +419,33 @@ # May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM__PACKAGE_PREFIX # from relocatable RPM prefix paths. # +# .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS +# +# * Mandatory : NO +# * Default : - +# +# May be used to set additional man dirs that could potentially be compressed +# by brp-compress RPM macro. Variable content must be a list of regular +# expressions that point to directories containing man files or to man files +# directly. Note that in order to compress man pages a path must also be +# present in brp-compress RPM script and that brp-compress script must be +# added to RPM configuration by the operating system. +# +# Regular expressions that are added by default were taken from brp-compress +# RPM macro: +# +# - /usr/man/man.* +# - /usr/man/.*/man.* +# - /usr/info.* +# - /usr/share/man/man.* +# - /usr/share/man/.*/man.* +# - /usr/share/info.* +# - /usr/kerberos/man.* +# - /usr/X11R6/man/man.* +# - /usr/lib/perl5/man/man.* +# - /usr/share/doc/.*/man/man.* +# - /usr/lib/.*/man/man.* +# # Packaging of Symbolic Links # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -539,6 +566,14 @@ function(cpack_rpm_prepare_relocation_paths) endfunction() function(cpack_rpm_prepare_content_list) + # get files list + cmake_policy(PUSH) + cmake_policy(SET CMP0009 NEW) + file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*") + cmake_policy(POP) + set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}") + string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}") + # if we are creating a relocatable package, omit parent directories of # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" # which is passed to the find command that generates the content-list @@ -547,26 +582,21 @@ function(cpack_rpm_prepare_content_list) # destinct parent paths of other relocation paths and remove the # final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") - list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) + list(SORT RPM_USED_PACKAGE_PREFIXES) set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) + foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") - string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}") list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) unset(_TMP_LIST) # Now generate all of the parent dirs of the relocation path foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") - list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) - if(_DUPLICATE_FOUND EQUAL -1) - set(_OMIT_DIR "-o -path ${_OMIT_DIR}") - separate_arguments(_OMIT_DIR) - list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) - endif() + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) endforeach() endif() endforeach() @@ -576,40 +606,62 @@ function(cpack_rpm_prepare_content_list) message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") endif() - if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) - if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) + if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") endif() endif() if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - if (CPACK_RPM_PACKAGE_DEBUG) + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") endif() - foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) - list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") - endforeach() + list(APPEND _RPM_DIRS_TO_OMIT ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) endif() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") endif() - # Use files tree to construct files command (spec file) - # We should not forget to include symlinks (thus -o -type l) - # We should include directory as well (thus -type d) - # but not the main local dir "." (thus -a -not -name ".") - # We must remove the './' due to the local search and escape the - # file name by enclosing it between double quotes (thus the sed) - # Then we must authorize any man pages extension (adding * at the end) - # because rpmbuild may automatically compress those files - execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) - COMMAND sed s:.*/man.*/.*:&*: - COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ - WORKING_DIRECTORY "${WDIR}" - OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES ${_RPM_DIRS_TO_OMIT}) + + # add man paths that will be compressed + # (copied from /usr/lib/rpm/brp-compress - script that does the actual + # compressing) + list(APPEND MAN_LOCATIONS "/usr/man/man.*" "/usr/man/.*/man.*" "/usr/info.*" + "/usr/share/man/man.*" "/usr/share/man/.*/man.*" "/usr/share/info.*" + "/usr/kerberos/man.*" "/usr/X11R6/man/man.*" "/usr/lib/perl5/man/man.*" + "/usr/share/doc/.*/man/man.*" "/usr/lib/.*/man/man.*") + + if(CPACK_RPM_ADDITIONAL_MAN_DIRS) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_ADDITIONAL_MAN_DIRS= ${CPACK_RPM_ADDITIONAL_MAN_DIRS}") + endif() + list(APPEND MAN_LOCATIONS ${CPACK_RPM_ADDITIONAL_MAN_DIRS}) + endif() + + foreach(PACK_LOCATION IN LISTS CPACK_RPM_INSTALL_FILES) + foreach(MAN_LOCATION IN LISTS MAN_LOCATIONS) + # man pages are files inside a certain location + if(PACK_LOCATION MATCHES "${MAN_LOCATION}/" + AND NOT IS_DIRECTORY "${WDIR}${PACK_LOCATION}" + AND NOT IS_SYMLINK "${WDIR}${PACK_LOCATION}") + list(FIND CPACK_RPM_INSTALL_FILES "${PACK_LOCATION}" INDEX) + # insert file location that covers compressed man pages + # even if using a wildcard causes duplicates as those are + # handled by RPM and we still keep the same file list + # in spec file - wildcard only represents file type (e.g. .gz) + list(INSERT CPACK_RPM_INSTALL_FILES ${INDEX} "${PACK_LOCATION}*") + # remove file location that doesn't cover compressed man pages + math(EXPR INDEX ${INDEX}+1) + list(REMOVE_AT CPACK_RPM_INSTALL_FILES ${INDEX}) + + break() + endif() + endforeach() + endforeach() set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}" PARENT_SCOPE) endfunction() diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 1cc34b00a..823f6db4d 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -50,6 +50,13 @@ install(FILES mylib.h COMPONENT headers) if("${CPACK_GENERATOR}" MATCHES "RPM") + ############## test man pages + install(FILES mylib + DESTINATION share/man/mylib/man3/mylib.1) + install(FILES mylib + DESTINATION share/man/mylib/man3/mylib.1 RENAME mylib2) + + ############## test symlinks # Package symbolic links install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index e7470521c..d94a477be 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -233,7 +233,14 @@ if(CPackGen MATCHES "RPM") /usr/foo/bar/bin/@in@_@path@@with/@and /usr/foo/bar/bin/@in@_@path@@with/@and/@ /usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@ -/usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2$") +/usr/foo/bar/bin/@in@_@path@@with/@and/@/@in_path@/mylibapp2 +/usr/foo/bar/share +/usr/foo/bar/share/man +/usr/foo/bar/share/man/mylib +/usr/foo/bar/share/man/mylib/man3 +/usr/foo/bar/share/man/mylib/man3/mylib.1 +/usr/foo/bar/share/man/mylib/man3/mylib.1/mylib +/usr/foo/bar/share/man/mylib/man3/mylib.1/mylib2$") else() message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") endif() diff --git a/Tests/CPackComponentsForAll/mylib b/Tests/CPackComponentsForAll/mylib new file mode 100644 index 000000000..e3bd05c4e --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib @@ -0,0 +1,17 @@ +.\" Manpage for mylib. +.\" Contact bugs@mylib_author.net.in to correct errors or typos. +.TH mylib 3 "01 May 2015" "1.0" "mylib.so man page" +.SH NAME +mylib \- cpack testing lib +.SH SYNOPSIS +mylib.so +.SH DESCRIPTION +mylib.so test man page. +.SH OPTIONS +Lib does not take any options. +.SH SEE ALSO +mylib(3) +.SH BUGS +No known bugs. +.SH AUTHOR +Someone (author@lib_author.net.in) From 73ff279d07712d6293126e7488960db054ce51be Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 20 Apr 2015 00:01:04 -0400 Subject: [PATCH 0601/1029] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index add4222a8..0e96a1bcc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150419) +set(CMake_VERSION_PATCH 20150420) #set(CMake_VERSION_RC 1) From 28429270194c42973bbec6bd0e5aeae061a8925c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Apr 2015 10:24:50 -0400 Subject: [PATCH 0602/1029] Tests: Delay RunCMake.ExternalProject case checks Use RunCMake "-check.cmake" scripts to check the generated initial cache file content so that the full generation process is completed. --- .../CMAKE_CACHE_ARGS-check.cmake | 17 ++++++++++++ .../ExternalProject/CMAKE_CACHE_ARGS.cmake | 18 +------------ .../CMAKE_CACHE_DEFAULT_ARGS-check.cmake | 17 ++++++++++++ .../CMAKE_CACHE_DEFAULT_ARGS.cmake | 18 +------------ .../CMAKE_CACHE_mix-check.cmake | 26 +++++++++++++++++++ .../ExternalProject/CMAKE_CACHE_mix.cmake | 25 +----------------- 6 files changed, 63 insertions(+), 58 deletions(-) create mode 100644 Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake create mode 100644 Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake create mode 100644 Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake new file mode 100644 index 000000000..c1e42043d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake @@ -0,0 +1,17 @@ +set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache.cmake") + +if(NOT EXISTS "${_cache_file}") + set(RunCMake_TEST_FAILED "Initial cache not created") + return() +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache") + return() +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected forced FOO argument") + return() +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake index bf9b12d8f..5e37eece6 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -1,21 +1,5 @@ include(ExternalProject) -set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") -set(_cache_file "${_tmp_dir}/FOO-cache.cmake") - -ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" +ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" DOWNLOAD_COMMAND "" CMAKE_CACHE_ARGS "-DFOO:STRING=BAR") - -if(NOT EXISTS "${_cache_file}") - message(FATAL_ERROR "Initial cache not created") -endif() - -file(READ "${_cache_file}" _cache) - -if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find FOO argument in cache") -endif() -if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected forced FOO argument") -endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake new file mode 100644 index 000000000..ec1cafb1e --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake @@ -0,0 +1,17 @@ +set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache.cmake") + +if(NOT EXISTS "${_cache_file}") + set(RunCMake_TEST_FAILED "Initial cache not created") + return() +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache") + return() +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected not forced FOO argument") + return() +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake index c21666407..8e984706b 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -1,21 +1,5 @@ include(ExternalProject) -set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") -set(_cache_file "${_tmp_dir}/FOO-cache.cmake") - -ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" +ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" DOWNLOAD_COMMAND "" CMAKE_CACHE_DEFAULT_ARGS "-DFOO:STRING=BAR") - -if(NOT EXISTS "${_cache_file}") - message(FATAL_ERROR "Initial cache not created") -endif() - -file(READ "${_cache_file}" _cache) - -if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find FOO argument in cache") -endif() -if("${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected not forced FOO argument") -endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake new file mode 100644 index 000000000..2a07f27e5 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake @@ -0,0 +1,26 @@ +set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache.cmake") + +if(NOT EXISTS "${_cache_file}") + set(RunCMake_TEST_FAILED "Initial cache not created") + return() +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache") + return() +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected forced FOO argument") + return() +endif() + +if(NOT "${_cache}" MATCHES "set\\(BAR \"BAZ\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find BAR argument in cache") + return() +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected not forced BAR argument") + return() +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake index 894e18379..e7f26ae0a 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -1,29 +1,6 @@ include(ExternalProject) -set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") -set(_cache_file "${_tmp_dir}/FOO-cache.cmake") - -ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" +ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" DOWNLOAD_COMMAND "" CMAKE_CACHE_ARGS "-DFOO:STRING=BAR" CMAKE_CACHE_DEFAULT_ARGS "-DBAR:STRING=BAZ") - -if(NOT EXISTS "${_cache_file}") - message(FATAL_ERROR "Initial cache not created") -endif() - -file(READ "${_cache_file}" _cache) - -if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find FOO argument in cache") -endif() -if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected forced FOO argument") -endif() - -if(NOT "${_cache}" MATCHES "set\\(BAR \"BAZ\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find BAR argument in cache") -endif() -if("${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected not forced BAR argument") -endif() From 48004d9dbeb2af20d3a8df66670323d924a3f4c6 Mon Sep 17 00:00:00 2001 From: Geoff Viola Date: Mon, 23 Mar 2015 23:12:55 -0600 Subject: [PATCH 0603/1029] Add a 'Green Hills MULTI' generator on Windows Green Hills MULTI is an IDE for embedded real-time systems. The IDE's product page can be found here: http://www.ghs.com/products/MULTI_IDE.html It supports cross compiling on ARM, Intel x86, and other architectures with various operating systems. The IDE exists on Linux and Windows host systems, but CMake will currently only generate the project files on Windows host systems. --- Help/generator/Green Hills MULTI.rst | 16 + Help/manual/cmake-generators.7.rst | 1 + Help/manual/cmake-variables.7.rst | 5 + .../CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst | 6 + ...CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst | 7 + .../CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst | 6 + ...E_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst | 7 + Help/variable/CMAKE_MAKE_PROGRAM.rst | 4 + Help/variable/CMAKE_SYSTEM_PROCESSOR.rst | 2 + Help/variable/GHS-MULTI.rst | 4 + Modules/Compiler/GHS-C.cmake | 27 + Modules/Compiler/GHS-CXX.cmake | 31 + Modules/Compiler/GHS-DetermineCompiler.cmake | 6 + Modules/FindBoost.cmake | 5 +- Modules/Platform/GHS-MULTI-Initialize.cmake | 29 + Modules/Platform/GHS-MULTI.cmake | 27 + Source/CMakeLists.txt | 9 + Source/cmGhsMultiGpj.cxx | 44 ++ Source/cmGhsMultiGpj.h | 34 + Source/cmGhsMultiTargetGenerator.cxx | 600 ++++++++++++++++++ Source/cmGhsMultiTargetGenerator.h | 119 ++++ Source/cmGlobalGhsMultiGenerator.cxx | 548 ++++++++++++++++ Source/cmGlobalGhsMultiGenerator.h | 127 ++++ Source/cmGlobalNinjaGenerator.cxx | 1 + Source/cmLocalGhsMultiGenerator.cxx | 55 ++ Source/cmLocalGhsMultiGenerator.h | 56 ++ Source/cmake.cxx | 3 + Tests/CMakeLists.txt | 17 + Tests/GhsMulti/CMakeLists.txt | 4 + Tests/GhsMulti/ReturnNum/App/CMakeLists.txt | 4 + Tests/GhsMulti/ReturnNum/App/Main.c | 8 + Tests/GhsMulti/ReturnNum/CMakeLists.txt | 3 + Tests/GhsMulti/ReturnNum/Int/AppDD.int | 12 + Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt | 1 + Tests/GhsMulti/ReturnNum/Int/Default.bsp | 35 + Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt | 1 + Tests/GhsMulti/ReturnNum/Lib/HelperFun.c | 4 + Tests/GhsMulti/ReturnNum/Lib/HelperFun.h | 1 + 38 files changed, 1868 insertions(+), 1 deletion(-) create mode 100644 Help/generator/Green Hills MULTI.rst create mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst create mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst create mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst create mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst create mode 100644 Help/variable/GHS-MULTI.rst create mode 100644 Modules/Compiler/GHS-C.cmake create mode 100644 Modules/Compiler/GHS-CXX.cmake create mode 100644 Modules/Compiler/GHS-DetermineCompiler.cmake create mode 100644 Modules/Platform/GHS-MULTI-Initialize.cmake create mode 100644 Modules/Platform/GHS-MULTI.cmake create mode 100644 Source/cmGhsMultiGpj.cxx create mode 100644 Source/cmGhsMultiGpj.h create mode 100644 Source/cmGhsMultiTargetGenerator.cxx create mode 100644 Source/cmGhsMultiTargetGenerator.h create mode 100644 Source/cmGlobalGhsMultiGenerator.cxx create mode 100644 Source/cmGlobalGhsMultiGenerator.h create mode 100644 Source/cmLocalGhsMultiGenerator.cxx create mode 100644 Source/cmLocalGhsMultiGenerator.h create mode 100644 Tests/GhsMulti/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/App/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/App/Main.c create mode 100644 Tests/GhsMulti/ReturnNum/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/Int/AppDD.int create mode 100644 Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/Int/Default.bsp create mode 100644 Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/Lib/HelperFun.c create mode 100644 Tests/GhsMulti/ReturnNum/Lib/HelperFun.h diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst new file mode 100644 index 000000000..4d3169026 --- /dev/null +++ b/Help/generator/Green Hills MULTI.rst @@ -0,0 +1,16 @@ +Green Hills MULTI +----------------- + +Generates Green Hills MULTI project files (experimental, work-in-progress). + +Customizations are available through the following cache variables: + +* ``GHS_BSP_NAME`` +* ``GHS_CUSTOMIZATION`` +* ``GHS_GPJ_MACROS`` +* ``GHS_OS_DIR`` + +.. note:: + This generator is deemed experimental as of CMake |release| + and is still a work in progress. Future versions of CMake + may make breaking changes as the generator matures. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 6f76fb19a..723c308b9 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -73,6 +73,7 @@ Visual Studio Generators .. toctree:: :maxdepth: 1 + /generator/Green Hills MULTI /generator/Visual Studio 6 /generator/Visual Studio 7 /generator/Visual Studio 7 .NET 2003 diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 63f704da5..865e1ef25 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -182,6 +182,7 @@ Variables that Describe the System /variable/CMAKE_SYSTEM_VERSION /variable/CYGWIN /variable/ENV + /variable/GHS-MULTI /variable/MINGW /variable/MSVC10 /variable/MSVC11 @@ -307,6 +308,10 @@ Variables for Languages /variable/CMAKE_LANG_FLAGS_RELEASE /variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO /variable/CMAKE_LANG_FLAGS + /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG + /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL + /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE + /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO /variable/CMAKE_LANG_IGNORE_EXTENSIONS /variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES /variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst new file mode 100644 index 000000000..c5915c390 --- /dev/null +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst @@ -0,0 +1,6 @@ +CMAKE__GHS_KERNEL_FLAGS_DEBUG +----------------------------------- + +GHS kernel flags for Debug build type or configuration. + + flags used when CMAKE_BUILD_TYPE is Debug. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst new file mode 100644 index 000000000..f80e785d5 --- /dev/null +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst @@ -0,0 +1,7 @@ +CMAKE__GHS_KERNEL_FLAGS_MINSIZEREL +---------------------------------------- + +GHS kernel flags for MinSizeRel build type or configuration. + + flags used when CMAKE_BUILD_TYPE is MinSizeRel.Short for +minimum size release. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst new file mode 100644 index 000000000..fe02bc342 --- /dev/null +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst @@ -0,0 +1,6 @@ +CMAKE__GHS_KERNEL_FLAGS_RELEASE +------------------------------------- + +GHS kernel flags for Release build type or configuration. + + flags used when CMAKE_BUILD_TYPE is Release diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst new file mode 100644 index 000000000..220f7f941 --- /dev/null +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst @@ -0,0 +1,7 @@ +CMAKE__GHS_KERNEL_FLAGS_RELWITHDEBINFO +-------------------------------------------- + +GHS kernel flags for RelWithDebInfo type or configuration. + + flags used when CMAKE_BUILD_TYPE is RelWithDebInfo. Short for +Release With Debug Information. diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index f1d88a557..85b098bd6 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -56,6 +56,10 @@ to configure the project: the CMake cache then CMake will use the specified value if possible. +* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``. + If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to + the CMake cache then CMake will use the specified value. + The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code. The value is also used by the :manual:`cmake(1)` ``--build`` and :manual:`ctest(1)` ``--build-and-test`` tools to launch the native diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 8ad89f128..2f5313bc9 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -6,3 +6,5 @@ The name of the CPU CMake is building for. This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if you build for the host system instead of the target system when cross compiling. + +* The Green Hills MULTI generator sets this to ``ARM`` by default diff --git a/Help/variable/GHS-MULTI.rst b/Help/variable/GHS-MULTI.rst new file mode 100644 index 000000000..0f91be8ad --- /dev/null +++ b/Help/variable/GHS-MULTI.rst @@ -0,0 +1,4 @@ +GHS-MULTI +--------- + +True when using Green Hills MULTI diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake new file mode 100644 index 000000000..e97d62c22 --- /dev/null +++ b/Modules/Compiler/GHS-C.cmake @@ -0,0 +1,27 @@ +set(CMAKE_C_VERBOSE_FLAG "-v") + +set(CMAKE_C_FLAGS_INIT "") +set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Ospace") +set(CMAKE_C_FLAGS_RELEASE_INIT "-O") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O -g") + +set(CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT "-ldebug ${CMAKE_C_FLAGS_DEBUG_INIT}") +set(CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT}") +set(CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT}") +set(CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT + "-ldebug ${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}") + +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) + set (CMAKE_C_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT}" + CACHE STRING "Kernel flags used by the compiler during debug builds.") + set (CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL + "${CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT}" CACHE STRING + "Kernel flags used by the compiler during release builds for minimum size.") + set (CMAKE_C_GHS_KERNEL_FLAGS_RELEASE + "${CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT}" + CACHE STRING "Kernel flags used by the compiler during release builds.") + set (CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO + "${CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + "Kernel flags used by the compiler during release builds with debug info.") +endif() diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake new file mode 100644 index 000000000..71a0dec78 --- /dev/null +++ b/Modules/Compiler/GHS-CXX.cmake @@ -0,0 +1,31 @@ +set(CMAKE_CXX_VERBOSE_FLAG "-v") + +set(CMAKE_CXX_FLAGS_INIT "") +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Ospace") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O -g") + +set(CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT + "-ldebug ${CMAKE_CXX_FLAGS_DEBUG_INIT}") +set(CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL_INIT + "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}") +set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT + "${CMAKE_CXX_FLAGS_RELEASE_INIT}") +set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT + "-ldebug ${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}") + +if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) + set (CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG + "${CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT}" + CACHE STRING "Kernel flags used by the compiler during debug builds.") + set (CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL + "${CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL_INIT}" CACHE STRING + "Kernel flags used by the compiler during release builds for minimum size.") + set (CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE + "${CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT}" + CACHE STRING "Kernel flags used by the compiler during release builds.") + set (CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + "Kernel flags used by the compiler during release builds with debug info.") +endif() diff --git a/Modules/Compiler/GHS-DetermineCompiler.cmake b/Modules/Compiler/GHS-DetermineCompiler.cmake new file mode 100644 index 000000000..56d24e266 --- /dev/null +++ b/Modules/Compiler/GHS-DetermineCompiler.cmake @@ -0,0 +1,6 @@ +set(_compiler_id_pp_test "defined(__INTEGRITY)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEGRITY_MAJOR_VERSION) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEGRITY_MINOR_VERSION) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEGRITY_PATCH_VERSION)") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 466090b68..c844aed08 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -405,6 +405,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) else() set (_boost_COMPILER "-il") endif() + elseif (GHSMULTI) + set(_boost_COMPILER "-ghs") elseif (MSVC14) set(_boost_COMPILER "-vc140") elseif (MSVC12) @@ -777,7 +779,8 @@ endif() # ------------------------------------------------------------------------ set(Boost_LIB_PREFIX "") -if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) +if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR + (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) set(Boost_LIB_PREFIX "lib") endif() diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake new file mode 100644 index 000000000..342ad21b4 --- /dev/null +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -0,0 +1,29 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +#Setup Greenhills MULTI specific compilation information +find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 + "C:/ghs/int1122" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 + "C:/ghs/int1104" + DOC "Path to integrity directory" + ) +set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") +set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") +set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") +mark_as_advanced(GHS_CUSTOMIZATION) +set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") +mark_as_advanced(GHS_GPJ_MACROS) diff --git a/Modules/Platform/GHS-MULTI.cmake b/Modules/Platform/GHS-MULTI.cmake new file mode 100644 index 000000000..211cf3eb2 --- /dev/null +++ b/Modules/Platform/GHS-MULTI.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola +# +# 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 distribute 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(__GHSMULTI) + return() +endif() +set(__GHSMULTI 1) + +set(GHSMULTI 1) + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +include(Platform/WindowsPaths) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a8136..064b82720 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -472,6 +472,14 @@ if (WIN32) cmVisualStudioSlnParser.cxx cmVisualStudioWCEPlatformParser.h cmVisualStudioWCEPlatformParser.cxx + cmGlobalGhsMultiGenerator.cxx + cmGlobalGhsMultiGenerator.h + cmLocalGhsMultiGenerator.cxx + cmLocalGhsMultiGenerator.h + cmGhsMultiTargetGenerator.cxx + cmGhsMultiTargetGenerator.h + cmGhsMultiGpj.cxx + cmGhsMultiGpj.h ) endif() endif () @@ -499,6 +507,7 @@ set(SRCS ${SRCS} cmNinjaUtilityTargetGenerator.cxx cmNinjaUtilityTargetGenerator.h ) + if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) add_executable(cmcldeps cmcldeps.cxx) diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx new file mode 100644 index 000000000..e1dce52bd --- /dev/null +++ b/Source/cmGhsMultiGpj.cxx @@ -0,0 +1,44 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGhsMultiGpj.h" + +#include "cmGeneratedFileStream.h" + +void GhsMultiGpj::WriteGpjTag(Types const gpjType, + cmGeneratedFileStream *const filestream) +{ + char const *tag; + switch (gpjType) + { + case INTERGRITY_APPLICATION: + tag = "INTEGRITY Application"; + break; + case LIBRARY: + tag = "Library"; + break; + case PROJECT: + tag = "Project"; + break; + case PROGRAM: + tag = "Program"; + break; + case REFERENCE: + tag = "Reference"; + break; + case SUBPROJECT: + tag = "Subproject"; + break; + default: + tag = ""; + } + *filestream << "[" << tag << "]" << std::endl; +} diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h new file mode 100644 index 000000000..91ff0f4a5 --- /dev/null +++ b/Source/cmGhsMultiGpj.h @@ -0,0 +1,34 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + 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. +============================================================================*/ +#ifndef cmGhsMultiGpj_h +#define cmGhsMultiGpj_h + +class cmGeneratedFileStream; + +class GhsMultiGpj +{ +public: + enum Types + { + INTERGRITY_APPLICATION, + LIBRARY, + PROJECT, + PROGRAM, + REFERENCE, + SUBPROJECT + }; + + static void WriteGpjTag(Types const gpjType, + cmGeneratedFileStream *filestream); +}; + +#endif // ! cmGhsMultiGpjType_h diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx new file mode 100644 index 000000000..01e2011c5 --- /dev/null +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -0,0 +1,600 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGhsMultiTargetGenerator.h" +#include "cmGlobalGhsMultiGenerator.h" +#include "cmLocalGhsMultiGenerator.h" +#include "cmMakefile.h" +#include "cmTarget.h" +#include "cmGeneratedFileStream.h" +#include "cmSourceFile.h" +#include +#include + +std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); + +cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget *target) + : Target(target) + , LocalGenerator(static_cast( + target->GetMakefile()->GetLocalGenerator())) + , Makefile(target->GetMakefile()) + , TargetGroup(DetermineIfTargetGroup(target)) + , DynamicDownload(false) +{ + this->RelBuildFilePath = this->GetRelBuildFilePath(target); + + this->RelOutputFileName = + this->RelBuildFilePath + this->Target->GetName() + ".a"; + + this->RelBuildFileName = this->RelBuildFilePath; + this->RelBuildFileName += this->GetBuildFileName(target); + + std::string absPathToRoot = this->GetAbsPathToRoot(target); + absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot); + this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; + this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; + this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName; +} + +cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() +{ + cmDeleteAll(this->FolderBuildStreams); +} + +std::string +cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target) +{ + std::string output; + char const *folderProp = target->GetProperty("FOLDER"); + output = NULL == folderProp ? "" : folderProp; + cmSystemTools::ConvertToUnixSlashes(output); + if (!output.empty()) + { + output += "/"; + } + output += target->GetName() + "/"; + return output; +} + +std::string +cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target) +{ + return target->GetMakefile()->GetHomeOutputDirectory(); +} + +std::string +cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target) +{ + std::string output; + output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target); + output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output); + output += cmGhsMultiTargetGenerator::GetRelBuildFilePath(target); + return output; +} + +std::string +cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target) +{ + std::string output; + output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target); + output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output); + output += cmGhsMultiTargetGenerator::GetBuildFileName(target); + return output; +} + +std::string cmGhsMultiTargetGenerator::GetBuildFileName(const cmTarget *target) +{ + std::string output; + output = target->GetName(); + output += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + return output; +} + +std::string +cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(std::string const &input) +{ + std::string output(input); + if (!cmHasLiteralSuffix(output, "/")) + { + output += "/"; + } + return output; +} + +void cmGhsMultiTargetGenerator::Generate() +{ + const std::vector objectSources = this->GetSources(); + if (!objectSources.empty() && this->IncludeThisTarget()) + { + if (!cmSystemTools::FileExists(this->AbsBuildFilePath.c_str())) + { + cmSystemTools::MakeDirectory(this->AbsBuildFilePath.c_str()); + } + cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName, + &this->FolderBuildStreams); + cmGlobalGhsMultiGenerator::OpenBuildFileStream( + this->GetFolderBuildStreams()); + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + if (0 == config.length()) + { + config = "RELEASE"; + } + const std::string language(this->Target->GetLinkerLanguage(config)); + config = cmSystemTools::UpperCase(config); + this->DynamicDownload = this->DetermineIfDynamicDownload(config, language); + if (this->DynamicDownload) + { + *this->GetFolderBuildStreams() << "#component integrity_dynamic_download" + << std::endl; + } + GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), this->GetFolderBuildStreams()); + cmGlobalGhsMultiGenerator::WriteDisclaimer(this->GetFolderBuildStreams()); + + bool const notKernel = this->IsNotKernel(config, language); + this->WriteTypeSpecifics(config, notKernel); + this->SetCompilerFlags(config, language, notKernel); + this->WriteCompilerFlags(config, language); + this->WriteCompilerDefinitions(config, language); + this->WriteIncludes(config, language); + if (this->Target->GetType() == cmTarget::EXECUTABLE) + { + this->WriteTargetLinkLibraries(); + } + this->WriteCustomCommands(); + if (this->DynamicDownload) + { + *this->GetFolderBuildStreams() << " " << this->DDOption << std::endl; + } + + this->WriteSources(objectSources); + } +} + +bool cmGhsMultiTargetGenerator::IncludeThisTarget() +{ + bool output = true; + char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL"); + if (NULL != excludeFromAll && '1' == excludeFromAll[0] && + '\0' == excludeFromAll[1]) + { + output = false; + } + return output; +} + +std::vector cmGhsMultiTargetGenerator::GetSources() const +{ + std::vector output; + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->Target->GetSourceFiles(output, config); + return output; +} + +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const +{ + return cmGhsMultiTargetGenerator::GetGpjTag(this->Target); +} + +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(const cmTarget *target) +{ + GhsMultiGpj::Types output; + if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) + { + output = GhsMultiGpj::INTERGRITY_APPLICATION; + } + else if (target->GetType() == cmTarget::STATIC_LIBRARY) + { + output = GhsMultiGpj::LIBRARY; + } + else + { + output = GhsMultiGpj::PROGRAM; + } + return output; +} + +cmGlobalGhsMultiGenerator* +cmGhsMultiTargetGenerator::GetGlobalGenerator() const +{ + return static_cast( + this->LocalGenerator->GetGlobalGenerator()); +} + +void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config, + bool const notKernel) +{ + std::string outputDir(this->GetOutputDirectory(config)); + std::string outputFilename(this->GetOutputFilename(config)); + + if (this->Target->GetType() == cmTarget::STATIC_LIBRARY) + { + *this->GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".a\"" + << std::endl; + } + else if (this->Target->GetType() == cmTarget::EXECUTABLE) + { + if (notKernel && !this->IsTargetGroup()) + { + *this->GetFolderBuildStreams() << " -relprog" << std::endl; + } + if (this->IsTargetGroup()) + { + *this->GetFolderBuildStreams() << " -non_shared" << std::endl; + *this->GetFolderBuildStreams() << " -o \"" << outputDir + << outputFilename << ".elf\"" + << std::endl; + } + else + { + *this->GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".as\"" + << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const &config, + const std::string &language, + bool const notKernel) +{ + std::map::iterator i = + this->FlagsByLanguage.find(language); + if (i == this->FlagsByLanguage.end()) + { + std::string flags; + const char *lang = language.c_str(); + + if (notKernel) + { + this->LocalGenerator->AddLanguageFlags(flags, lang, config); + } + else + { + this->LocalGenerator->AddLanguageFlags( + flags, lang + std::string("_GHS_KERNEL"), config); + } + this->LocalGenerator->AddCMP0018Flags(flags, this->Target, lang, config); + this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, lang); + + // Append old-style preprocessor definition flags. + if (std::string(" ") != std::string(this->Makefile->GetDefineFlags())) + { + this->LocalGenerator->AppendFlags(flags, + this->Makefile->GetDefineFlags()); + } + + // Add target-specific flags. + this->LocalGenerator->AddCompileOptions(flags, this->Target, lang, config); + + std::map::value_type entry(language, flags); + i = this->FlagsByLanguage.insert(entry).first; + } +} + +std::string cmGhsMultiTargetGenerator::GetDefines(const std::string &language, + std::string const &config) +{ + std::map::iterator i = + this->DefinesByLanguage.find(language); + if (i == this->DefinesByLanguage.end()) + { + std::set defines; + const char *lang = language.c_str(); + // Add the export symbol definition for shared library objects. + if (const char *exportMacro = this->Target->GetExportMacro()) + { + this->LocalGenerator->AppendDefines(defines, exportMacro); + } + + // Add preprocessor definitions for this target and configuration. + this->LocalGenerator->AddCompileDefinitions(defines, this->Target, config, + language); + + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + std::map::value_type entry(language, + definesString); + i = this->DefinesByLanguage.insert(entry).first; + } + return i->second; +} + +void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::string const &, + const std::string &language) +{ + std::map::iterator flagsByLangI = + this->FlagsByLanguage.find(language); + if (flagsByLangI != this->FlagsByLanguage.end()) + { + if (!flagsByLangI->second.empty()) + { + *this->GetFolderBuildStreams() << " " << flagsByLangI->second + << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( + const std::string &config, const std::string &language) +{ + std::vector compileDefinitions; + this->Target->GetCompileDefinitions(compileDefinitions, config, language); + for (std::vector::const_iterator cdI = + compileDefinitions.begin(); + cdI != compileDefinitions.end(); ++cdI) + { + *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config, + const std::string &language) +{ + std::vector includes = + this->Target->GetIncludeDirectories(config, language); + for (std::vector::const_iterator includes_i = includes.begin(); + includes_i != includes.end(); ++includes_i) + { + *this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() +{ + // library directories + cmTargetDependSet tds = + this->GetGlobalGenerator()->GetTargetDirectDepends(*this->Target); + for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); + ++tdsI) + { + const cmTarget *tg(*tdsI); + *this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg) + << "\"" << std::endl; + } + // library targets + cmTarget::LinkLibraryVectorType llv = + this->Target->GetOriginalLinkLibraries(); + for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin(); + llvI != llv.end(); ++llvI) + { + std::string libName = llvI->first; + // if it is a user defined target get the full path to the lib + cmTarget *tg(GetGlobalGenerator()->FindTarget(libName)); + if (NULL != tg) + { + cmGhsMultiTargetGenerator gmtg(tg); + libName = tg->GetName() + ".a"; + } + *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCustomCommands() +{ + WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(), + cmTarget::PRE_BUILD); + WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(), + cmTarget::POST_BUILD); +} + +void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( + std::vector const &commandsSet, + cmTarget::CustomCommandType const commandType) +{ + for (std::vector::const_iterator commandsSetI = + commandsSet.begin(); + commandsSetI != commandsSet.end(); ++commandsSetI) + { + cmCustomCommandLines const &commands = commandsSetI->GetCommandLines(); + for (cmCustomCommandLines::const_iterator commandI = commands.begin(); + commandI != commands.end(); ++commandI) + { + switch (commandType) + { + case cmTarget::PRE_BUILD: + *this->GetFolderBuildStreams() << " :preexecShellSafe="; + break; + case cmTarget::POST_BUILD: + *this->GetFolderBuildStreams() << " :postexecShellSafe="; + break; + default: + assert("Only pre and post are supported"); + } + cmCustomCommandLine const &command = *commandI; + for (cmCustomCommandLine::const_iterator commandLineI = command.begin(); + commandLineI != command.end(); ++commandLineI) + { + std::string subCommandE = + this->LocalGenerator->EscapeForShell(*commandLineI, true); + if (!command.empty()) + { + *this->GetFolderBuildStreams() + << (command.begin() == commandLineI ? "'" : " "); + //Need to double escape backslashes + cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\"); + } + *this->GetFolderBuildStreams() << subCommandE; + } + if (!command.empty()) + { + *this->GetFolderBuildStreams() << "'" << std::endl; + } + } + } +} + +void cmGhsMultiTargetGenerator::WriteSources( + std::vector const &objectSources) +{ + for (std::vector::const_iterator si = objectSources.begin(); + si != objectSources.end(); ++si) + { + std::vector sourceGroups(this->Makefile->GetSourceGroups()); + char const *sourceFullPath = (*si)->GetFullPath().c_str(); + cmSourceGroup *sourceGroup = + this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); + std::string sgPath(sourceGroup->GetFullName()); + cmSystemTools::ConvertToUnixSlashes(sgPath); + cmGlobalGhsMultiGenerator::AddFilesUpToPath( + this->GetFolderBuildStreams(), &this->FolderBuildStreams, + this->Makefile->GetHomeOutputDirectory(), sgPath, + GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); + + if ((*si)->GetExtension() == ".int") + { + *this->FolderBuildStreams[sgPath] << "\"" << (*si)->GetFullPath() << "\"" + << std::endl; + } + else + { + *this->FolderBuildStreams[sgPath] << (*si)->GetFullPath() << std::endl; + } + + if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && + "bsp" != (*si)->GetExtension()) + { + this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); + + this->WriteObjectDir(this->FolderBuildStreams[sgPath], + this->AbsBuildFilePath + sgPath); + } + } +} + +void cmGhsMultiTargetGenerator::WriteObjectLangOverride( + cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile) +{ + const char *rawLangProp = sourceFile->GetProperty("LANGUAGE"); + if (NULL != rawLangProp) + { + std::string sourceLangProp(rawLangProp); + std::string extension(sourceFile->GetExtension()); + if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) + { + *fileStream << " -dotciscxx" << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::WriteObjectDir( + cmGeneratedFileStream *fileStream, std::string const &dir) +{ + std::string workingDir(dir); + cmSystemTools::ConvertToUnixSlashes(workingDir); + if (!workingDir.empty()) + { + workingDir += "/"; + } + workingDir += "Objs"; + *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl; +} + +std::string +cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const +{ + std::string outputDir(AbsBuildFilePath); + + const char *runtimeOutputProp = + this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); + if (NULL != runtimeOutputProp) + { + outputDir = runtimeOutputProp; + } + + std::string configCapped(cmSystemTools::UpperCase(config)); + const char *runtimeOutputSProp = + this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped); + if (NULL != runtimeOutputSProp) + { + outputDir = runtimeOutputSProp; + } + cmSystemTools::ConvertToUnixSlashes(outputDir); + + if (!outputDir.empty()) + { + outputDir += "/"; + } + + return outputDir; +} + +std::string +cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const +{ + std::string outputFilename(this->Target->GetName()); + + const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME"); + if (NULL != outputNameProp) + { + outputFilename = outputNameProp; + } + + std::string configCapped(cmSystemTools::UpperCase(config)); + const char *outputNameSProp = + this->Target->GetProperty(configCapped + "_OUTPUT_NAME"); + if (NULL != outputNameSProp) + { + outputFilename = outputNameSProp; + } + + return outputFilename; +} + +bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config, + const std::string &language) +{ + bool output; + std::vector options; + this->Target->GetCompileOptions(options, config, language); + output = + options.end() == std::find(options.begin(), options.end(), "-kernel"); + return output; +} + +bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(const cmTarget *target) +{ + bool output = false; + std::vector sources; + std::string config = + target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); + target->GetSourceFiles(sources, config); + for (std::vector::const_iterator sources_i = sources.begin(); + sources.end() != sources_i; ++sources_i) + { + if ("int" == (*sources_i)->GetExtension()) + { + output = true; + } + } + return output; +} + +bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload( + std::string const &config, const std::string &language) +{ + std::vector options; + bool output = false; + this->Target->GetCompileOptions(options, config, language); + for (std::vector::const_iterator options_i = options.begin(); + options_i != options.end(); ++options_i) + { + std::string option = *options_i; + if (this->DDOption == option) + { + output = true; + } + } + return output; +} diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h new file mode 100644 index 000000000..8e81db870 --- /dev/null +++ b/Source/cmGhsMultiTargetGenerator.h @@ -0,0 +1,119 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + 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. +============================================================================*/ +#ifndef cmGhsMultiTargetGenerator_h +#define cmGhsMultiTargetGenerator_h + +#include "cmStandardIncludes.h" +#include "cmTarget.h" +#include "cmGhsMultiGpj.h" + +class cmGeneratedFileStream; +class cmGlobalGhsMultiGenerator; +class cmLocalGhsMultiGenerator; +class cmMakefile; +class cmSourceFile; +class cmGeneratedFileStream; +class cmCustomCommand; + +class cmGhsMultiTargetGenerator +{ +public: + cmGhsMultiTargetGenerator(cmTarget *target); + + virtual ~cmGhsMultiTargetGenerator(); + + virtual void Generate(); + + bool IncludeThisTarget(); + std::vector GetSources() const; + GhsMultiGpj::Types GetGpjTag() const; + static GhsMultiGpj::Types GetGpjTag(const cmTarget *target); + const char *GetAbsBuildFilePath() const + { + return this->AbsBuildFilePath.c_str(); + } + const char *GetRelBuildFileName() const + { + return this->RelBuildFileName.c_str(); + } + const char *GetAbsBuildFileName() const + { + return this->AbsBuildFileName.c_str(); + } + const char *GetAbsOutputFileName() const + { + return this->AbsOutputFileName.c_str(); + } + + static std::string GetRelBuildFilePath(const cmTarget *target); + static std::string GetAbsPathToRoot(const cmTarget *target); + static std::string GetAbsBuildFilePath(const cmTarget *target); + static std::string GetRelBuildFileName(const cmTarget *target); + static std::string GetBuildFileName(const cmTarget *target); + static std::string AddSlashIfNeededToPath(std::string const &input); + +private: + cmGlobalGhsMultiGenerator *GetGlobalGenerator() const; + cmGeneratedFileStream *GetFolderBuildStreams() + { + return this->FolderBuildStreams[""]; + }; + bool IsTargetGroup() const { return this->TargetGroup; } + + void WriteTypeSpecifics(const std::string &config, bool notKernel); + void WriteCompilerFlags(const std::string &config, + const std::string &language); + void WriteCompilerDefinitions(const std::string &config, + const std::string &language); + + void SetCompilerFlags(std::string const &config, const std::string &language, + bool const notKernel); + std::string GetDefines(const std::string &langugae, + std::string const &config); + + void WriteIncludes(const std::string &config, const std::string &language); + void WriteTargetLinkLibraries(); + void WriteCustomCommands(); + void + WriteCustomCommandsHelper(std::vector const &commandsSet, + cmTarget::CustomCommandType commandType); + void WriteSources(std::vector const &objectSources); + static void WriteObjectLangOverride(cmGeneratedFileStream *fileStream, + cmSourceFile *sourceFile); + static void WriteObjectDir(cmGeneratedFileStream *fileStream, + std::string const &dir); + std::string GetOutputDirectory(const std::string &config) const; + std::string GetOutputFilename(const std::string &config) const; + + bool IsNotKernel(std::string const &config, const std::string &language); + static bool DetermineIfTargetGroup(const cmTarget *target); + bool DetermineIfDynamicDownload(std::string const &config, + const std::string &language); + + cmTarget *Target; + cmLocalGhsMultiGenerator *LocalGenerator; + cmMakefile *Makefile; + std::string AbsBuildFilePath; + std::string RelBuildFilePath; + std::string AbsBuildFileName; + std::string RelBuildFileName; + std::string RelOutputFileName; + std::string AbsOutputFileName; + std::map FolderBuildStreams; + bool TargetGroup; + bool DynamicDownload; + static std::string const DDOption; + std::map FlagsByLanguage; + std::map DefinesByLanguage; +}; + +#endif // ! cmGhsMultiTargetGenerator_h diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx new file mode 100644 index 000000000..bba29b1db --- /dev/null +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -0,0 +1,548 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalGhsMultiGenerator.h" +#include "cmLocalGhsMultiGenerator.h" +#include "cmMakefile.h" +#include "cmVersion.h" +#include "cmGeneratedFileStream.h" +#include "cmGhsMultiTargetGenerator.h" +#include +#include + +const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; +const char *cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild"; + +cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() + : OSDirRelative(false) +{ + this->GhsBuildCommandInitialized = false; +} + +cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() +{ + cmDeleteAll(TargetFolderBuildStreams); +} + +cmLocalGenerator *cmGlobalGhsMultiGenerator::CreateLocalGenerator() +{ + cmLocalGenerator *lg = new cmLocalGhsMultiGenerator; + lg->SetGlobalGenerator(this); + this->SetCurrentLocalGenerator(lg); + return lg; +} + +void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) +{ + entry.Name = GetActualName(); + entry.Brief = + "Generates Green Hills MULTI files (experimental, work-in-progress)."; +} + +void cmGlobalGhsMultiGenerator::EnableLanguage( + std::vector const &l, cmMakefile *mf, bool optional) +{ + mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); + mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); + + const std::string ghsCompRoot(GetCompRoot()); + mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); + std::string ghsCompRootStart = + 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; + mf->AddDefinition("CMAKE_C_COMPILER", + std::string(ghsCompRootStart + "ccarm.exe").c_str()); + mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); + mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); + + mf->AddDefinition("CMAKE_CXX_COMPILER", + std::string(ghsCompRootStart + "cxarm.exe").c_str()); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); + mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); + + if (!ghsCompRoot.empty()) + { + static const char *compPreFix = "comp_"; + std::string compFilename = + cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); + cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); + mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); + } + + mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); +} + +void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile *mf) +{ + // The GHS generator knows how to lookup its build tool + // directly instead of needing a helper module to do it, so we + // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. + if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) + { + mf->AddDefinition("CMAKE_MAKE_PROGRAM", + this->GetGhsBuildCommand().c_str()); + } +} + +std::string const &cmGlobalGhsMultiGenerator::GetGhsBuildCommand() +{ + if (!this->GhsBuildCommandInitialized) + { + this->GhsBuildCommandInitialized = true; + this->GhsBuildCommand = this->FindGhsBuildCommand(); + } + return this->GhsBuildCommand; +} + +std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() +{ + std::vector userPaths; + userPaths.push_back(this->GetCompRoot()); + std::string makeProgram = + cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths); + if (makeProgram.empty()) + { + makeProgram = DEFAULT_MAKE_PROGRAM; + } + return makeProgram; +} + +std::string cmGlobalGhsMultiGenerator::GetCompRoot() +{ + std::string output; + + const std::vector + potentialDirsHardPaths(GetCompRootHardPaths()); + const std::vector potentialDirsRegistry(GetCompRootRegistry()); + + std::vector potentialDirsComplete; + potentialDirsComplete.insert(potentialDirsComplete.end(), + potentialDirsHardPaths.begin(), + potentialDirsHardPaths.end()); + potentialDirsComplete.insert(potentialDirsComplete.end(), + potentialDirsRegistry.begin(), + potentialDirsRegistry.end()); + + // Use latest version + std::string outputDirName; + for (std::vector::const_iterator potentialDirsCompleteIt = + potentialDirsComplete.begin(); + potentialDirsCompleteIt != potentialDirsComplete.end(); + ++potentialDirsCompleteIt) + { + const std::string dirName( + cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); + if (dirName.compare(outputDirName) > 0) + { + output = *potentialDirsCompleteIt; + outputDirName = dirName; + } + } + + return output; +} + +std::vector cmGlobalGhsMultiGenerator::GetCompRootHardPaths() +{ + std::vector output; + cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); + for (std::vector::iterator outputIt = output.begin(); + outputIt != output.end(); ++outputIt) + { + *outputIt = "C:/ghs/" + *outputIt; + } + return output; +} + +std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() +{ + std::vector output(2); + cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" + "GreenHillsSoftwared771f1b4;InstallLocation", + output[0]); + cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" + "GreenHillsSoftware9881cef6;InstallLocation", + output[1]); + return output; +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + std::string const &filepath, cmGeneratedFileStream **filestream) +{ + // Get a stream where to generate things. + if (NULL == *filestream) + { + *filestream = new cmGeneratedFileStream(filepath.c_str()); + if (NULL != *filestream) + { + OpenBuildFileStream(*filestream); + } + } +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + cmGeneratedFileStream *filestream) +{ + *filestream << "#!gbuild" << std::endl; +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream() +{ + // Compute GHS MULTI's build file path. + std::string buildFilePath = + this->GetCMakeInstance()->GetHomeOutputDirectory(); + buildFilePath += "/"; + buildFilePath += "default"; + buildFilePath += FILE_EXTENSION; + + this->Open(std::string(""), buildFilePath, &this->TargetFolderBuildStreams); + OpenBuildFileStream(GetBuildFileStream()); + + char const *osDir = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR"); + if (NULL == osDir) + { + osDir = ""; + cmSystemTools::Error("GHS_OS_DIR cache variable must be set"); + } + else + { + this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR"); + } + std::string fOSDir(this->trimQuotes(osDir)); + cmSystemTools::ReplaceString(fOSDir, "\\", "/"); + if (!fOSDir.empty() && ('c' == fOSDir[0] || 'C' == fOSDir[0])) + { + this->OSDirRelative = false; + } + else + { + this->OSDirRelative = true; + } + + char const *bspName = + this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); + if (NULL == bspName) + { + bspName = ""; + cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); + } + else + { + this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); + } + std::string fBspName(this->trimQuotes(bspName)); + cmSystemTools::ReplaceString(fBspName, "\\", "/"); + this->WriteMacros(); + this->WriteHighLevelDirectives(); + + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); + this->WriteDisclaimer(this->GetBuildFileStream()); + *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; + if (!fBspName.empty()) + { + *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; + } + this->WriteCompilerOptions(fOSDir); +} + +void cmGlobalGhsMultiGenerator::CloseBuildFileStream( + cmGeneratedFileStream **filestream) +{ + if (filestream) + { + delete *filestream; + *filestream = NULL; + } + else + { + cmSystemTools::Error("Build file stream was not open."); + } +} + +void cmGlobalGhsMultiGenerator::Generate() +{ + this->cmGlobalGenerator::Generate(); + + if (!this->LocalGenerators.empty()) + { + this->OpenBuildFileStream(); + + // Build all the folder build files + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + { + cmLocalGhsMultiGenerator *lg = + static_cast(this->LocalGenerators[i]); + cmGeneratorTargetsType tgts = lg->GetMakefile()->GetGeneratorTargets(); + this->UpdateBuildFiles(&tgts); + } + } + + cmDeleteAll(TargetFolderBuildStreams); + this->TargetFolderBuildStreams.clear(); +} + +void cmGlobalGhsMultiGenerator::GenerateBuildCommand( + std::vector &makeCommand, const std::string &makeProgram, + const std::string & /*projectName*/, const std::string & /*projectDir*/, + const std::string &targetName, const std::string & /*config*/, + bool /*fast*/, bool /*verbose*/, + std::vector const &makeOptions) +{ + makeCommand.push_back( + this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()) + ); + + makeCommand.insert(makeCommand.end(), + makeOptions.begin(), makeOptions.end()); + if (!targetName.empty()) + { + if (targetName == "clean") + { + makeCommand.push_back("-clean"); + } + else + { + makeCommand.push_back(targetName); + } + } +} + +void cmGlobalGhsMultiGenerator::WriteMacros() +{ + char const *ghsGpjMacros = + this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); + if (NULL != ghsGpjMacros) + { + std::vector expandedList; + cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList); + for (std::vector::const_iterator expandedListI = + expandedList.begin(); + expandedListI != expandedList.end(); ++expandedListI) + { + *this->GetBuildFileStream() << "macro " << *expandedListI << std::endl; + } + } +} + +void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() +{ + *this->GetBuildFileStream() << "primaryTarget=arm_integrity.tgt" + << std::endl; + char const *const customization = + this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); + if (NULL != customization && strlen(customization) > 0) + { + *this->GetBuildFileStream() << "customization=" + << trimQuotes(customization) + << std::endl; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); + } +} + +void cmGlobalGhsMultiGenerator::WriteCompilerOptions(std::string const &fOSDir) +{ + *this->GetBuildFileStream() << " -os_dir=\"" << fOSDir << "\"" + << std::endl; +} + +void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream *os) +{ + (*os) << "#" << std::endl + << "# CMAKE generated file: DO NOT EDIT!" << std::endl + << "# Generated by \"" << GetActualName() << "\"" + << " Generator, CMake Version " << cmVersion::GetMajorVersion() << "." + << cmVersion::GetMinorVersion() << std::endl + << "#" << std::endl; +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPath( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath) +{ + std::string workingPath(path); + cmSystemTools::ConvertToUnixSlashes(workingPath); + std::vector splitPath = + cmSystemTools::SplitString(workingPath); + std::string workingRelPath(relPath); + cmSystemTools::ConvertToUnixSlashes(workingRelPath); + if (!workingRelPath.empty()) + { + workingRelPath += "/"; + } + std::string pathUpTo; + for (std::vector::const_iterator splitPathI = + splitPath.begin(); + splitPath.end() != splitPathI; ++splitPathI) + { + pathUpTo += *splitPathI; + if (targetFolderBuildStreams->end() == + targetFolderBuildStreams->find(pathUpTo)) + { + AddFilesUpToPathNewBuildFile( + mainBuildFile, targetFolderBuildStreams, homeOutputDirectory, + pathUpTo, splitPath.begin() == splitPathI, workingRelPath, projType); + } + AddFilesUpToPathAppendNextFile(targetFolderBuildStreams, pathUpTo, + splitPathI, splitPath.end(), projType); + pathUpTo += "/"; + } +} + +void cmGlobalGhsMultiGenerator::Open( + std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap) +{ + if (fileMap->end() == fileMap->find(fileName)) + { + cmGeneratedFileStream *temp(new cmGeneratedFileStream); + temp->open(fileName.c_str()); + (*fileMap)[mapKeyName] = temp; + } +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool const isFirst, std::string const &relPath, + GhsMultiGpj::Types const projType) +{ + // create folders up to file path + std::string absPath = std::string(homeOutputDirectory) + "/" + relPath; + std::string newPath = absPath + pathUpTo; + if (!cmSystemTools::FileExists(newPath.c_str())) + { + cmSystemTools::MakeDirectory(newPath.c_str()); + } + + // Write out to filename for first time + std::string relFilename(GetFileNameFromPath(pathUpTo)); + std::string absFilename = absPath + relFilename; + Open(pathUpTo, absFilename, targetFolderBuildStreams); + OpenBuildFileStream((*targetFolderBuildStreams)[pathUpTo]); + GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); + WriteDisclaimer((*targetFolderBuildStreams)[pathUpTo]); + + // Add to main build file + if (isFirst) + { + *mainBuildFile << relFilename << " "; + GhsMultiGpj::WriteGpjTag(projType, mainBuildFile); + } +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( + std::map *targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types const projType) +{ + std::vector::const_iterator splitPathNextI = splitPathI + 1; + if (end != splitPathNextI && + targetFolderBuildStreams->end() == + targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) + { + std::string nextFilename(*splitPathNextI); + nextFilename = GetFileNameFromPath(nextFilename); + *(*targetFolderBuildStreams)[pathUpTo] << nextFilename << " "; + GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); + } +} + +std::string +cmGlobalGhsMultiGenerator::GetFileNameFromPath(std::string const &path) +{ + std::string output(path); + if (!path.empty()) + { + cmSystemTools::ConvertToUnixSlashes(output); + std::vector splitPath = cmSystemTools::SplitString(output); + output += "/" + splitPath.back() + FILE_EXTENSION; + } + return output; +} + +void cmGlobalGhsMultiGenerator::UpdateBuildFiles( + cmGeneratorTargetsType *tgts) +{ + for (cmGeneratorTargetsType::iterator tgtsI = tgts->begin(); + tgtsI != tgts->end(); ++tgtsI) + { + const cmTarget *tgt(tgtsI->first); + if (IsTgtForBuild(tgt)) + { + char const *rawFolderName = tgtsI->first->GetProperty("FOLDER"); + if (NULL == rawFolderName) + { + rawFolderName = ""; + } + std::string folderName(rawFolderName); + if (this->TargetFolderBuildStreams.end() == + this->TargetFolderBuildStreams.find(folderName)) + { + this->AddFilesUpToPath( + GetBuildFileStream(), &this->TargetFolderBuildStreams, + this->GetCMakeInstance()->GetHomeOutputDirectory(), folderName, + GhsMultiGpj::PROJECT); + } + std::vector splitPath = cmSystemTools::SplitString( + cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt)); + std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + + splitPath.back()); + *this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile + << " "; + GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag(tgt), + this->TargetFolderBuildStreams[folderName]); + } + } +} + +bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt) +{ + const std::string config = + tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); + std::vector tgtSources; + tgt->GetSourceFiles(tgtSources, config); + bool tgtInBuild = true; + char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); + if (NULL != excludeFromAll && '1' == excludeFromAll[0] && + '\0' == excludeFromAll[1]) + { + tgtInBuild = false; + } + return !tgtSources.empty() && tgtInBuild; +} + +std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const &str) +{ + std::string result; + result.reserve(str.size()); + for (const char *ch = str.c_str(); *ch != '\0'; ++ch) + { + if (*ch != '"') + { + result += *ch; + } + } + return result; +} diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h new file mode 100644 index 000000000..b934c3a10 --- /dev/null +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -0,0 +1,127 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + 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. +============================================================================*/ +#ifndef cmGhsMultiGenerator_h +#define cmGhsMultiGenerator_h + +#include "cmGlobalGeneratorFactory.h" +#include "cmGlobalGenerator.h" +#include "cmGhsMultiGpj.h" + +class cmGeneratedFileStream; + +class cmGlobalGhsMultiGenerator : public cmGlobalGenerator +{ +public: + /// The default name of GHS MULTI's build file. Typically: monolith.gpj. + static const char *FILE_EXTENSION; + + cmGlobalGhsMultiGenerator(); + ~cmGlobalGhsMultiGenerator(); + + static cmGlobalGeneratorFactory *NewFactory() + { return new cmGlobalGeneratorSimpleFactory(); } + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /// @return the name of this generator. + static std::string GetActualName() { return "Green Hills MULTI"; } + ///! Get the name for this generator + virtual std::string GetName() const { return this->GetActualName(); } + + /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() + static void GetDocumentation(cmDocumentationEntry &entry); + + /** + * Try to determine system information such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector const &languages, + cmMakefile *, bool optional); + /* + * Determine what program to use for building the project. + */ + virtual void FindMakeProgram(cmMakefile *); + + cmGeneratedFileStream *GetBuildFileStream() + { + return this->TargetFolderBuildStreams[""]; + } + + static void OpenBuildFileStream(std::string const &filepath, + cmGeneratedFileStream **filestream); + static void OpenBuildFileStream(cmGeneratedFileStream *filestream); + static void CloseBuildFileStream(cmGeneratedFileStream **filestream); + /// Write the common disclaimer text at the top of each build file. + static void WriteDisclaimer(std::ostream *os); + std::vector GetLibDirs() { return this->LibDirs; } + + static void AddFilesUpToPath( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath = ""); + static void Open(std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap); + + static std::string trimQuotes(std::string const &str); + inline bool IsOSDirRelative() { return this->OSDirRelative; } + +protected: + virtual void Generate(); + virtual void GenerateBuildCommand( + std::vector &makeCommand, const std::string &makeProgram, + const std::string &projectName, const std::string &projectDir, + const std::string &targetName, const std::string &config, bool fast, + bool verbose, + std::vector const& makeOptions = std::vector() + ); + +private: + std::string const &GetGhsBuildCommand(); + std::string FindGhsBuildCommand(); + std::string GetCompRoot(); + std::vector GetCompRootHardPaths(); + std::vector GetCompRootRegistry(); + void OpenBuildFileStream(); + + void WriteMacros(); + void WriteHighLevelDirectives(); + void WriteCompilerOptions(std::string const &fOSDir); + + static void AddFilesUpToPathNewBuildFile( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool isFirst, std::string const &relPath, GhsMultiGpj::Types projType); + static void AddFilesUpToPathAppendNextFile( + std::map *targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types projType); + static std::string GetFileNameFromPath(std::string const &path); + void UpdateBuildFiles(cmGeneratorTargetsType *tgts); + bool IsTgtForBuild(const cmTarget *tgt); + + std::vector TargetSubProjects; + std::map TargetFolderBuildStreams; + + std::vector LibDirs; + + bool OSDirRelative; + bool GhsBuildCommandInitialized; + std::string GhsBuildCommand; + static const char *DEFAULT_MAKE_PROGRAM; +}; + +#endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f74f1e065..2ade82556 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -576,6 +576,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; // Implemented by: // cmGlobalUnixMakefileGenerator3 +// cmGlobalGhsMultiGenerator // cmGlobalVisualStudio10Generator // cmGlobalVisualStudio6Generator // cmGlobalVisualStudio7Generator diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx new file mode 100644 index 000000000..782fec4a8 --- /dev/null +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -0,0 +1,55 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmLocalGhsMultiGenerator.h" +#include "cmGlobalGhsMultiGenerator.h" +#include "cmGeneratorTarget.h" +#include "cmMakefile.h" +#include "cmGhsMultiTargetGenerator.h" +#include "cmGeneratedFileStream.h" + +cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator() +{ +} + +cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {} + +void cmLocalGhsMultiGenerator::Generate() +{ + cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets(); + if (!tgts.empty()) + { + for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); + ++l) + { + cmGhsMultiTargetGenerator tg(l->second->Target); + tg.Generate(); + } + } +} + +// Implemented in: +// cmLocalGenerator. +// Used in: +// Source/cmMakefile.cxx +// Source/cmGlobalGenerator.cxx +void cmLocalGhsMultiGenerator::Configure() +{ + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + if (this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + this->cmLocalGenerator::Configure(); +} diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h new file mode 100644 index 000000000..a8df3e7aa --- /dev/null +++ b/Source/cmLocalGhsMultiGenerator.h @@ -0,0 +1,56 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + 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. +============================================================================*/ +#ifndef cmLocalGhsMultiGenerator_h +#define cmLocalGhsMultiGenerator_h + +#include "cmLocalGenerator.h" + +class cmGeneratedFileStream; + +/** \class cmLocalGhsMultiGenerator + * \brief Write Green Hills MULTI project files. + * + * cmLocalGhsMultiGenerator produces a set of .gpj + * file for each target in its mirrored directory. + */ +class cmLocalGhsMultiGenerator : public cmLocalGenerator +{ +public: + cmLocalGhsMultiGenerator(); + + virtual ~cmLocalGhsMultiGenerator(); + + /// @returns the relative path between the HomeOutputDirectory and this + /// local generators StartOutputDirectory. + std::string GetHomeRelativeOutputPath() const + { + return this->HomeRelativeOutputPath; + } + + /** + * Generate the makefile for this directory. + */ + virtual void Generate(); + + /// Overloaded methods. @see cmLocalGenerator::Configure() + virtual void Configure(); + const char *GetBuildFileName() { return this->BuildFileName.c_str(); } + +protected: + virtual bool CustomCommandUseLocal() const { return true; } + +private: + std::string BuildFileName; + std::string HomeRelativeOutputPath; +}; + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c52a1a2d..bfe9aea35 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,6 +63,7 @@ # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" +# include "cmGlobalGhsMultiGenerator.h" # define CMAKE_HAVE_VS_GENERATORS # endif # include "cmGlobalMSYSMakefileGenerator.h" @@ -1840,6 +1841,8 @@ void cmake::AddDefaultGenerators() cmGlobalNMakeMakefileGenerator::NewFactory()); this->Generators.push_back( cmGlobalJOMMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalGhsMultiGenerator::NewFactory()); # endif this->Generators.push_back( cmGlobalMSYSMakefileGenerator::NewFactory()); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f80191b46..83c919d19 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1978,6 +1978,23 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if (CMake_TEST_GreenHillsMULTI) + macro(add_test_GhsMulti name primaryTarget bspName) + add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/GhsMulti" + "${CMake_BINARY_DIR}/Tests/GhsMulti/${name}" + --build-generator "Green Hills MULTI" + --build-project ReturnNum + --build-config $ + --build-options -DGHS_PRIMARY_TARGET=${primaryTarget} + -DGHS_BSP_NAME=${bspName} + ) + endmacro () + add_test_GhsMulti("arm_integrity_simarm" "arm_integrity.tgt" "simarm") + add_test_GhsMulti("arm64_integrity_simarm" "arm64_integrity.tgt" "simarm") + endif () + if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} diff --git a/Tests/GhsMulti/CMakeLists.txt b/Tests/GhsMulti/CMakeLists.txt new file mode 100644 index 000000000..6e15ba9a7 --- /dev/null +++ b/Tests/GhsMulti/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(ReturnNum) + +add_subdirectory(ReturnNum) diff --git a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt new file mode 100644 index 000000000..2adbd4e3d --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt @@ -0,0 +1,4 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Lib) +add_executable(App Main.c) +target_link_libraries(App Lib) +target_compile_options(App PUBLIC "-non_shared") diff --git a/Tests/GhsMulti/ReturnNum/App/Main.c b/Tests/GhsMulti/ReturnNum/App/Main.c new file mode 100644 index 000000000..1133834d8 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/App/Main.c @@ -0,0 +1,8 @@ +#include "HelperFun.h" + +int main(int argc, const char* argv[]) +{ + int out; + out = giveNum(); + return out; +} diff --git a/Tests/GhsMulti/ReturnNum/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/CMakeLists.txt new file mode 100644 index 000000000..7bcc5f96a --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(App) +add_subdirectory(Int) +add_subdirectory(Lib) diff --git a/Tests/GhsMulti/ReturnNum/Int/AppDD.int b/Tests/GhsMulti/ReturnNum/Int/AppDD.int new file mode 100644 index 000000000..9e22b5e25 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/AppDD.int @@ -0,0 +1,12 @@ +# Input File for the Integrate utility for use with the INTEGRITY real-time +# operating system by Green Hills Software. +# Before editing this file, refer to the Integrate Reference Manual. + +Kernel + Filename DynamicDownload +EndKernel + +AddressSpace App + Filename "App/App.as" + Language C +EndAddressSpace diff --git a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt new file mode 100644 index 000000000..44c5de1c5 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(AppDD AppDD.int Default.bsp) diff --git a/Tests/GhsMulti/ReturnNum/Int/Default.bsp b/Tests/GhsMulti/ReturnNum/Int/Default.bsp new file mode 100644 index 000000000..224ec2906 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/Default.bsp @@ -0,0 +1,35 @@ +# Target description File for the Integrate utility for use with the +# INTEGRITY real-time operating system by Green Hills Software. +# Before editing this file, refer to your Integrate documentation. +# default.bsp is appropriate for INTEGRITY applications which are +# fully linked with the kernel (for RAM or ROM) or dynamically downloaded. +# +# MinimumAddress must match the value of .ramend in the linker directives +# file used for the KernelSpace program - see default.ld for more info. +# The MaximumAddress used here allows memory mappings to be specified +# for up to the 16 MB mark in RAM. Intex will not permit programs +# that require more memory for its mappings. If the board has less +# memory, this number can be reduced by the user. + +Target + MinimumAddress .ramend + MaximumAddress .ramlimit + Clock StandardTick + EndClock + Clock HighResTimer + EndClock + IODevice "SerialDev0" + InitialKernelObjects 200 + DefaultStartIt false + DefaultMaxPriority 255 + DefaultPriority 127 + DefaultWeight 1 + DefaultMaxWeight 255 + DefaultHeapSize 0x10000 + LastVirtualAddress 0x3fffffff + PageSize 0x1000 + ArchitectedPageSize 0x1000 + ArchitectedPageSize 0x10000 + ArchitectedPageSize 0x100000 + DefaultMemoryRegionSize 0x20000 +EndTarget diff --git a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt new file mode 100644 index 000000000..9c822da56 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt @@ -0,0 +1 @@ +add_library(Lib HelperFun.c HelperFun.h) \ No newline at end of file diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c new file mode 100644 index 000000000..d7515d7da --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c @@ -0,0 +1,4 @@ +int giveNum(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h new file mode 100644 index 000000000..00971b04f --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h @@ -0,0 +1 @@ +int giveNum(void); From 66b641f443a1d3fc8b5f74233307ba9b0929d340 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Apr 2015 09:51:46 -0400 Subject: [PATCH 0604/1029] Help: Add notes for topic 'add-GreenHills-MULTI-generator' --- Help/release/dev/add-GreenHills-MULTI-generator.rst | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Help/release/dev/add-GreenHills-MULTI-generator.rst diff --git a/Help/release/dev/add-GreenHills-MULTI-generator.rst b/Help/release/dev/add-GreenHills-MULTI-generator.rst new file mode 100644 index 000000000..b4c5c5ad3 --- /dev/null +++ b/Help/release/dev/add-GreenHills-MULTI-generator.rst @@ -0,0 +1,8 @@ +add-GreenHills-MULTI-generator +------------------------------ + +* A new experimental :generator:`Green Hills MULTI` generator was + added on Windows. `Green Hills MULTI`_ is an IDE for embedded + real-time systems. + +.. _`Green Hills MULTI`: http://www.ghs.com/products/MULTI_IDE.html From cd953bf7a06fd9d96aaa5d70509535a3ba9ce665 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Apr 2015 14:42:02 -0400 Subject: [PATCH 0605/1029] Help: Add notes for topic 'cpack-rpm-refactored-file-listing' --- Help/release/dev/cpack-rpm-refactored-file-listing.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/cpack-rpm-refactored-file-listing.rst diff --git a/Help/release/dev/cpack-rpm-refactored-file-listing.rst b/Help/release/dev/cpack-rpm-refactored-file-listing.rst new file mode 100644 index 000000000..b4a502546 --- /dev/null +++ b/Help/release/dev/cpack-rpm-refactored-file-listing.rst @@ -0,0 +1,6 @@ +cpack-rpm-refactored-file-listing +--------------------------------- + +* The :module:`CPackRPM` module learned a new + :variable:`CPACK_RPM_ADDITIONAL_MAN_DIRS` variable to specify + directories containing man pages for the brp-compress RPM macro. From 0ed22502a6057f989bc7855a5a69e5171e013048 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Thu, 16 Apr 2015 10:27:23 -0600 Subject: [PATCH 0606/1029] FindCUDA: Create output dir while compiling intermediate link file (#15016) During compilation of the intermediate link file, the output directory may not be present in Visual Studio builds. This fix makes sure the output directory exists before generating the output file. Suggested-by: Irwin Zaid --- Modules/FindCUDA.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 1802e61ef..e8e1fb13d 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1585,10 +1585,12 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMENT "Building NVCC intermediate link file ${output_file_relative_path}" ) else() + get_filename_component(output_file_dir "${output_file}" DIRECTORY) add_custom_command( TARGET ${cuda_target} PRE_LINK COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}" COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" ) endif() From 356c26ebdfa053f59b2932c78ae81cba3c872dc3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Apr 2015 15:36:57 -0400 Subject: [PATCH 0607/1029] cmSystemTools: Teach RunSingleCommand to separate stdout and stderr Extend the RunSingleCommand signature to capture stdout and stderr separately. Allow both to be captured to the same std::string to preserve existing behavior. Update all call sites to do this so that this refactoring does not introduce functional changes. --- Source/CPack/IFW/cmCPackIFWGenerator.cxx | 6 +- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 3 +- Source/CPack/cmCPackDebGenerator.cxx | 6 +- Source/CPack/cmCPackDragNDropGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.cxx | 5 +- Source/CPack/cmCPackNSISGenerator.cxx | 12 ++-- Source/CPack/cmCPackOSXX11Generator.cxx | 6 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 11 ++-- Source/CTest/cmCTestScriptHandler.cxx | 12 ++-- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmBuildNameCommand.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 4 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 4 +- Source/cmQtAutoGenerators.cxx | 11 ++-- Source/cmSiteNameCommand.cxx | 2 +- Source/cmSystemTools.cxx | 63 +++++++++++++------ Source/cmSystemTools.h | 7 ++- Source/cmTryRunCommand.cxx | 2 +- Source/cmcldeps.cxx | 5 +- Source/cmcmd.cxx | 8 +-- Tests/CMakeLib/run_compile_commands.cxx | 2 +- 23 files changed, 110 insertions(+), 69 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 7f06e2d8a..0439ff642 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -92,7 +92,8 @@ int cmCPackIFWGenerator::PackageFiles() cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate repository" << std::endl); bool res = cmSystemTools::RunSingleCommand( - ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); + ifwCmd.c_str(), &output, &output, + &retVal, 0, this->GeneratorVerbose, 0); if ( !res || retVal ) { cmGeneratedFileStream ofs(ifwTmpFile.c_str()); @@ -176,7 +177,8 @@ int cmCPackIFWGenerator::PackageFiles() int retVal = 1; cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl); bool res = cmSystemTools::RunSingleCommand( - ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0); + ifwCmd.c_str(), &output, &output, + &retVal, 0, this->GeneratorVerbose, 0); if ( !res || retVal ) { cmGeneratedFileStream ofs(ifwTmpFile.c_str()); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 99eabf20f..b3eb7b2fc 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -64,7 +64,8 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) std::string output; int returnValue = 0; - bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output, + bool status = cmSystemTools::RunSingleCommand( + command.c_str(), &output, &output, &returnValue, 0, cmSystemTools::OUTPUT_NONE); cmsys::ofstream logFile(logFileName.c_str(), std::ios::app); diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index fcf41229d..fa02a3b75 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -466,7 +466,7 @@ int cmCPackDebGenerator::createDeb() std::string output; int retval = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, + int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, &retval, this->GetOption("WDIR"), this->GeneratorVerbose, 0); if ( !res || retval ) @@ -505,7 +505,7 @@ int cmCPackDebGenerator::createDeb() cmd += "\""; //std::string output; //int retVal = -1; - res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, + res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, &retval, toplevel.c_str(), this->GeneratorVerbose, 0); if ( !res || retval ) { @@ -553,7 +553,7 @@ int cmCPackDebGenerator::createDeb() } } } - res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, + res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, &retval, this->GetOption("WDIR"), this->GeneratorVerbose, 0); if ( !res || retval ) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 5da923423..4c400d9ca 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -197,7 +197,7 @@ bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command, bool result = cmSystemTools::RunSingleCommand( command.str().c_str(), - output, + output, output, &exit_code, 0, this->GeneratorVerbose, diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 2b18c4158..e254e9a84 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -290,7 +290,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( << std::endl); std::string output; int retVal = 1; - bool resB = cmSystemTools::RunSingleCommand(it->c_str(), &output, + bool resB = cmSystemTools::RunSingleCommand( + it->c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0); if ( !resB || retVal ) { @@ -668,7 +669,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( int retVal = 1; bool resB = cmSystemTools::RunSingleCommand(buildCommand.c_str(), - &output, + &output, &output, &retVal, installDirectory.c_str(), this->GeneratorVerbose, 0); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index fe6cc956b..2de2bc4a6 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -324,7 +324,7 @@ int cmCPackNSISGenerator::PackageFiles() << std::endl); std::string output; int retVal = 1; - bool res = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, + bool res = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0); if ( !res || retVal ) { @@ -430,8 +430,8 @@ int cmCPackNSISGenerator::InitializeInternal() << nsisCmd << std::endl); std::string output; int retVal = 1; - bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), - &output, &retVal, 0, this->GeneratorVerbose, 0); + bool resS = cmSystemTools::RunSingleCommand( + nsisCmd.c_str(), &output, &output, &retVal, 0, this->GeneratorVerbose, 0); cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)"); cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs"); if ( !resS || retVal || @@ -836,9 +836,9 @@ CreateComponentDescription(cmCPackComponent *component, zipListFileName.c_str()); std::string output; int retVal = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retVal, - dirName.c_str(), - cmSystemTools::OUTPUT_NONE, 0); + int res = cmSystemTools::RunSingleCommand( + cmd.c_str(), &output, &output, + &retVal, dirName.c_str(), cmSystemTools::OUTPUT_NONE, 0); if ( !res || retVal ) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 313e08b30..d533af87a 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -180,9 +180,9 @@ int cmCPackOSXX11Generator::PackageFiles() bool res = false; while(numTries > 0) { - res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, - this->GeneratorVerbose, 0); + res = cmSystemTools::RunSingleCommand( + dmgCmd.str().c_str(), &output, &output, + &retVal, 0, this->GeneratorVerbose, 0); if ( res && !retVal ) { numTries = -1; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index dfe35c9a5..880663f7e 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -378,9 +378,9 @@ int cmCPackPackageMakerGenerator::PackageFiles() bool res = false; while(numTries > 0) { - res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output, - &retVal, 0, this->GeneratorVerbose, - 0); + res = cmSystemTools::RunSingleCommand( + dmgCmd.str().c_str(), &output, &output, + &retVal, 0, this->GeneratorVerbose, 0); if ( res && !retVal ) { numTries = -1; @@ -657,8 +657,9 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char *command, cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl); std::string output; int retVal = 1; - bool res = cmSystemTools::RunSingleCommand(command, &output, &retVal, 0, - this->GeneratorVerbose, 0); + bool res = cmSystemTools::RunSingleCommand( + command, &output, &output, + &retVal, 0, this->GeneratorVerbose, 0); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker" << std::endl); if ( !res || retVal ) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 7f9825c17..d1e7e3a62 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -709,7 +709,8 @@ int cmCTestScriptHandler::CheckOutSourceDir() output = ""; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run cvs: " << this->CVSCheckOut << std::endl); - res = cmSystemTools::RunSingleCommand(this->CVSCheckOut.c_str(), &output, + res = cmSystemTools::RunSingleCommand( + this->CVSCheckOut.c_str(), &output, &output, &retVal, this->CTestRoot.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); if (!res || retVal != 0) @@ -789,7 +790,8 @@ int cmCTestScriptHandler::PerformExtraUpdates() retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run Update: " << fullCommand << std::endl); - res = cmSystemTools::RunSingleCommand(fullCommand.c_str(), &output, + res = cmSystemTools::RunSingleCommand( + fullCommand.c_str(), &output, &output, &retVal, cvsArgs[0].c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); if (!res || retVal != 0) @@ -910,7 +912,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run cmake command: " << command << std::endl); - res = cmSystemTools::RunSingleCommand(command.c_str(), &output, + res = cmSystemTools::RunSingleCommand( + command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -956,7 +959,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run ctest command: " << command << std::endl); - res = cmSystemTools::RunSingleCommand(command.c_str(), &output, + res = cmSystemTools::RunSingleCommand( + command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index d77825374..95cdf3b51 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1334,7 +1334,7 @@ int cmCTestTestHandler::ExecuteCommands(std::vector& vec) int retVal = 0; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it << std::endl, this->Quiet); - if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, + if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, 0, &retVal, 0, cmSystemTools::OUTPUT_MERGE /*this->Verbose*/) || retVal != 0 ) { diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 2a0657414..2733d7677 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -49,7 +49,7 @@ bool cmBuildNameCommand if(this->Makefile->GetDefinition("UNIX")) { buildname = ""; - cmSystemTools::RunSingleCommand("uname -a", &buildname); + cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname); if(!buildname.empty()) { std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) "; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 2aa4d935c..24043af44 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1163,7 +1163,7 @@ cmExtraEclipseCDT4Generator::GetEclipsePath(const std::string& path) #if defined(__CYGWIN__) std::string cmd = "cygpath -m " + path; std::string out; - if (!cmSystemTools::RunSingleCommand(cmd.c_str(), &out)) + if (!cmSystemTools::RunSingleCommand(cmd.c_str(), &out, &out)) { return path; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4a9f62803..4b0ef582b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1737,7 +1737,7 @@ int cmGlobalGenerator::Build( output += cmSystemTools::PrintSingleCommand(cleanCommand); output += "\n"; - if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr, + if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr, outputPtr, &retVal, 0, outputflag, timeout)) { cmSystemTools::SetRunCommandHideConsole(hideconsole); @@ -1758,7 +1758,7 @@ int cmGlobalGenerator::Build( output += makeCommandStr; output += "\n"; - if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr, + if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr, outputPtr, &retVal, 0, outputflag, timeout)) { cmSystemTools::SetRunCommandHideConsole(hideconsole); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 505914e2f..79a7914b4 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1233,7 +1233,7 @@ std::string cmGlobalNinjaGenerator::ninjaVersion() const std::string version; std::string command = ninjaCmd() + " --version"; cmSystemTools::RunSingleCommand(command.c_str(), - &version, 0, 0, + &version, 0, 0, 0, cmSystemTools::OUTPUT_NONE); return version; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8c373386f..04befee09 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -164,8 +164,8 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory { std::string out; std::string::size_type pos; - if(cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0, 0, - cmSystemTools::OUTPUT_NONE) && + if(cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0, + 0, 0, cmSystemTools::OUTPUT_NONE) && (pos = out.find(".app/"), pos != out.npos)) { versionFile = out.substr(0, pos+5)+"Contents/version.plist"; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 3d5103f72..329f9de24 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -188,7 +188,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf, std::string output; int retVal = 0; - bool result = cmSystemTools::RunSingleCommand(command, &output, + bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal, 0, cmSystemTools::OUTPUT_NONE); if (!result || retVal) @@ -2196,7 +2196,8 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, std::string output; int retVal = 0; - bool result = cmSystemTools::RunSingleCommand(command, &output, &retVal); + bool result = cmSystemTools::RunSingleCommand(command, &output, &output, + &retVal); if (!result || retVal) { std::cerr << "AUTOGEN: error: process for " << mocFilePath <<" failed:\n" @@ -2265,7 +2266,8 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, } std::string output; int retVal = 0; - bool result = cmSystemTools::RunSingleCommand(command, &output, &retVal); + bool result = cmSystemTools::RunSingleCommand(command, &output, &output, + &retVal); if (!result || retVal) { std::cerr << "AUTOUIC: error: process for " << ui_output_file << @@ -2355,7 +2357,8 @@ bool cmQtAutoGenerators::GenerateQrc() } std::string output; int retVal = 0; - bool result = cmSystemTools::RunSingleCommand(command, &output, &retVal); + bool result = cmSystemTools::RunSingleCommand(command, &output, &output, + &retVal); if (!result || retVal) { std::cerr << "AUTORCC: error: process for " << rcc_output_file << diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 20a61a046..e2970e505 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -63,7 +63,7 @@ bool cmSiteNameCommand { std::string host; cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), - &host, 0, 0, cmSystemTools::OUTPUT_NONE); + &host, 0, 0, 0, cmSystemTools::OUTPUT_NONE); // got the hostname if (!host.empty()) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 95d05a65b..0e0532d33 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -659,7 +659,8 @@ std::vector cmSystemTools::ParseArguments(const char* command) bool cmSystemTools::RunSingleCommand(std::vectorconst& command, - std::string* output , + std::string* captureStdOut, + std::string* captureStdErr, int* retVal , const char* dir , OutputOption outputflag , double timeout ) @@ -671,9 +672,13 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, argv.push_back(a->c_str()); } argv.push_back(0); - if ( output ) + if ( captureStdOut ) { - *output = ""; + *captureStdOut = ""; + } + if (captureStdErr && captureStdErr != captureStdOut) + { + *captureStdErr = ""; } cmsysProcess* cp = cmsysProcess_New(); @@ -693,15 +698,17 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, cmsysProcess_SetTimeout(cp, timeout); cmsysProcess_Execute(cp); - std::vector tempOutput; + std::vector tempStdOut; + std::vector tempStdErr; char* data; int length; int pipe; - if(outputflag != OUTPUT_PASSTHROUGH && (output || outputflag != OUTPUT_NONE)) + if(outputflag != OUTPUT_PASSTHROUGH && + (captureStdOut || captureStdErr || outputflag != OUTPUT_NONE)) { while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0) { - if(output || outputflag != OUTPUT_NONE) + if(captureStdOut || captureStdErr || outputflag != OUTPUT_NONE) { // Translate NULL characters in the output into valid text. // Visual Studio 7 puts these characters in the output of its @@ -714,9 +721,21 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, } } } - if ( output ) + if(pipe == cmsysProcess_Pipe_STDOUT || + (pipe == cmsysProcess_Pipe_STDERR && + captureStdOut == captureStdErr)) { - tempOutput.insert(tempOutput.end(), data, data+length); + if (captureStdOut) + { + tempStdOut.insert(tempStdOut.end(), data, data+length); + } + } + else if(pipe == cmsysProcess_Pipe_STDERR) + { + if (captureStdErr) + { + tempStdErr.insert(tempStdErr.end(), data, data+length); + } } if(outputflag != OUTPUT_NONE) { @@ -740,9 +759,14 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, } cmsysProcess_WaitForExit(cp, 0); - if ( output && tempOutput.begin() != tempOutput.end()) + if ( captureStdOut && tempStdOut.begin() != tempStdOut.end()) { - output->append(&*tempOutput.begin(), tempOutput.size()); + captureStdOut->append(&*tempStdOut.begin(), tempStdOut.size()); + } + if ( captureStdErr && captureStdErr != captureStdOut && + tempStdErr.begin() != tempStdErr.end()) + { + captureStdErr->append(&*tempStdErr.begin(), tempStdErr.size()); } bool result = true; @@ -767,9 +791,9 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { std::cerr << exception_str << std::endl; } - if ( output ) + if ( captureStdErr ) { - output->append(exception_str, strlen(exception_str)); + captureStdErr->append(exception_str, strlen(exception_str)); } result = false; } @@ -780,9 +804,9 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { std::cerr << error_str << std::endl; } - if ( output ) + if ( captureStdErr ) { - output->append(error_str, strlen(error_str)); + captureStdErr->append(error_str, strlen(error_str)); } result = false; } @@ -793,9 +817,9 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { std::cerr << error_str << std::endl; } - if ( output ) + if ( captureStdErr ) { - output->append(error_str, strlen(error_str)); + captureStdErr->append(error_str, strlen(error_str)); } result = false; } @@ -806,7 +830,8 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, bool cmSystemTools::RunSingleCommand( const char* command, - std::string* output, + std::string* captureStdOut, + std::string* captureStdErr, int *retVal, const char* dir, OutputOption outputflag, @@ -823,8 +848,8 @@ bool cmSystemTools::RunSingleCommand( { return false; } - return cmSystemTools::RunSingleCommand(args, output,retVal, - dir, outputflag, timeout); + return cmSystemTools::RunSingleCommand(args, captureStdOut, captureStdErr, + retVal, dir, outputflag, timeout); } std::string diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 433ef46c1..6feb6c5bf 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -223,7 +223,9 @@ public: OUTPUT_NORMAL, OUTPUT_PASSTHROUGH }; - static bool RunSingleCommand(const char* command, std::string* output = 0, + static bool RunSingleCommand(const char* command, + std::string* captureStdOut = 0, + std::string* captureStdErr = 0, int* retVal = 0, const char* dir = 0, OutputOption outputflag = OUTPUT_MERGE, double timeout = 0.0); @@ -233,7 +235,8 @@ public: * be in comand[1]...command[command.size()] */ static bool RunSingleCommand(std::vector const& command, - std::string* output = 0, + std::string* captureStdOut = 0, + std::string* captureStdErr = 0, int* retVal = 0, const char* dir = 0, OutputOption outputflag = OUTPUT_MERGE, double timeout = 0.0); diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index c9e7a4689..3cd92cb8e 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -224,7 +224,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, } int timeout = 0; bool worked = cmSystemTools::RunSingleCommand(finalCommand.c_str(), - out, &retVal, + out, out, &retVal, 0, cmSystemTools::OUTPUT_NONE, timeout); // set the run var char retChar[1000]; diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 55fc6338a..f3c6059b1 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -206,8 +206,9 @@ static int process( const std::string& srcfilename, } // run the command int exit_code = 0; - bool run = cmSystemTools::RunSingleCommand(command, &output, &exit_code, - dir.c_str(), cmSystemTools::OUTPUT_NONE); + bool run = cmSystemTools::RunSingleCommand(command, &output, &output, + &exit_code, dir.c_str(), + cmSystemTools::OUTPUT_NONE); // process the include directives and output everything else std::stringstream ss(output); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2ef04efdf..5e5695789 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -267,7 +267,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::vector cmd(ai, ae); int retval; if(cmSystemTools::RunSingleCommand( - cmd, 0, &retval, NULL, cmSystemTools::OUTPUT_PASSTHROUGH)) + cmd, 0, 0, &retval, NULL, cmSystemTools::OUTPUT_PASSTHROUGH)) { return retval; } @@ -398,7 +398,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) time(&time_start); clock_start = clock(); int ret =0; - cmSystemTools::RunSingleCommand(command.c_str(), 0, &ret); + cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &ret); clock_finish = clock(); time(&time_finish); @@ -454,7 +454,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::string command = cmWrap('"', cmRange(args).advance(3), '"', " "); int retval = 0; int timeout = 0; - if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, + if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval, directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) ) { return retval; @@ -1350,7 +1350,7 @@ bool cmcmd::RunCommand(const char* comment, int retCode =0; // use rc command to create .res file cmSystemTools::RunSingleCommand(command, - &output, + &output, &output, &retCode, 0, cmSystemTools::OUTPUT_NONE); // always print the output of the command, unless // it is the dumb rc command banner, but if the command diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index 279bcd587..26ab223dc 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -130,7 +130,7 @@ int main () std::vector command; cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command); if (!cmSystemTools::RunSingleCommand( - command, 0, 0, it->at("directory").c_str())) + command, 0, 0, 0, it->at("directory").c_str())) { std::cout << "ERROR: Failed to run command \"" << command[0] << "\"" << std::endl; From 3a68c323ba4b9f269fe9fe45fc2a1bcc2de4ac89 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 00:19:35 +0200 Subject: [PATCH 0608/1029] cmMakefile: Fix wrong parameter names. --- Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7be920d6c..6c2b8b207 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3408,9 +3408,9 @@ const char* cmMakefile::GetHomeOutputDirectory() const return this->HomeOutputDirectory.c_str(); } -void cmMakefile::SetHomeOutputDirectory(const std::string& lib) +void cmMakefile::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = lib; + this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory()); if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") ) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 73d6910a9..8da2ccdd3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -441,7 +441,7 @@ public: */ void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const; - void SetHomeOutputDirectory(const std::string& lib); + void SetHomeOutputDirectory(const std::string& dir); const char* GetHomeOutputDirectory() const; //@} @@ -476,9 +476,9 @@ public: { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const std::string& lib) + void SetStartOutputDirectory(const std::string& dir) { - this->StartOutputDirectory = lib; + this->StartOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); this->StartOutputDirectory = cmSystemTools::CollapseFullPath(this->StartOutputDirectory); From f034bb2f54f784461ed1adea8f0554d49ff5b0b3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 12 Apr 2015 18:54:42 +0200 Subject: [PATCH 0609/1029] Remove redundant calls to MakeStartDirectoriesCurrent. The SetStart{,Output}Directory methods do what it does. --- Source/cmGlobalGenerator.cxx | 1 - Source/cmGlobalUnixMakefileGenerator3.cxx | 1 - Source/cmcmd.cxx | 1 - 3 files changed, 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4a9f62803..0492a4c7f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1103,7 +1103,6 @@ void cmGlobalGenerator::Configure() (this->CMakeInstance->GetStartDirectory()); lg->GetMakefile()->SetStartOutputDirectory (this->CMakeInstance->GetStartOutputDirectory()); - lg->GetMakefile()->MakeStartDirectoriesCurrent(); this->BinaryDirectories.insert(mf->GetStartOutputDirectory()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 22d633cb7..3deaec2e4 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -587,7 +587,6 @@ void cmGlobalUnixMakefileGenerator3 (this->CMakeInstance->GetStartDirectory()); lg->GetMakefile()->SetStartOutputDirectory (this->CMakeInstance->GetStartOutputDirectory()); - lg->GetMakefile()->MakeStartDirectoriesCurrent(); } std::string tname = targetName; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2ef04efdf..db85b596a 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -651,7 +651,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) cmsys::auto_ptr lgd(ggd->CreateLocalGenerator()); lgd->GetMakefile()->SetStartDirectory(startDir); lgd->GetMakefile()->SetStartOutputDirectory(startOutDir); - lgd->GetMakefile()->MakeStartDirectoriesCurrent(); // Actually scan dependencies. return lgd->UpdateDependencies(depInfo.c_str(), From 1ea085d1b62f02d4e556ce1fabb0589e30108e20 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 22:18:04 +0200 Subject: [PATCH 0610/1029] cmMakefile: Initialize dir definitions early. --- Source/cmMakefile.cxx | 6 +++++- Source/cmMakefile.h | 8 -------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6c2b8b207..23c2e4828 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1543,6 +1543,11 @@ void cmMakefile::InitializeFromParent() // Initialize definitions with the closure of the parent scope. this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure(); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", + this->cmStartDirectory.c_str()); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", + this->StartOutputDirectory.c_str()); + const std::vector& parentIncludes = parent->GetIncludeDirectoriesEntries(); this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(), @@ -1611,7 +1616,6 @@ void cmMakefile::InitializeFromParent() void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) { lg2->GetMakefile()->InitializeFromParent(); - lg2->GetMakefile()->MakeStartDirectoriesCurrent(); if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Entering "; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8da2ccdd3..356e4c281 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -423,14 +423,6 @@ public: bool HasCMP0054AlreadyBeenReported( cmListFileContext context) const; - void MakeStartDirectoriesCurrent() - { - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->cmStartDirectory.c_str()); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->StartOutputDirectory.c_str()); - } - //@{ /** * Set/Get the home directory (or output directory) in the project. The From d67e8f24b89b70782c977b4db628377be875f938 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 00:39:33 +0200 Subject: [PATCH 0611/1029] cmake: Fix directory used to find the cache The start and home directories are the same, but the intent of the code here is to use what is currently called the HomeOutput directory. --- Source/cmake.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d113c9f38..bf05b18d3 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1189,7 +1189,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) } // remove the cache - this->CacheManager->DeleteCache(this->GetStartOutputDirectory()); + this->CacheManager->DeleteCache(this->GetHomeOutputDirectory()); // load the empty cache this->LoadCache(); // restore the changed compilers From 044dc81504e0d34d7c84a20d333b2177a2c86b54 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 00:50:59 +0200 Subject: [PATCH 0612/1029] Use the Home directories from the cmake class where intended. --- Source/cmGlobalGenerator.cxx | 10 +++++----- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 0492a4c7f..786f8fa98 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1098,13 +1098,13 @@ void cmGlobalGenerator::Configure() this->LocalGenerators.push_back(lg); // set the Start directories - cmMakefile* mf = lg->GetMakefile(); lg->GetMakefile()->SetStartDirectory - (this->CMakeInstance->GetStartDirectory()); + (this->CMakeInstance->GetHomeDirectory()); lg->GetMakefile()->SetStartOutputDirectory - (this->CMakeInstance->GetStartOutputDirectory()); + (this->CMakeInstance->GetHomeOutputDirectory()); - this->BinaryDirectories.insert(mf->GetStartOutputDirectory()); + this->BinaryDirectories.insert( + this->CMakeInstance->GetHomeOutputDirectory()); // now do it lg->Configure(); @@ -3069,7 +3069,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile() std::vector configs; std::string config = mf->GetConfigurations(configs, false); - std::string path = this->CMakeInstance->GetStartOutputDirectory(); + std::string path = this->CMakeInstance->GetHomeOutputDirectory(); path += "/CPackProperties.cmake"; if(!cmSystemTools::FileExists(path.c_str()) && installedFiles.empty()) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 3deaec2e4..73d3dc26e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -584,9 +584,9 @@ void cmGlobalUnixMakefileGenerator3 (this->CreateLocalGenerator()); // set the Start directories lg->GetMakefile()->SetStartDirectory - (this->CMakeInstance->GetStartDirectory()); + (this->CMakeInstance->GetHomeDirectory()); lg->GetMakefile()->SetStartOutputDirectory - (this->CMakeInstance->GetStartOutputDirectory()); + (this->CMakeInstance->GetHomeOutputDirectory()); } std::string tname = targetName; From 8878bea7b6a157948bb7c806523b1cfa4c9f7af8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 21:09:16 +0200 Subject: [PATCH 0613/1029] cmake: Initialize Home directories on cmake for find-package mode. The Home directories can be used to initialize cmMakefile directories internally. --- Source/cmake.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bf05b18d3..f0fc4f0f4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -405,6 +405,11 @@ void cmake::ReadListFile(const std::vector& args, bool cmake::FindPackage(const std::vector& args) { + this->SetHomeDirectory + (cmSystemTools::GetCurrentWorkingDirectory()); + this->SetHomeOutputDirectory + (cmSystemTools::GetCurrentWorkingDirectory()); + // if a generator was not yet created, temporarily create one cmGlobalGenerator *gg = new cmGlobalGenerator; gg->SetCMakeInstance(this); @@ -413,12 +418,8 @@ bool cmake::FindPackage(const std::vector& args) // read in the list file to fill the cache cmsys::auto_ptr lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); - mf->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetStartOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetStartDirectory (cmSystemTools::GetCurrentWorkingDirectory()); From fcf246acd18dd168d9909cd33b191a3e6c9881e0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 21:47:14 +0200 Subject: [PATCH 0614/1029] cmMakefile: Populate Home directories on initialize. --- Source/cmLocalGenerator.cxx | 6 ------ Source/cmMakefile.cxx | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 946a020b8..1fd8ebbfb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -250,12 +250,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) this->GlobalGenerator = gg; this->Makefile = new cmMakefile; this->Makefile->SetLocalGenerator(this); - - // setup the home directories - this->Makefile->SetHomeDirectory( - gg->GetCMakeInstance()->GetHomeDirectory()); - this->Makefile->SetHomeOutputDirectory( - gg->GetCMakeInstance()->GetHomeOutputDirectory()); } void cmLocalGenerator::ConfigureFinalPass() diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 23c2e4828..bc0ac2630 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -696,6 +696,9 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) this->Properties.SetCMakeInstance(this->GetCMakeInstance()); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); + this->SetHomeDirectory(this->GetCMakeInstance()->GetHomeDirectory()); + this->SetHomeOutputDirectory( + this->GetCMakeInstance()->GetHomeOutputDirectory()); } namespace From b23cf06f861e928cf8ee942eabd24ea76e299f4f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 00:52:20 +0200 Subject: [PATCH 0615/1029] cmake: Remove redundant start directories. They are maintained as containing the same content as the 'home' directories, but they are never read from. Fix some comments and help strings which confused the two by name. They actually mean what is called CMAKE_SOURCE_DIR in cmake code. --- Source/QtDialog/QCMake.cxx | 2 -- Source/cmMakefile.cxx | 2 -- Source/cmake.cxx | 44 ++------------------------------------ Source/cmake.h | 24 +++------------------ Source/cmcmd.cxx | 2 -- 5 files changed, 5 insertions(+), 69 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 652435052..9edbb201b 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -144,9 +144,7 @@ void QCMake::configure() #endif this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toLocal8Bit().data()); - this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toLocal8Bit().data()); this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); - this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data())); this->CMakeInstance->SetGeneratorPlatform(""); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bc0ac2630..90a64104f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3544,8 +3544,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, // do a configure cm.SetHomeDirectory(srcdir); cm.SetHomeOutputDirectory(bindir); - cm.SetStartDirectory(srcdir); - cm.SetStartOutputDirectory(bindir); cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform()); cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset()); cm.LoadCache(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f0fc4f0f4..81b8d8d12 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -728,9 +728,6 @@ void cmake::SetArgs(const std::vector& args, this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); } - - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); } //---------------------------------------------------------------------------- @@ -801,9 +798,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) if (existingValue) { this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); this->SetHomeDirectory(existingValue); - this->SetStartDirectory(existingValue); return; } } @@ -813,14 +808,12 @@ void cmake::SetDirectoriesFromFile(const char* arg) if(!listPath.empty()) { this->SetHomeDirectory(listPath); - this->SetStartDirectory(listPath); if(argIsFile) { // Source CMakeLists.txt file given. It was probably dropped // onto the executable in a GUI. Default to an in-source build. this->SetHomeOutputDirectory(listPath); - this->SetStartOutputDirectory(listPath); } else { @@ -828,7 +821,6 @@ void cmake::SetDirectoriesFromFile(const char* arg) // directory as build tree. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeOutputDirectory(cwd); - this->SetStartOutputDirectory(cwd); } return; } @@ -839,9 +831,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) std::string full = cmSystemTools::CollapseFullPath(arg); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeDirectory(full); - this->SetStartDirectory(full); this->SetHomeOutputDirectory(cwd); - this->SetStartOutputDirectory(cwd); } // at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the @@ -1006,28 +996,6 @@ const char* cmake::GetHomeOutputDirectory() const return this->HomeOutputDirectory.c_str(); } -const char* cmake::GetStartDirectory() const -{ - return this->cmStartDirectory.c_str(); -} - -void cmake::SetStartDirectory(const std::string& dir) -{ - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); -} - -const char* cmake::GetStartOutputDirectory() const -{ - return this->StartOutputDirectory.c_str(); -} - -void cmake::SetStartOutputDirectory(const std::string& dir) -{ - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); -} - void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { if(!gg) @@ -1088,7 +1056,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) int cmake::DoPreConfigureChecks() { - // Make sure the Start directory contains a CMakeLists.txt file. + // Make sure the Source directory contains a CMakeLists.txt file. std::string srcList = this->GetHomeDirectory(); srcList += "/CMakeLists.txt"; if(!cmSystemTools::FileExists(srcList.c_str())) @@ -1262,7 +1230,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry ("CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(), - "Start directory with the top level CMakeLists.txt file for this " + "Source directory with the top level CMakeLists.txt file for this " "project", cmState::INTERNAL); } @@ -1632,12 +1600,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) return 0; } - // If we are doing global generate, we better set start and start - // output directory to the root of the project. - std::string oldstartdir = this->GetStartDirectory(); - std::string oldstartoutputdir = this->GetStartOutputDirectory(); - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); int ret = this->Configure(); if (ret || this->GetWorkingMode() != NORMAL_MODE) { @@ -1667,8 +1629,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) { return ret; } - this->SetStartDirectory(oldstartdir); - this->SetStartOutputDirectory(oldstartoutputdir); return ret; } diff --git a/Source/cmake.h b/Source/cmake.h index 352850dfd..9dd7c3154 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -41,7 +41,7 @@ class cmState; * The basic process for a GUI is as follows: * * -# Create a cmake instance - * -# Set the Home & Start directories, generator, and cmake command. this + * -# Set the Home directories, generator, and cmake command. this * can be done using the Set methods or by using SetArgs and passing in * command line arguments. * -# Load the cache by calling LoadCache (duh) @@ -52,7 +52,7 @@ class cmState; * -# Let the user change values and go back to step 5 * -# call Generate - * If your GUI allows the user to change the start & home directories then + * If your GUI allows the user to change the home directories then * you must at a minimum redo steps 2 through 7. */ @@ -106,9 +106,7 @@ class cmake /** * Set/Get the home directory (or output directory) in the project. The * home directory is the top directory of the project. It is the - * path-to-source cmake was run with. Remember that CMake processes - * CMakeLists files by recursing up the tree starting at the StartDirectory - * and going up until it reaches the HomeDirectory. + * path-to-source cmake was run with. */ void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const; @@ -116,20 +114,6 @@ class cmake const char* GetHomeOutputDirectory() const; //@} - //@{ - /** - * Set/Get the start directory (or output directory). The start directory - * is the directory of the CMakeLists.txt file that started the current - * round of processing. Remember that CMake processes CMakeLists files by - * recursing up the tree starting at the StartDirectory and going up until - * it reaches the HomeDirectory. - */ - void SetStartDirectory(const std::string& dir); - const char* GetStartDirectory() const; - void SetStartOutputDirectory(const std::string& dir); - const char* GetStartOutputDirectory() const; - //@} - /** * Handle a command line invocation of cmake. */ @@ -354,8 +338,6 @@ protected: cmCacheManager *CacheManager; std::string cmHomeDirectory; std::string HomeOutputDirectory; - std::string cmStartDirectory; - std::string StartOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; std::string GeneratorPlatform; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index db85b596a..a279ec7a6 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -642,9 +642,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir); startOutDir = cmSystemTools::CollapseFullPath(startOutDir); cm.SetHomeDirectory(homeDir); - cm.SetStartDirectory(startDir); cm.SetHomeOutputDirectory(homeOutDir); - cm.SetStartOutputDirectory(startOutDir); if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); From 55d80d0a8557189400bc12c5e577702a4d03b2e6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 21:17:41 +0200 Subject: [PATCH 0616/1029] cmMakefile: Rename GetCurrent{,Source}Directory. Match the names used in cmake code. --- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/cmAddSubDirectoryCommand.cxx | 8 ++++---- Source/cmAuxSourceDirectoryCommand.cxx | 2 +- Source/cmCPluginAPI.cxx | 2 +- Source/cmConfigureFileCommand.cxx | 2 +- Source/cmExtraQbsGenerator.cxx | 2 +- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmFileCommand.cxx | 20 ++++++++++---------- Source/cmFindPackageCommand.cxx | 2 +- Source/cmGetFilenameComponentCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 5 +++-- Source/cmGlobalXCodeGenerator.cxx | 4 ++-- Source/cmInstallCommand.cxx | 6 +++--- Source/cmInstallFilesCommand.cxx | 4 ++-- Source/cmInstallProgramsCommand.cxx | 4 ++-- Source/cmLocalGenerator.cxx | 5 +++-- Source/cmMakefile.cxx | 12 ++++++------ Source/cmMakefile.h | 2 +- Source/cmProjectCommand.cxx | 4 ++-- Source/cmQTWrapCPPCommand.cxx | 2 +- Source/cmQTWrapUICommand.cxx | 2 +- Source/cmSearchPath.cxx | 8 +++++--- Source/cmSetPropertyCommand.cxx | 2 +- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFileLocation.cxx | 8 ++++---- Source/cmSourceGroupCommand.cxx | 2 +- Source/cmSubdirCommand.cxx | 2 +- Source/cmUtilitySourceCommand.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Source/cmakemain.cxx | 2 +- 31 files changed, 65 insertions(+), 61 deletions(-) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 7f9825c17..31c0171b9 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -346,7 +346,7 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. - // Also, some commands need Makefile->GetCurrentDirectory(). + // Also, some commands need Makefile->GetCurrentSourceDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->Makefile->SetStartDirectory(cwd); this->Makefile->SetStartOutputDirectory(cwd); diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 9d55c1a6d..bae76d298 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -57,7 +57,7 @@ bool cmAddSubDirectoryCommand::InitialPass } else { - srcPath = this->Makefile->GetCurrentDirectory(); + srcPath = this->Makefile->GetCurrentSourceDirectory(); srcPath += "/"; srcPath += srcArg; } @@ -79,12 +79,12 @@ bool cmAddSubDirectoryCommand::InitialPass // not a subdirectory of the current directory then it is an // error. if(!cmSystemTools::IsSubDirectory(srcPath, - this->Makefile->GetCurrentDirectory())) + this->Makefile->GetCurrentSourceDirectory())) { std::ostringstream e; e << "not given a binary directory but the given source directory " << "\"" << srcPath << "\" is not a subdirectory of \"" - << this->Makefile->GetCurrentDirectory() << "\". " + << this->Makefile->GetCurrentSourceDirectory() << "\". " << "When specifying an out-of-tree source a binary directory " << "must be explicitly specified."; this->SetError(e.str()); @@ -93,7 +93,7 @@ bool cmAddSubDirectoryCommand::InitialPass // Remove the CurrentDirectory from the srcPath and replace it // with the CurrentOutputDirectory. - const char* src = this->Makefile->GetCurrentDirectory(); + const char* src = this->Makefile->GetCurrentSourceDirectory(); const char* bin = this->Makefile->GetCurrentOutputDirectory(); size_t srcLen = strlen(src); size_t binLen = strlen(bin); diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index b8238f850..5f5017d99 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -29,7 +29,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string tdir; if(!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) { - tdir = this->Makefile->GetCurrentDirectory(); + tdir = this->Makefile->GetCurrentSourceDirectory(); tdir += "/"; tdir += templateDirectory; } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 77cd6c687..d0d30b2fa 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -141,7 +141,7 @@ const char* CCONV cmGetStartOutputDirectory(void *arg) const char* CCONV cmGetCurrentDirectory(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetCurrentDirectory(); + return mf->GetCurrentSourceDirectory(); } const char* CCONV cmGetCurrentOutputDirectory(void *arg) { diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 687638863..967d54d1f 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -26,7 +26,7 @@ bool cmConfigureFileCommand const char* inFile = args[0].c_str(); if(!cmSystemTools::FileIsFullPath(inFile)) { - this->InputFile = this->Makefile->GetCurrentDirectory(); + this->InputFile = this->Makefile->GetCurrentSourceDirectory(); this->InputFile += "/"; } this->InputFile += inFile; diff --git a/Source/cmExtraQbsGenerator.cxx b/Source/cmExtraQbsGenerator.cxx index 5a1f9ef57..7e923a81f 100644 --- a/Source/cmExtraQbsGenerator.cxx +++ b/Source/cmExtraQbsGenerator.cxx @@ -81,7 +81,7 @@ void cmExtraQbsGenerator::AppendSubProject(cmGeneratedFileStream &fout, } const std::string &relativePath = cmSystemTools::RelativePath( - mk->GetHomeDirectory(), mk->GetCurrentDirectory()); + mk->GetHomeDirectory(), mk->GetCurrentSourceDirectory()); fout << "\tProject {\n" << "\t\tname:\"" << relativePath << "\"\n"; this->AppendProduct(fout, lg); diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 488beaad4..5000fd2c4 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -24,7 +24,7 @@ bool cmFLTKWrapUICommand } // what is the current source dir - std::string cdir = this->Makefile->GetCurrentDirectory(); + std::string cdir = this->Makefile->GetCurrentSourceDirectory(); const char* fluid_exe = this->Makefile->GetRequiredDefinition("FLTK_FLUID_EXECUTABLE"); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6ac0def71..a0ba88572 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -227,7 +227,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, std::string fileName = *i; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + *i; } @@ -309,7 +309,7 @@ bool cmFileCommand::HandleReadCommand(std::vector const& args) std::string fileName = fileNameArg.GetString(); if ( !cmsys::SystemTools::FileIsFullPath(fileName.c_str()) ) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + fileNameArg.GetString(); } @@ -445,7 +445,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) std::string fileName = args[1]; if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + args[1]; } @@ -984,7 +984,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, cmsys::Glob::GlobMessages globMessages; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { - std::string expr = this->Makefile->GetCurrentDirectory(); + std::string expr = this->Makefile->GetCurrentSourceDirectory(); // Handle script mode if (!expr.empty()) { @@ -1091,7 +1091,7 @@ bool cmFileCommand::HandleMakeDirectoryCommand( const std::string* cdir = &(*i); if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { - expr = this->Makefile->GetCurrentDirectory(); + expr = this->Makefile->GetCurrentSourceDirectory(); expr += "/" + *i; cdir = &expr; } @@ -1556,7 +1556,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } else { - std::string file = this->Makefile->GetCurrentDirectory(); + std::string file = this->Makefile->GetCurrentSourceDirectory(); file += "/" + arg; this->Files.push_back(file); } @@ -2658,13 +2658,13 @@ bool cmFileCommand::HandleRename(std::vector const& args) std::string oldname = args[1]; if(!cmsys::SystemTools::FileIsFullPath(oldname.c_str())) { - oldname = this->Makefile->GetCurrentDirectory(); + oldname = this->Makefile->GetCurrentSourceDirectory(); oldname += "/" + args[1]; } std::string newname = args[2]; if(!cmsys::SystemTools::FileIsFullPath(newname.c_str())) { - newname = this->Makefile->GetCurrentDirectory(); + newname = this->Makefile->GetCurrentSourceDirectory(); newname += "/" + args[2]; } @@ -2698,7 +2698,7 @@ bool cmFileCommand::HandleRemove(std::vector const& args, std::string fileName = *i; if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + *i; } @@ -3743,7 +3743,7 @@ bool cmFileCommand::HandleLockCommand( if (!cmsys::SystemTools::FileIsFullPath(path)) { - path = this->Makefile->GetCurrentDirectory() + ("/" + path); + path = this->Makefile->GetCurrentSourceDirectory() + ("/" + path); } // Unify path (remove '//', '/../', ...) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index aecd230af..4d568e9c6 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -663,7 +663,7 @@ bool cmFindPackageCommand::HandlePackageMode() if(!cmSystemTools::FileIsFullPath(dir.c_str())) { dir = "/" + dir; - dir = this->Makefile->GetCurrentDirectory() + dir; + dir = this->Makefile->GetCurrentSourceDirectory() + dir; } // The file location was cached. Look for the correct file. std::string file; diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 6947a7fb1..67f9f2dc1 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -97,7 +97,7 @@ bool cmGetFilenameComponentCommand // If the path given is relative evaluate it relative to the // current source directory. result = cmSystemTools::CollapseFullPath( - filename, this->Makefile->GetCurrentDirectory()); + filename, this->Makefile->GetCurrentSourceDirectory()); if(args[2] == "REALPATH") { // Resolve symlinks if possible diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 3e1d08eca..00dbdd3e2 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -255,7 +255,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() std::string dir = this->Name; if(!cmSystemTools::FileIsFullPath(dir.c_str())) { - dir = this->Makefile->GetCurrentDirectory(); + dir = this->Makefile->GetCurrentSourceDirectory(); dir += "/"; dir += this->Name; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 786f8fa98..c76c65da0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1567,7 +1567,8 @@ void cmGlobalGenerator::CheckLocalGenerators() text += "\n linked by target \""; text += l->second.GetName(); text += "\" in directory "; - text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory(); + text+=this->LocalGenerators[i]->GetMakefile() + ->GetCurrentSourceDirectory(); notFoundMap[varName] = text; } } @@ -1597,7 +1598,7 @@ void cmGlobalGenerator::CheckLocalGenerators() std::string text = notFoundMap[varName]; text += "\n used as include directory in directory "; text += this->LocalGenerators[i] - ->GetMakefile()->GetCurrentDirectory(); + ->GetMakefile()->GetCurrentSourceDirectory(); notFoundMap[varName] = text; } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8c373386f..c8e7632ff 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -407,7 +407,7 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) { this->CurrentProject = root->GetMakefile()->GetProjectName(); this->SetCurrentLocalGenerator(root); - cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentDirectory(), + cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), this->ProjectSourceDirectoryComponents); cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentOutputDirectory(), this->ProjectOutputDirectoryComponents); @@ -3342,7 +3342,7 @@ bool cmGlobalXCodeGenerator // Point Xcode at the top of the source tree. { std::string pdir = - this->RelativeToBinary(root->GetMakefile()->GetCurrentDirectory()); + this->RelativeToBinary(root->GetMakefile()->GetCurrentSourceDirectory()); this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir.c_str())); this->RootObject->AddAttribute("projectRoot", this->CreateString("")); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 2d7d7ccbd..fac964141 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -163,7 +163,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector const& args) std::string script = args[i]; if(!cmSystemTools::FileIsFullPath(script.c_str())) { - script = this->Makefile->GetCurrentDirectory(); + script = this->Makefile->GetCurrentSourceDirectory(); script += "/"; script += args[i]; } @@ -1093,7 +1093,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) std::string dir = args[i]; if(!cmSystemTools::FileIsFullPath(dir.c_str())) { - dir = this->Makefile->GetCurrentDirectory(); + dir = this->Makefile->GetCurrentSourceDirectory(); dir += "/"; dir += args[i]; } @@ -1376,7 +1376,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName, std::string::size_type gpos = cmGeneratorExpression::Find(file); if(gpos != 0 && !cmSystemTools::FileIsFullPath(file.c_str())) { - file = this->Makefile->GetCurrentDirectory(); + file = this->Makefile->GetCurrentSourceDirectory(); file += "/"; file += *fileIt; } diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 85e5345b8..64556d082 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -95,7 +95,7 @@ void cmInstallFilesCommand::FinalPass() { std::vector files; std::string regex = this->FinalArgs[0]; - cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), + cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), regex, files); std::vector::iterator s = files.begin(); @@ -155,7 +155,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const std::string tb = this->Makefile->GetCurrentOutputDirectory(); tb += "/"; tb += name; - std::string ts = this->Makefile->GetCurrentDirectory(); + std::string ts = this->Makefile->GetCurrentSourceDirectory(); ts += "/"; ts += name; diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index cc223abed..db1ee79f3 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -63,7 +63,7 @@ void cmInstallProgramsCommand::FinalPass() else // reg exp list { std::vector programs; - cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), + cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), this->FinalArgs[0], programs); std::vector::iterator s = programs.begin(); @@ -118,7 +118,7 @@ std::string cmInstallProgramsCommand std::string tb = this->Makefile->GetCurrentOutputDirectory(); tb += "/"; tb += name; - std::string ts = this->Makefile->GetCurrentDirectory(); + std::string ts = this->Makefile->GetCurrentSourceDirectory(); ts += "/"; ts += name; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1fd8ebbfb..5e47b916c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -438,7 +438,8 @@ void cmLocalGenerator::GenerateInstallRules() // Write the header. fout << "# Install script for directory: " - << this->Makefile->GetCurrentDirectory() << std::endl << std::endl; + << this->Makefile->GetCurrentSourceDirectory() + << std::endl << std::endl; fout << "# Set the install prefix" << std::endl << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl @@ -2159,7 +2160,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // Treat the name as relative to the source directory in which it // was given. - dep = this->Makefile->GetCurrentDirectory(); + dep = this->Makefile->GetCurrentSourceDirectory(); dep += "/"; dep += inName; return true; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 90a64104f..251e84018 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -269,7 +269,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, if(this->ListFileStack.empty()) { // We are not processing the project. Add the directory-level context. - lfc.FilePath = this->GetCurrentDirectory(); + lfc.FilePath = this->GetCurrentSourceDirectory(); lfc.FilePath += "/CMakeLists.txt"; } else @@ -1622,7 +1622,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Entering "; - msg += lg2->GetMakefile()->GetCurrentDirectory(); + msg += lg2->GetMakefile()->GetCurrentSourceDirectory(); cmSystemTools::Message(msg.c_str()); } // finally configure the subdir @@ -1630,7 +1630,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Returning to "; - msg += this->GetCurrentDirectory(); + msg += this->GetCurrentSourceDirectory(); cmSystemTools::Message(msg.c_str()); } } @@ -4039,7 +4039,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" ) { // This property is not inherrited - if ( strcmp(this->GetCurrentDirectory(), + if ( strcmp(this->GetCurrentSourceDirectory(), this->GetStartDirectory()) != 0 ) { return; @@ -4307,7 +4307,7 @@ void cmMakefile::AddCMakeDependFilesFromUser() } else { - std::string f = this->GetCurrentDirectory(); + std::string f = this->GetCurrentSourceDirectory(); f += "/"; f += *i; this->AddCMakeDependFile(f); @@ -4588,7 +4588,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, default: break; } e << "created in source directory \"" - << existing->GetMakefile()->GetCurrentDirectory() << "\". " + << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". " << "See documentation for policy CMP0002 for more details."; msg = e.str(); return false; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 356e4c281..8aec64776 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -484,7 +484,7 @@ public: } //@} - const char* GetCurrentDirectory() const + const char* GetCurrentSourceDirectory() const { return this->cmStartDirectory.c_str(); } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 43b02bc4b..af62b0b50 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -33,7 +33,7 @@ bool cmProjectCommand "Value Computed by CMake", cmState::STATIC); this->Makefile->AddCacheDefinition (srcdir, - this->Makefile->GetCurrentDirectory(), + this->Makefile->GetCurrentSourceDirectory(), "Value Computed by CMake", cmState::STATIC); bindir = "PROJECT_BINARY_DIR"; @@ -42,7 +42,7 @@ bool cmProjectCommand this->Makefile->AddDefinition(bindir, this->Makefile->GetCurrentOutputDirectory()); this->Makefile->AddDefinition(srcdir, - this->Makefile->GetCurrentDirectory()); + this->Makefile->GetCurrentSourceDirectory()); this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str()); diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 878562c99..655bf8211 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -66,7 +66,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& args, } else { - hname = this->Makefile->GetCurrentDirectory(); + hname = this->Makefile->GetCurrentSourceDirectory(); } hname += "/"; hname += *j; diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index 9b92b1eea..b1e43b84e 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -73,7 +73,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, } else { - uiName = this->Makefile->GetCurrentDirectory(); + uiName = this->Makefile->GetCurrentSourceDirectory(); } uiName += "/"; uiName += *j; diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 045c82e5f..c9cc81737 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -86,7 +86,7 @@ void cmSearchPath::AddUserPath(const std::string& path) for(std::vector::const_iterator p = outPaths.begin(); p != outPaths.end(); ++p) { - this->AddPathInternal(*p, this->FC->Makefile->GetCurrentDirectory()); + this->AddPathInternal(*p, this->FC->Makefile->GetCurrentSourceDirectory()); } } @@ -104,7 +104,8 @@ void cmSearchPath::AddCMakePath(const std::string& variable) for(std::vector::const_iterator p = expanded.begin(); p!= expanded.end(); ++p) { - this->AddPathInternal(*p, this->FC->Makefile->GetCurrentDirectory()); + this->AddPathInternal(*p, + this->FC->Makefile->GetCurrentSourceDirectory()); } } } @@ -132,7 +133,8 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable) std::vector expanded; cmSystemTools::ExpandListArgument(value, expanded); - this->AddPrefixPaths(expanded, this->FC->Makefile->GetCurrentDirectory()); + this->AddPrefixPaths(expanded, + this->FC->Makefile->GetCurrentSourceDirectory()); } } diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index bb94a722f..35262b67a 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -197,7 +197,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() std::string dir = *this->Names.begin(); if(!cmSystemTools::FileIsFullPath(dir.c_str())) { - dir = this->Makefile->GetCurrentDirectory(); + dir = this->Makefile->GetCurrentSourceDirectory(); dir += "/"; dir += *this->Names.begin(); } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 684747591..c28d7b4a9 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -162,7 +162,7 @@ bool cmSourceFile::FindFullPath(std::string* error) const char* tryDirs[3] = {0, 0, 0}; if(this->Location.DirectoryIsAmbiguous()) { - tryDirs[0] = mf->GetCurrentDirectory(); + tryDirs[0] = mf->GetCurrentSourceDirectory(); tryDirs[1] = mf->GetCurrentOutputDirectory(); } else diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 9d67c1e64..d88a5f253 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -93,7 +93,7 @@ void cmSourceFileLocation::DirectoryUseSource() { this->Directory = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentDirectory()); + this->Directory, this->Makefile->GetCurrentSourceDirectory()); this->AmbiguousDirectory = false; } } @@ -143,7 +143,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) // Check the source tree only because a file in the build tree should // be specified by full path at least once. We do not want this // detection to depend on whether the project has already been built. - tryPath = this->Makefile->GetCurrentDirectory(); + tryPath = this->Makefile->GetCurrentSourceDirectory(); tryPath += "/"; } if(!this->Directory.empty()) @@ -282,7 +282,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Compare possible directory combinations. std::string const& srcDir = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentDirectory()); + this->Directory, this->Makefile->GetCurrentSourceDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( this->Directory, this->Makefile->GetCurrentOutputDirectory()); @@ -297,7 +297,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Compare possible directory combinations. std::string const& srcDir = cmSystemTools::CollapseFullPath( - loc.Directory, loc.Makefile->GetCurrentDirectory()); + loc.Directory, loc.Makefile->GetCurrentSourceDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( loc.Directory, loc.Makefile->GetCurrentOutputDirectory()); diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 1741e05a1..fadb17299 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -81,7 +81,7 @@ bool cmSourceGroupCommand std::string src = args[i]; if(!cmSystemTools::FileIsFullPath(src.c_str())) { - src = this->Makefile->GetCurrentDirectory(); + src = this->Makefile->GetCurrentSourceDirectory(); src += "/"; src += args[i]; } diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 7cb2edc94..47198a3f6 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -39,7 +39,7 @@ bool cmSubdirCommand // if they specified a relative path then compute the full std::string srcPath = - std::string(this->Makefile->GetCurrentDirectory()) + + std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" + i->c_str(); if (cmSystemTools::FileIsDirectory(srcPath)) { diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 10122e9c1..6f2f950ab 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -75,7 +75,7 @@ bool cmUtilitySourceCommand // The third argument specifies the relative directory of the source // of the utility. std::string relativeSource = *arg++; - std::string utilitySource = this->Makefile->GetCurrentDirectory(); + std::string utilitySource = this->Makefile->GetCurrentSourceDirectory(); utilitySource = utilitySource+"/"+relativeSource; // If the directory doesn't exist, the source has not been included. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index dad6f9339..838d390cb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2194,7 +2194,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( { // Look through the sources for AndroidManifest.xml and use // its location as the root source directory. - std::string rootDir = this->Makefile->GetCurrentDirectory(); + std::string rootDir = this->Makefile->GetCurrentSourceDirectory(); { std::vector extraSources; this->GeneratorTarget->GetExtraSources(extraSources, ""); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index c8cf2d43c..7d33f0454 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -154,7 +154,7 @@ static void cmakemainProgressCallback(const char *m, float prog, if ((mf) && (strstr(m, "Configuring")==m) && (prog<0)) { dir = " "; - dir += mf->GetCurrentDirectory(); + dir += mf->GetCurrentSourceDirectory(); } else if ((mf) && (strstr(m, "Generating")==m)) { From 54d6a9187f24bbff9e344d8aa6b3c0d66167094d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 21:33:09 +0200 Subject: [PATCH 0617/1029] cmMakefile: Rename GetCurrent{Output,Binary}Directory. Match names used in CMake code. --- Source/cmAddCustomCommandCommand.cxx | 4 ++-- Source/cmAddCustomTargetCommand.cxx | 4 ++-- Source/cmAddSubDirectoryCommand.cxx | 4 ++-- Source/cmCPluginAPI.cxx | 2 +- Source/cmConfigureFileCommand.cxx | 2 +- Source/cmCreateTestSourceList.cxx | 2 +- Source/cmDependsFortran.cxx | 2 +- Source/cmExportCommand.cxx | 4 ++-- Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 4 ++-- Source/cmExtraKateGenerator.cxx | 2 +- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmFileCommand.cxx | 4 ++-- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio8Generator.cxx | 4 ++-- Source/cmGlobalVisualStudioGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 22 +++++++++++----------- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallFilesCommand.cxx | 2 +- Source/cmInstallProgramsCommand.cxx | 2 +- Source/cmLocalGenerator.cxx | 6 +++--- Source/cmLocalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 4 ++-- Source/cmMakefile.h | 2 +- Source/cmMakefileTargetGenerator.cxx | 4 ++-- Source/cmProjectCommand.cxx | 4 ++-- Source/cmQTWrapCPPCommand.cxx | 4 ++-- Source/cmQTWrapUICommand.cxx | 8 ++++---- Source/cmQtAutoGenerators.cxx | 6 +++--- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFileLocation.cxx | 6 +++--- Source/cmSubdirCommand.cxx | 4 ++-- Source/cmTarget.cxx | 2 +- Source/cmUtilitySourceCommand.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 4 ++-- Source/cmakemain.cxx | 2 +- 39 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 8fb49ca23..ba9e663ca 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -168,7 +168,7 @@ bool cmAddCustomCommandCommand // and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt". // This is fairly obscure so we can wait for someone to // complain. - filename = this->Makefile->GetCurrentOutputDirectory(); + filename = this->Makefile->GetCurrentBinaryDirectory(); filename += "/"; } filename += copy; @@ -315,7 +315,7 @@ bool cmAddCustomCommandCommand // Convert working directory to a full path. if(!working.empty()) { - const char* build_dir = this->Makefile->GetCurrentOutputDirectory(); + const char* build_dir = this->Makefile->GetCurrentBinaryDirectory(); working = cmSystemTools::CollapseFullPath(working, build_dir); } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index a0e20c8f2..c246aee58 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -138,7 +138,7 @@ bool cmAddCustomTargetCommand std::string filename; if (!cmSystemTools::FileIsFullPath(copy.c_str())) { - filename = this->Makefile->GetCurrentOutputDirectory(); + filename = this->Makefile->GetCurrentBinaryDirectory(); filename += "/"; } filename += copy; @@ -240,7 +240,7 @@ bool cmAddCustomTargetCommand // Convert working directory to a full path. if(!working_directory.empty()) { - const char* build_dir = this->Makefile->GetCurrentOutputDirectory(); + const char* build_dir = this->Makefile->GetCurrentBinaryDirectory(); working_directory = cmSystemTools::CollapseFullPath(working_directory, build_dir); } diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index bae76d298..69c6a14d4 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -94,7 +94,7 @@ bool cmAddSubDirectoryCommand::InitialPass // Remove the CurrentDirectory from the srcPath and replace it // with the CurrentOutputDirectory. const char* src = this->Makefile->GetCurrentSourceDirectory(); - const char* bin = this->Makefile->GetCurrentOutputDirectory(); + const char* bin = this->Makefile->GetCurrentBinaryDirectory(); size_t srcLen = strlen(src); size_t binLen = strlen(bin); if(srcLen > 0 && src[srcLen-1] == '/') @@ -113,7 +113,7 @@ bool cmAddSubDirectoryCommand::InitialPass } else { - binPath = this->Makefile->GetCurrentOutputDirectory(); + binPath = this->Makefile->GetCurrentBinaryDirectory(); binPath += "/"; binPath += binArg; } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index d0d30b2fa..4f1fa3cee 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -146,7 +146,7 @@ const char* CCONV cmGetCurrentDirectory(void *arg) const char* CCONV cmGetCurrentOutputDirectory(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetCurrentOutputDirectory(); + return mf->GetCurrentBinaryDirectory(); } const char* CCONV cmGetDefinition(void *arg,const char*def) { diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 967d54d1f..46b71c59b 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -45,7 +45,7 @@ bool cmConfigureFileCommand const char* outFile = args[1].c_str(); if(!cmSystemTools::FileIsFullPath(outFile)) { - this->OutputFile = this->Makefile->GetCurrentOutputDirectory(); + this->OutputFile = this->Makefile->GetCurrentBinaryDirectory(); this->OutputFile += "/"; } this->OutputFile += outFile; diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index f93d3df7e..54c27d6ce 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -73,7 +73,7 @@ bool cmCreateTestSourceList "You must specify a file extension for the test driver file."); return false; } - std::string driver = this->Makefile->GetCurrentOutputDirectory(); + std::string driver = this->Makefile->GetCurrentBinaryDirectory(); driver += "/"; driver += *i; ++i; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d9818cede..f12116eba 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -237,7 +237,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, else { mod_dir = - this->LocalGenerator->GetMakefile()->GetCurrentOutputDirectory(); + this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory(); } // Actually write dependencies to the streams. diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 76283d462..06541c001 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -113,7 +113,7 @@ bool cmExportCommand else { // Interpret relative paths with respect to the current build dir. - std::string dir = this->Makefile->GetCurrentOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); fname = dir + "/" + fname; } @@ -295,7 +295,7 @@ bool cmExportCommand::HandlePackage(std::vector const& args) // We store the current build directory in the registry as a value // named by a hash of its own content. This is deterministic and is // unique with high probability. - const char* outDir = this->Makefile->GetCurrentOutputDirectory(); + const char* outDir = this->Makefile->GetCurrentBinaryDirectory(); std::string hash = cmSystemTools::ComputeStringMD5(outDir); #if defined(_WIN32) && !defined(__CYGWIN__) this->StorePackageRegistryWin(package, outDir, hash.c_str()); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 554b68650..dfa2cb1af 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -524,7 +524,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( // this file doesn't seem to be used by C::B in custom makefile mode, // but we generate a unique file for each OBJECT library so in case // C::B uses it in some way, the targets don't interfere with each other. - std::string filename = mf->GetCurrentOutputDirectory(); + std::string filename = mf->GetCurrentBinaryDirectory(); filename += "/"; filename += mf->GetLocalGenerator()->GetTargetDirectory(*target); filename += "/"; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 2aa4d935c..668dcd8ca 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1033,7 +1033,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); cmMakefile* makefile=(*it)->GetMakefile(); - std::string subdir = (*it)->Convert(makefile->GetCurrentOutputDirectory(), + std::string subdir = (*it)->Convert(makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); if (subdir == ".") { @@ -1094,7 +1094,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const ti->first.c_str()); std::string cleanArgs = "-E chdir \""; - cleanArgs += makefile->GetCurrentOutputDirectory(); + cleanArgs += makefile->GetCurrentBinaryDirectory(); cleanArgs += "\" \""; cleanArgs += cmake; cleanArgs += "\" -P \""; diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 9645d0e6f..ec141a97f 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -123,7 +123,7 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, { const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); cmMakefile* makefile=(*it)->GetMakefile(); - std::string currentDir = makefile->GetCurrentOutputDirectory(); + std::string currentDir = makefile->GetCurrentBinaryDirectory(); bool topLevel = (currentDir == makefile->GetHomeOutputDirectory()); for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 5000fd2c4..5e94fa1e2 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -32,7 +32,7 @@ bool cmFLTKWrapUICommand this->Target = args[0]; // Target that will use the generated files // get the list of GUI files from which .cxx and .h will be generated - std::string outputDirectory = this->Makefile->GetCurrentOutputDirectory(); + std::string outputDirectory = this->Makefile->GetCurrentBinaryDirectory(); { // Some of the generated files are *.h so the directory "GUI" diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index a0ba88572..14f397ce4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -645,7 +645,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) if (hex_conversion_enabled) { // TODO: should work without temp file, but just on a memory buffer - std::string binaryFileName = this->Makefile->GetCurrentOutputDirectory(); + std::string binaryFileName = this->Makefile->GetCurrentBinaryDirectory(); binaryFileName += cmake::GetCMakeFilesDirectory(); binaryFileName += "/FileCommandStringsBinaryFile"; if(cmHexFileConverter::TryConvert(fileName.c_str(),binaryFileName.c_str())) @@ -1568,7 +1568,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } else { - this->Destination = this->Makefile->GetCurrentOutputDirectory(); + this->Destination = this->Makefile->GetCurrentBinaryDirectory(); this->Destination += "/" + arg; } this->Doing = DoingNone; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 505914e2f..4572a94ec 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -679,7 +679,7 @@ void cmGlobalNinjaGenerator // Compute full path to object file directory for this target. std::string dir; - dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += gt->LocalGenerator->GetTargetDirectory(*target); dir += "/"; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 73d3dc26e..7f1980a06 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -113,7 +113,7 @@ cmGlobalUnixMakefileGenerator3 // Compute full path to object file directory for this target. std::string dir; - dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += gt->LocalGenerator->GetTargetDirectory(*target); dir += "/"; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 231b6796d..8240099e5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -338,7 +338,7 @@ void cmGlobalVisualStudio10Generator::Generate() " " << this->LongestSource.SourceFile->GetFullPath() << "\n" "This is because some Visual Studio tools would append the relative " "path to the end of the referencing directory path, as in:\n" - " " << mf->GetCurrentOutputDirectory() << "/" + " " << mf->GetCurrentBinaryDirectory() << "/" << this->LongestSource.SourceRel << "\n" "and then incorrectly complain that the file does not exist because " "the path length is too long for some internal buffer or API. " @@ -585,7 +585,7 @@ cmGlobalVisualStudio10Generator void cmGlobalVisualStudio10Generator::PathTooLong( cmTarget* target, cmSourceFile const* sf, std::string const& sfRel) { - size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) + + size_t len = (strlen(target->GetMakefile()->GetCurrentBinaryDirectory()) + 1 + sfRel.length()); if(len > this->LongestSource.Length) { diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 726db0f3a..bb50633ce 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -281,7 +281,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() stampList += "generate.stamp.list"; { std::string stampListFile = - generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + generators[0]->GetMakefile()->GetCurrentBinaryDirectory(); stampListFile += "/"; stampListFile += stampList; std::string stampFile; @@ -289,7 +289,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() for(std::vector::const_iterator gi = generators.begin(); gi != generators.end(); ++gi) { - stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile = (*gi)->GetMakefile()->GetCurrentBinaryDirectory(); stampFile += "/"; stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); stampFile += "generate.stamp"; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 320a1f4d3..4184436f6 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -121,7 +121,7 @@ void cmGlobalVisualStudioGenerator::Generate() void cmGlobalVisualStudioGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const { - std::string dir = gt->Makefile->GetCurrentOutputDirectory(); + std::string dir = gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target); if(!tgtDir.empty()) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c8e7632ff..daeb616fb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -409,11 +409,11 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) this->SetCurrentLocalGenerator(root); cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), this->ProjectSourceDirectoryComponents); - cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentOutputDirectory(), + cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentBinaryDirectory(), this->ProjectOutputDirectoryComponents); this->CurrentXCodeHackMakefile = - root->GetMakefile()->GetCurrentOutputDirectory(); + root->GetMakefile()->GetCurrentBinaryDirectory(); this->CurrentXCodeHackMakefile += "/CMakeScripts"; cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str()); this->CurrentXCodeHackMakefile += "/XCODE_DEPEND_HELPER.make"; @@ -459,7 +459,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, allbuild->AddSourceCMP0049(listfile.c_str()); // Add XCODE depend helper - std::string dir = mf->GetCurrentOutputDirectory(); + std::string dir = mf->GetCurrentBinaryDirectory(); cmCustomCommandLine makeHelper; if(this->XcodeVersion < 50) { @@ -1012,7 +1012,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) this->CurrentMakefile = gen->GetMakefile(); std::string outdir = cmSystemTools::CollapseFullPath(this->CurrentMakefile-> - GetCurrentOutputDirectory()); + GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir.c_str(), this->CurrentOutputDirectoryComponents); @@ -1366,7 +1366,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) // linker language. This should convince Xcode to choose the proper // language. cmMakefile* mf = cmtarget.GetMakefile(); - std::string fname = mf->GetCurrentOutputDirectory(); + std::string fname = mf->GetCurrentBinaryDirectory(); fname += cmake::GetCMakeFilesDirectory(); fname += "/"; fname += cmtarget.GetName(); @@ -1594,7 +1594,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, const & commands, const char* name) { - std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); + std::string dir = this->CurrentMakefile->GetCurrentBinaryDirectory(); dir += "/CMakeScripts"; cmSystemTools::MakeDirectory(dir.c_str()); std::string makefile = dir; @@ -1615,7 +1615,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, currentConfig->c_str()); } - std::string cdir = this->CurrentMakefile->GetCurrentOutputDirectory(); + std::string cdir = this->CurrentMakefile->GetCurrentBinaryDirectory(); cdir = this->ConvertToRelativeForXCode(cdir.c_str()); std::string makecmd = "make -C "; makecmd += cdir; @@ -1943,7 +1943,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } // Set attributes to specify the proper name for the target. - std::string pndir = this->CurrentMakefile->GetCurrentOutputDirectory(); + std::string pndir = this->CurrentMakefile->GetCurrentBinaryDirectory(); if(target.GetType() == cmTarget::STATIC_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY || @@ -3454,7 +3454,7 @@ bool cmGlobalXCodeGenerator } } - std::string symroot = root->GetMakefile()->GetCurrentOutputDirectory(); + std::string symroot = root->GetMakefile()->GetCurrentBinaryDirectory(); symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); @@ -3516,7 +3516,7 @@ cmGlobalXCodeGenerator::GetObjectsNormalDirectory( const cmTarget *t) const { std::string dir = - t->GetMakefile()->GetCurrentOutputDirectory(); + t->GetMakefile()->GetCurrentBinaryDirectory(); dir += "/"; dir += projName; dir += ".build/"; @@ -4016,7 +4016,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(cmTarget& target) { - std::string plist = target.GetMakefile()->GetCurrentOutputDirectory(); + std::string plist = target.GetMakefile()->GetCurrentBinaryDirectory(); plist += cmake::GetCMakeFilesDirectory(); plist += "/"; plist += target.GetName(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 38c80dff6..7f6aa4d3c 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -59,7 +59,7 @@ void cmInstallExportGenerator::ComputeTempDir() { // Choose a temporary directory in which to generate the import // files to be installed. - this->TempDir = this->Makefile->GetCurrentOutputDirectory(); + this->TempDir = this->Makefile->GetCurrentBinaryDirectory(); this->TempDir += cmake::GetCMakeFilesDirectory(); this->TempDir += "/Export"; if(this->Destination.empty()) diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 64556d082..1fe435ce3 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -152,7 +152,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const } // This is a relative path. - std::string tb = this->Makefile->GetCurrentOutputDirectory(); + std::string tb = this->Makefile->GetCurrentBinaryDirectory(); tb += "/"; tb += name; std::string ts = this->Makefile->GetCurrentSourceDirectory(); diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index db1ee79f3..4899b95e0 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -115,7 +115,7 @@ std::string cmInstallProgramsCommand } // This is a relative path. - std::string tb = this->Makefile->GetCurrentOutputDirectory(); + std::string tb = this->Makefile->GetCurrentBinaryDirectory(); tb += "/"; tb += name; std::string ts = this->Makefile->GetCurrentSourceDirectory(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5e47b916c..d3544c544 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -423,7 +423,7 @@ void cmLocalGenerator::GenerateInstallRules() // Create the install script file. std::string file = this->Makefile->GetStartOutputDirectory(); std::string homedir = this->Makefile->GetHomeOutputDirectory(); - std::string currdir = this->Makefile->GetCurrentOutputDirectory(); + std::string currdir = this->Makefile->GetCurrentBinaryDirectory(); cmSystemTools::ConvertToUnixSlashes(file); cmSystemTools::ConvertToUnixSlashes(homedir); cmSystemTools::ConvertToUnixSlashes(currdir); @@ -669,12 +669,12 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += "/"; std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); if(!obj.empty()) { - std::string ofname = this->Makefile->GetCurrentOutputDirectory(); + std::string ofname = this->Makefile->GetCurrentBinaryDirectory(); ofname += "/"; ofname += obj; objVector.push_back(ofname); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 153ed0935..eb0f7bf41 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -205,7 +205,7 @@ GetLocalObjectFiles(std::map &localObjectFiles) ->GetSafeDefinition("CMAKE_BUILD_TYPE")); // Compute full path to object file directory for this target. std::string dir; - dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += this->GetTargetDirectory(*gt->Target); dir += "/"; @@ -1236,7 +1236,7 @@ cmLocalUnixMakefileGenerator3 const std::vector& files, cmTarget& target, const char* filename) { - std::string cleanfile = this->Makefile->GetCurrentOutputDirectory(); + std::string cleanfile = this->Makefile->GetCurrentBinaryDirectory(); cleanfile += "/"; cleanfile += this->GetTargetDirectory(target); cleanfile += "/cmake_clean"; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 6844fee3f..0b6d214d2 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1968,7 +1968,7 @@ cmLocalVisualStudio6Generator // files directory for any configuration. This is used to construct // object file names that do not produce paths that are too long. std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += "/"; dir_max += config_max; dir_max += "/"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 884212b34..83fde3a2e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -286,7 +286,7 @@ void cmLocalVisualStudio7Generator //---------------------------------------------------------------------------- cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() { - std::string stampName = this->Makefile->GetCurrentOutputDirectory(); + std::string stampName = this->Makefile->GetCurrentBinaryDirectory(); stampName += "/"; stampName += cmake::GetCMakeFilesDirectoryPostSlash(); stampName += "generate.stamp"; @@ -1707,7 +1707,7 @@ cmLocalVisualStudio7Generator // files directory for any configuration. This is used to construct // object file names that do not produce paths that are too long. std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += "/"; dir_max += this->GetTargetDirectory(target); dir_max += "/"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8aec64776..321181322 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -488,7 +488,7 @@ public: { return this->cmStartDirectory.c_str(); } - const char* GetCurrentOutputDirectory() const + const char* GetCurrentBinaryDirectory() const { return this->StartOutputDirectory.c_str(); } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0076cafd6..97982bfa8 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -495,7 +495,7 @@ void cmMakefileTargetGenerator this->WriteObjectBuildFile(obj, lang, source, depends); // The object file should be checked for dependency integrity. - std::string objFullPath = this->Makefile->GetCurrentOutputDirectory(); + std::string objFullPath = this->Makefile->GetCurrentBinaryDirectory(); objFullPath += "/"; objFullPath += obj; objFullPath = @@ -1968,7 +1968,7 @@ const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() { // Interpret relative to the current output directory. this->FortranModuleDirectory = - this->Makefile->GetCurrentOutputDirectory(); + this->Makefile->GetCurrentBinaryDirectory(); this->FortranModuleDirectory += "/"; this->FortranModuleDirectory += target_mod_dir; } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index af62b0b50..afacc1b2e 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -29,7 +29,7 @@ bool cmProjectCommand this->Makefile->AddCacheDefinition (bindir, - this->Makefile->GetCurrentOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), "Value Computed by CMake", cmState::STATIC); this->Makefile->AddCacheDefinition (srcdir, @@ -40,7 +40,7 @@ bool cmProjectCommand srcdir = "PROJECT_SOURCE_DIR"; this->Makefile->AddDefinition(bindir, - this->Makefile->GetCurrentOutputDirectory()); + this->Makefile->GetCurrentBinaryDirectory()); this->Makefile->AddDefinition(srcdir, this->Makefile->GetCurrentSourceDirectory()); diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 655bf8211..aae1bb967 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -41,7 +41,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& args, // Compute the name of the file to generate. std::string srcName = cmSystemTools::GetFilenameWithoutLastExtension(*j); - std::string newName = this->Makefile->GetCurrentOutputDirectory(); + std::string newName = this->Makefile->GetCurrentBinaryDirectory(); newName += "/moc_"; newName += srcName; newName += ".cxx"; @@ -62,7 +62,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& args, { if(curr && curr->GetPropertyAsBool("GENERATED")) { - hname = this->Makefile->GetCurrentOutputDirectory(); + hname = this->Makefile->GetCurrentBinaryDirectory(); } else { diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index b1e43b84e..3adea2967 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -46,15 +46,15 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, // Compute the name of the files to generate. std::string srcName = cmSystemTools::GetFilenameWithoutLastExtension(*j); - std::string hName = this->Makefile->GetCurrentOutputDirectory(); + std::string hName = this->Makefile->GetCurrentBinaryDirectory(); hName += "/"; hName += srcName; hName += ".h"; - std::string cxxName = this->Makefile->GetCurrentOutputDirectory(); + std::string cxxName = this->Makefile->GetCurrentBinaryDirectory(); cxxName += "/"; cxxName += srcName; cxxName += ".cxx"; - std::string mocName = this->Makefile->GetCurrentOutputDirectory(); + std::string mocName = this->Makefile->GetCurrentBinaryDirectory(); mocName += "/moc_"; mocName += srcName; mocName += ".cxx"; @@ -69,7 +69,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, { if(curr && curr->GetPropertyAsBool("GENERATED")) { - uiName = this->Makefile->GetCurrentOutputDirectory(); + uiName = this->Makefile->GetCurrentBinaryDirectory(); } else { diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 3d5103f72..9e7566309 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -162,7 +162,7 @@ static std::string getAutogenTargetName(cmTarget const* target) static std::string getAutogenTargetDir(cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); - std::string targetDir = makefile->GetCurrentOutputDirectory(); + std::string targetDir = makefile->GetCurrentBinaryDirectory(); targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); targetDir += "/"; targetDir += getAutogenTargetName(target); @@ -291,7 +291,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) if (target->GetPropertyAsBool("AUTOMOC")) { std::string automocTargetName = getAutogenTargetName(target); - std::string mocCppFile = makefile->GetCurrentOutputDirectory(); + std::string mocCppFile = makefile->GetCurrentBinaryDirectory(); mocCppFile += "/"; mocCppFile += automocTargetName; mocCppFile += ".cpp"; @@ -317,7 +317,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) commandLines.push_back(currentLine); std::string workingDirectory = cmSystemTools::CollapseFullPath( - "", makefile->GetCurrentOutputDirectory()); + "", makefile->GetCurrentBinaryDirectory()); std::vector depends; if (const char *autogenDepends = diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index c28d7b4a9..cdd04edfa 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -163,7 +163,7 @@ bool cmSourceFile::FindFullPath(std::string* error) if(this->Location.DirectoryIsAmbiguous()) { tryDirs[0] = mf->GetCurrentSourceDirectory(); - tryDirs[1] = mf->GetCurrentOutputDirectory(); + tryDirs[1] = mf->GetCurrentBinaryDirectory(); } else { diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index d88a5f253..a0eba5e5d 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -106,7 +106,7 @@ void cmSourceFileLocation::DirectoryUseBinary() { this->Directory = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentOutputDirectory()); + this->Directory, this->Makefile->GetCurrentBinaryDirectory()); this->AmbiguousDirectory = false; } } @@ -285,7 +285,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) this->Directory, this->Makefile->GetCurrentSourceDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentOutputDirectory()); + this->Directory, this->Makefile->GetCurrentBinaryDirectory()); if(srcDir != loc.Directory && binDir != loc.Directory) { @@ -300,7 +300,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) loc.Directory, loc.Makefile->GetCurrentSourceDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( - loc.Directory, loc.Makefile->GetCurrentOutputDirectory()); + loc.Directory, loc.Makefile->GetCurrentBinaryDirectory()); if(srcDir != this->Directory && binDir != this->Directory) { diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 47198a3f6..6a4a83551 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -44,7 +44,7 @@ bool cmSubdirCommand if (cmSystemTools::FileIsDirectory(srcPath)) { std::string binPath = - std::string(this->Makefile->GetCurrentOutputDirectory()) + + std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + i->c_str(); this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false); @@ -55,7 +55,7 @@ bool cmSubdirCommand // we must compute the binPath from the srcPath, we just take the last // element from the source path and use that std::string binPath = - std::string(this->Makefile->GetCurrentOutputDirectory()) + + std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + cmSystemTools::GetFilenameName(*i); this->Makefile->AddSubDirectory(*i, binPath, excludeFromAll, false); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f1540d437..cc6d74838 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -540,7 +540,7 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const //---------------------------------------------------------------------------- std::string cmTarget::GetSupportDirectory() const { - std::string dir = this->Makefile->GetCurrentOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); dir += cmake::GetCMakeFilesDirectory(); dir += "/"; dir += this->Name; diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 6f2f950ab..486328f7b 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -93,7 +93,7 @@ bool cmUtilitySourceCommand // The source exists. std::string cmakeCFGout = this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); - std::string utilityDirectory = this->Makefile->GetCurrentOutputDirectory(); + std::string utilityDirectory = this->Makefile->GetCurrentBinaryDirectory(); std::string exePath; if (this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 838d390cb..99086ded9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -927,7 +927,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path, { return forceRelative ? cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), path.c_str()) + this->Makefile->GetCurrentBinaryDirectory(), path.c_str()) : this->LocalGenerator->Convert(path.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED, @@ -1430,7 +1430,7 @@ void cmVisualStudio10TargetGenerator::WriteSource( std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true); size_t const maxLen = 250; if(sf->GetCustomCommand() || - ((strlen(this->Makefile->GetCurrentOutputDirectory()) + 1 + + ((strlen(this->Makefile->GetCurrentBinaryDirectory()) + 1 + sourceRel.length()) <= maxLen)) { forceRelative = true; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 7d33f0454..d82087f07 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -159,7 +159,7 @@ static void cmakemainProgressCallback(const char *m, float prog, else if ((mf) && (strstr(m, "Generating")==m)) { dir = " "; - dir += mf->GetCurrentOutputDirectory(); + dir += mf->GetCurrentBinaryDirectory(); } if ((prog < 0) || (!dir.empty())) From 32b8f03acc0357121ec8f2b96599d5eeaf38c0b4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 20:06:54 +0200 Subject: [PATCH 0618/1029] cmMakefile: Port users of GetStart* methods to new names. --- Source/cmCPluginAPI.cxx | 4 +- Source/cmExtraCodeBlocksGenerator.cxx | 10 ++-- Source/cmExtraCodeLiteGenerator.cxx | 10 ++-- Source/cmExtraEclipseCDT4Generator.cxx | 4 +- Source/cmExtraQbsGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 4 +- Source/cmFLTKWrapUICommand.cxx | 4 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmGetDirectoryPropertyCommand.cxx | 2 +- Source/cmGlobalBorlandMakefileGenerator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 12 ++--- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 14 ++--- Source/cmGlobalVisualStudio6Generator.cxx | 6 +-- Source/cmGlobalVisualStudio7Generator.cxx | 8 +-- Source/cmGlobalVisualStudioGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 8 +-- Source/cmIncludeCommand.cxx | 2 +- Source/cmIncludeDirectoryCommand.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 2 +- Source/cmLinkDirectoriesCommand.cxx | 2 +- Source/cmLocalGenerator.cxx | 52 ++++++++++--------- Source/cmLocalGhsMultiGenerator.cxx | 2 +- Source/cmLocalNinjaGenerator.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.cxx | 18 +++---- Source/cmLocalVisualStudio6Generator.cxx | 18 +++---- Source/cmLocalVisualStudio7Generator.cxx | 14 ++--- Source/cmMakefile.cxx | 8 +-- .../cmMakefileExecutableTargetGenerator.cxx | 6 +-- Source/cmMakefileLibraryTargetGenerator.cxx | 8 +-- Source/cmMakefileTargetGenerator.cxx | 16 +++--- Source/cmNinjaTargetGenerator.cxx | 3 +- Source/cmOutputRequiredFilesCommand.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 4 +- Source/cmTarget.cxx | 8 +-- Source/cmTargetIncludeDirectoriesCommand.cxx | 3 +- Source/cmVisualStudio10TargetGenerator.cxx | 10 ++-- Source/cmake.cxx | 4 +- 39 files changed, 146 insertions(+), 142 deletions(-) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 4f1fa3cee..c55ea3597 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -131,12 +131,12 @@ const char* CCONV cmGetHomeOutputDirectory(void *arg) const char* CCONV cmGetStartDirectory(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetStartDirectory(); + return mf->GetCurrentSourceDirectory(); } const char* CCONV cmGetStartOutputDirectory(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetStartOutputDirectory(); + return mf->GetCurrentBinaryDirectory(); } const char* CCONV cmGetCurrentDirectory(void *arg) { diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index dfa2cb1af..e374387de 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -77,7 +77,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile( const std::vector& lgs) { const cmMakefile* mf=lgs[0]->GetMakefile(); - std::string outputDir=mf->GetStartOutputDirectory(); + std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectName=mf->GetProjectName(); std::string filename=outputDir+"/"; @@ -331,7 +331,7 @@ void cmExtraCodeBlocksGenerator { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs - if (strcmp(makefile->GetStartOutputDirectory(), + if (strcmp(makefile->GetCurrentBinaryDirectory(), makefile->GetHomeOutputDirectory())==0) { this->AppendTarget(fout, ti->first, 0, @@ -550,14 +550,14 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, const cmMakefile* makefile, const char* compiler) { - std::string makefileName = makefile->GetStartOutputDirectory(); + std::string makefileName = makefile->GetCurrentBinaryDirectory(); makefileName += "/Makefile"; fout<<" \n"; if (target!=0) { int cbTargetType = this->GetCBTargetType(target); - std::string workingDir = makefile->GetStartOutputDirectory(); + std::string workingDir = makefile->GetCurrentBinaryDirectory(); if ( target->GetType()==cmTarget::EXECUTABLE) { // Determine the directory where the executable target is created, and @@ -653,7 +653,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, else // e.g. all and the GLOBAL and UTILITY targets { fout<<"