diff options
113 files changed, 579 insertions, 475 deletions
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index db56010..76058f9 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 0000000..58bf6ec --- /dev/null +++ b/Help/module/CheckFortranCompilerFlag.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CheckFortranCompilerFlag.cmake 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 0000000..e6ef70f --- /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. diff --git a/Help/release/dev/add-CheckFortranCompilerFlag.rst b/Help/release/dev/add-CheckFortranCompilerFlag.rst new file mode 100644 index 0000000..718b53e --- /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``. diff --git a/Help/release/dev/makefile-progress-improvements.rst b/Help/release/dev/makefile-progress-improvements.rst new file mode 100644 index 0000000..9cc9706 --- /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). diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 19b2bbc..3141d60 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/CPackRPM.cmake b/Modules/CPackRPM.cmake index 43e3fe0..214d655 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -442,7 +442,7 @@ function(cpack_rpm_prepare_relocation_paths) # set other path prefixes foreach(RELOCATION_PATH ${RPM_RELOCATION_PATHS}) - if(IS_ABSOLUTE "${RELOCATE_PATH}") + if(IS_ABSOLUTE "${RELOCATION_PATH}") set(PREPARED_RELOCATION_PATH "${RELOCATION_PATH}") else() set(PREPARED_RELOCATION_PATH "${PATH_PREFIX}/${RELOCATION_PATH}") diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake new file mode 100644 index 0000000..53fd8d6 --- /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(<flag> <var>) +# +# :: +# +# <flag> - the compiler flag +# <var> - 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 <flag>. 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 <nicolasbock@gmail.com> +# Copyright 2006-2011 Kitware, Inc. +# Copyright 2006 Alexander Neundorf <neundorf@kde.org> +# Copyright 2011 Matthias Kretz <kretz@kde.org> +# +# 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 () diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 99293c1..466090b 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_<C>_LIBRARY_DEBUG - Component <C> library debug variant # Boost_<C>_LIBRARY_RELEASE - Component <C> 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_<C>_LIBRARY_DEBUG and Boost_<C>_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}) - 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) +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() - 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() + # 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() + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}") + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") - _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_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() + # 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() + # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS}") + string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") - _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_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. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 07839f3..8a83c3e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -277,6 +277,7 @@ set(SRCS cmLocalGenerator.cxx cmLocalGenerator.h cmLocalUnixMakefileGenerator3.cxx + cmLocale.h ${MACH_SRCS} cmMakeDepend.cxx cmMakeDepend.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a7d6c4b..03df29d 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 20150210) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index d9d6236..1d7afbd 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<char*>(path); + std::string fullScriptPath = reinterpret_cast<char*>(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<const char*> args; + std::vector<const char*> 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 8f63ca2..fe6cc95 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<unsigned long>(fileNum)),".") && strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),"..")) { - cmsys_stl::string fullPath = topdir; + std::string fullPath = topdir; fullPath += "/"; fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); if(cmsys::SystemTools::FileIsDirectory(fullPath) && diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 00bfe5b..6106472 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -26,7 +26,6 @@ #include <cmsys/CommandLineArguments.hxx> #include <cmsys/SystemTools.hxx> #include <cmsys/Encoding.hxx> -#include <locale.h> //---------------------------------------------------------------------------- static const char * cmDocumentationName[][2] = @@ -101,7 +100,6 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, // this is CPack. int main (int argc, char const* const* argv) { - setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = args.argc(); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 08b7c66..1226d22 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -2542,10 +2542,10 @@ bool cmCTestCoverageHandler::IntersectsFilter(LabelSet const& labels) } std::vector<int> 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/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 28f3d9b..3d92a2d 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -16,7 +16,6 @@ #include <signal.h> #include <sys/ioctl.h> -#include <locale.h> #include "cmCursesMainForm.h" #include "cmCursesStandardIncludes.h" @@ -95,8 +94,6 @@ void CMakeMessageHandler(const char* message, const char* title, bool&, int main(int argc, char const* const* argv) { - setlocale(LC_CTYPE, ""); - cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = encoding_args.argc(); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 82fa3a3..8a72a24 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/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index db2f6fb..edf82bd 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); diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index c24c68e..cf2fe82 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -12,6 +12,7 @@ #include "cmArchiveWrite.h" #include "cmSystemTools.h" +#include "cmLocale.h" #include <cmsys/ios/iostream> #include <cmsys/Directory.hxx> #include <cmsys/FStream.hxx> @@ -260,6 +261,9 @@ bool cmArchiveWrite::AddFile(const char* file, } const char* out = file + skip; + cmLocaleRAII localeRAII; + static_cast<void>(localeRAII); + // Meta-data. std::string dest = prefix? prefix : ""; dest += out; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index d0dc30a..691d80d 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<cmMakefile *>(arg); + (void)arg; + (void)startArgumentIndex; std::vector<std::string> result; - std::vector<std::string> 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<int>(result.size()); char **resargv = 0; if (resargc) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 32d5cd3..8652690 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,11 +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()); - i->erase(last, i->end()); + i->erase(std::unique(i->begin(), i->end()), i->end()); } } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 5b5d6b6..c414553 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -296,7 +296,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> 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; diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index f7d8243..488beaa 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<std::string> 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<std::string>::iterator i = (newArgs.begin() + 1); - i != newArgs.end(); i++) + for(std::vector<std::string>::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/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 579e715..8b893bc 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 78f0e9e..c499f61 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -195,12 +195,12 @@ struct cmFindLibraryHelper void RegexFromList(std::string& out, std::vector<std::string> 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/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5f1bb83..e0ccaa9 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<unsigned long>& progFiles = + this->ProgressMap[gtarget->Target].Marks; + for (std::vector<unsigned long>::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<unsigned long>& progFiles = - this->ProgressMap[gtarget->Target].Marks; - for (std::vector<unsigned long>::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/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cd0dcc6..30ed134 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<std::string> languages; + target.GetLanguages(languages, configName); + std::map<std::string, std::string> cflags; + for (std::set<std::string>::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 llang = target.GetLinkerLanguage(configName); + if(binary && llang.empty()) + { cmSystemTools::Error ("CMake can not determine linker language for target: ", target.GetName().c_str()); return; - } + } // Add define flags this->CurrentLocalGenerator-> @@ -2004,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()) { @@ -2032,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 += " "; @@ -2043,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()) { @@ -2077,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()) { @@ -2094,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 += " "; @@ -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<std::string, std::string> gflags; + std::string const* last_gflag = 0; char optLevel[2]; optLevel[0] = '0'; optLevel[1] = 0; - if(oflagc.size() == 3) - { - 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") + + // Minimal map of flags to build settings. + for (std::set<std::string>::iterator li = languages.begin(); + li != languages.end(); ++li) { - 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<std::string>::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,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString("NO")); buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN", this->CreateString("NO")); - if(lang == "CXX") + for (std::set<std::string>::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 == "Fortran") + { + buildSettings->AddAttribute("IFORT_OTHER_FLAGS", + 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. diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 06a78e5..85e5345 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -15,9 +15,9 @@ // cmExecutableCommand bool cmInstallFilesCommand -::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &) +::InitialPass(std::vector<std::string> 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<std::string> args; - this->Makefile->ExpandSourceListArguments(argsIn, args, 2); - this->Destination = args[0]; if((args.size() > 1) && (args[1] == "FILES")) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7ca7684..7afe05f 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, ":", "_"); @@ -3645,26 +3641,21 @@ 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; - 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 == '(') + if (define[pos] == '(') { - function_style = true; - break; + 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(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; - } // Many compilers do not support # in the value so we disable it. if(define.find_first_of("#") != define.npos) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fbf2140..54d330f 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 <cmsys/Terminal.h> #endif #include <cmsys/auto_ptr.hxx> +#include <cmsys/Terminal.h> #include <queue> @@ -1346,12 +1346,12 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& 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; -#ifdef CMAKE_BUILD_WITH_CMAKE if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile) { // See cmake::ExecuteEchoColor in cmake.cxx for these options. @@ -1367,7 +1367,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, color_name = "--green "; break; case EchoLink: - color_name = "--red --bold "; + color_name = "--green --bold "; break; case EchoGenerate: color_name = "--blue --bold "; @@ -1377,14 +1377,11 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, break; } } -#else - (void)color; -#endif // 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') { @@ -1393,7 +1390,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& 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 "; @@ -1404,6 +1401,17 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& 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); @@ -1412,6 +1420,9 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, // Reset the line to emtpy. line = ""; + // Progress appears only on first line. + progress = 0; + // Terminate on end-of-string. if(*c == '\0') { @@ -1617,14 +1628,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); } @@ -2393,14 +2400,10 @@ 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::vector<std::string>::iterator i = commands.begin(); - for (; i != commands.end(); ++i) - { - std::string cmd = cd_cmd; - cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); - cmd += " && "; - cmd += *i; - *i = cmd; - } + std::string outputForExisting = + this->ConvertToOutputForExisting(tgtDir, relRetDir); + std::string prefix = cd_cmd + outputForExisting + " && "; + std::transform(commands.begin(), commands.end(), commands.begin(), + std::bind1st(std::plus<std::string>(), prefix)); } } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7c8e27f..1ff5e7f 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<std::string>& commands, const char* text, - EchoColor color = EchoNormal); + struct EchoProgress { std::string Dir; std::string Arg; }; + void AppendEcho(std::vector<std::string>& 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/cmLocale.h b/Source/cmLocale.h new file mode 100644 index 0000000..727f0f5 --- /dev/null +++ b/Source/cmLocale.h @@ -0,0 +1,31 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-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 cmLocale_h +#define cmLocale_h + +#include <locale.h> + +class cmLocaleRAII +{ + const char* OldLocale; +public: + cmLocaleRAII(): OldLocale(setlocale(LC_CTYPE, 0)) + { + setlocale(LC_CTYPE, ""); + } + ~cmLocaleRAII() + { + setlocale(LC_CTYPE, this->OldLocale); + } +}; + +#endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ff3e35d..eb68e49 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3577,19 +3577,6 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const & lang, optional); } -void cmMakefile::ExpandSourceListArguments( - std::vector<std::string> const& arguments, - std::vector<std::string>& 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 110db24..895a2fc 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -600,17 +600,6 @@ public: */ void AddSystemIncludeDirectories(const std::set<std::string> &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<std::string> const& argsIn, - std::vector<std::string>& 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. */ diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index d4036d2..ab58cbd 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 cdda36c..84761cc 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; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7ed0c10..20207f5 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -618,16 +618,19 @@ cmMakefileTargetGenerator std::vector<std::string> 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<std::string>& 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 e31e086..b072cfa 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<std::string>& 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/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index a984260..878562c 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -12,19 +12,15 @@ #include "cmQTWrapCPPCommand.h" // cmQTWrapCPPCommand -bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn, +bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> 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<std::string> 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<std::string> const& argsIn, this->Makefile->GetSafeDefinition(sourceList); // Create a rule for all sources listed. - for(std::vector<std::string>::iterator j = (args.begin() + 2); + for(std::vector<std::string>::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 dce59ef..9b92b1e 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -12,19 +12,15 @@ #include "cmQTWrapUICommand.h" // cmQTWrapUICommand -bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, +bool cmQTWrapUICommand::InitialPass(std::vector<std::string> 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<std::string> 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<std::string> const& argsIn, this->Makefile->GetSafeDefinition(sourceList); // Create rules for all sources listed. - for(std::vector<std::string>::iterator j = (args.begin() + 3); + for(std::vector<std::string>::const_iterator j = (args.begin() + 3); j != args.end(); ++j) { cmSourceFile *curr = this->Makefile->GetSource(*j); diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index aeb8077..e41a0ca 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -35,19 +35,12 @@ bool cmSetTargetPropertiesCommand doingFiles = false; // now loop through the rest of the arguments, new style ++j; - while (j != args.end()) + if (std::distance(j, args.end()) % 2 != 0) { - propertyPairs.push_back(*j); - ++j; - if(j == args.end()) - { - this->SetError("called with incorrect number of arguments."); - return false; - } - propertyPairs.push_back(*j); - ++j; + this->SetError("called with incorrect number of arguments."); + return false; } - // 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 e66d13d..d079a19 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -36,19 +36,12 @@ bool cmSetTestsPropertiesCommand doingFiles = false; // now loop through the rest of the arguments, new style ++j; - while (j != args.end()) + if (std::distance(j, args.end()) % 2 != 0) { - propertyPairs.push_back(*j); - ++j; - if(j == args.end()) - { - this->SetError("called with incorrect number of arguments."); - return false; - } - propertyPairs.push_back(*j); - ++j; + this->SetError("called with incorrect number of arguments."); + return false; } - // 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/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e9735ed..7dd6121 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -26,11 +26,12 @@ #include <cmsys/Encoding.hxx> #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmArchiveWrite.h" +# include "cmLocale.h" # include <cm_libarchive.h> -# include <cmsys/Terminal.h> #endif #include <cmsys/stl/algorithm> #include <cmsys/FStream.hxx> +#include <cmsys/Terminal.h> #if defined(_WIN32) # include <windows.h> @@ -366,13 +367,17 @@ bool cmSystemTools::IsInternallyOn(const char* val) return false; } std::basic_string<char> v = val; + if (v.size() > 4) + { + return false; + } for(std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) { *c = static_cast<char>(toupper(*c)); } - return (v == "I_ON" || v == "i_on"); + return v == "I_ON"; } bool cmSystemTools::IsOn(const char* val) @@ -1690,6 +1695,8 @@ long copy_data(struct archive *ar, struct archive *aw) bool extract_tar(const char* outFileName, bool verbose, bool extract) { + cmLocaleRAII localeRAII; + static_cast<void>(localeRAII); struct archive* a = archive_read_new(); struct archive *ext = archive_write_disk_new(); archive_read_support_compression_all(a); @@ -2284,7 +2291,6 @@ std::string const& cmSystemTools::GetCMakeRoot() } //---------------------------------------------------------------------------- -#if defined(CMAKE_BUILD_WITH_CMAKE) void cmSystemTools::MakefileColorEcho(int color, const char* message, bool newline, bool enabled) { @@ -2305,16 +2311,21 @@ 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"); } } -#endif //---------------------------------------------------------------------------- bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, @@ -2695,7 +2706,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/cmSystemTools.h b/Source/cmSystemTools.h index 361f42e..c59ae96 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/cmTarget.cxx b/Source/cmTarget.cxx index 98cb75c..f0bdea7 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<std::string>::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; } @@ -5919,8 +5915,7 @@ cmTarget::GetCompatibleInterfaces(std::string const& config) const { \ std::vector<std::string> 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) diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx index 72fdc34..99f5625 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<unsigned long>(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 cba9f39..c23a90c 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; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 4b6af0a..47be481 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2733,11 +2733,10 @@ std::vector<std::string> const& cmake::GetDebugConfigs() { // Expand the specified list and convert to upper-case. cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); - for(std::vector<std::string>::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()) diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 6d25b70..e0bd55b 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -25,7 +25,6 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include <cmsys/Encoding.hxx> -#include <locale.h> #ifdef CMAKE_BUILD_WITH_CMAKE //---------------------------------------------------------------------------- @@ -173,7 +172,6 @@ static void cmakemainProgressCallback(const char *m, float prog, int main(int ac, char const* const* av) { - setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); ac = args.argc(); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 28fcd27..5260cb0 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 <cmsys/Terminal.h> #endif #include <cmsys/Directory.hxx> #include <cmsys/Process.h> #include <cmsys/FStream.hxx> +#include <cmsys/Terminal.h> #if defined(CMAKE_HAVE_VS_GENERATORS) #include "cmCallVisualStudioMacro.h" @@ -534,48 +534,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& 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<int> - (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; } @@ -753,12 +714,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& 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 +948,65 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) } //---------------------------------------------------------------------------- -#ifdef CMAKE_BUILD_WITH_CMAKE +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<int> + (cmsys::Directory::GetNumberOfFilesInDirectory(dirName)); + if (count > 0) + { + // print the progress + fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count); + } +} + +//---------------------------------------------------------------------------- int cmcmd::ExecuteEchoColor(std::vector<std::string>& args) { // The arguments are @@ -997,6 +1016,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& 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) @@ -1015,6 +1035,18 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& 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; @@ -1073,12 +1105,6 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args) return 0; } -#else -int cmcmd::ExecuteEchoColor(std::vector<std::string>&) -{ - return 1; -} -#endif //---------------------------------------------------------------------------- int cmcmd::ExecuteLinkScript(std::vector<std::string>& args) diff --git a/Source/ctest.cxx b/Source/ctest.cxx index b77c231..c0eb8ac 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -19,7 +19,6 @@ #include "CTest/cmCTestScriptHandler.h" #include "CTest/cmCTestLaunch.h" #include "cmsys/Encoding.hxx" -#include <locale.h> //---------------------------------------------------------------------------- static const char * cmDocumentationName[][2] = @@ -117,8 +116,6 @@ static const char * cmDocumentationOptions[][2] = // this is a test driver program for cmCTest. int main (int argc, char const* const* argv) { - setlocale(LC_CTYPE, ""); - cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = encoding_args.argc(); diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index 43c0ba7..c018e08 100644 --- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in @@ -1,14 +1,12 @@ #include <cmSystemTools.h> #include <cmsys/Encoding.hxx> #include <string> -#include <locale.h> #define RETVAL @_retval@ int main(int ac, char **av) { - setlocale(LC_CTYPE, ""); cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); int argc = args.argc(); diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index 1b2651d..9bf0303 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. 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 801655f..2973fe9 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() diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycleSolved-stderr.txt deleted file mode 100644 index 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 33b745d..6389ef4 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() diff --git a/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt deleted file mode 100644 index 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- 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 10f3293..0000000 --- a/Tests/RunCMake/project/CMP0048-NEW-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ @@ -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 \ |