diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-05-01 12:35:40 -0400 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-05-01 12:35:40 -0400 |
commit | c89ebb4240a711fb269f006b5005d530e920b95a (patch) | |
tree | 1ab93dec63b05a90743fac386870826191dbce40 | |
parent | 1bab9241ec64170b345478d349e5230141cc06f2 (diff) | |
download | cmake-c89ebb4240a711fb269f006b5005d530e920b95a.tar.gz |
ENH: merge from cvs create yikes RC 10! (I hope this is the last RC...)
49 files changed, 663 insertions, 176 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c83cd0481f..0e7c6ca1cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,7 +354,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 6) SET(CMake_VERSION_PATCH 0) -SET(CMake_VERSION_RC 9) +SET(CMake_VERSION_RC 10) # CVS versions are odd, if this is an odd minor version # then set the CMake_VERSION_DATE variable IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") diff --git a/ChangeLog.manual b/ChangeLog.manual index e7bd12f194..fad06db0bd 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,19 @@ +Changes in CMake 2.6.0 RC 10 +- Do not duplicate .so libraries on the link line +- Add more system library paths to sun builds +- Add BETA support for Intel Fortran IDE files in visual studio +- Fix FindCurses to work if ncurses is the only option +- Fix shell escapes on some systems +- Remove check for file write as input to cmake, as it is no longer needed +- Make check_type_size automatically check for headers that it uses +- Remove minimum required from FindBoost.cmake +- Fix FindSDL so that it can be run more than once +- Fix find required for VTK package +- Allow for CMAKE_OSX_SYSROOT to work with single architecture +- Add context information when a source file cannot be found. +- Report the directory-level context even if no list file + is currently being processed. + Changes in CMake 2.6.0 RC 9 - Fix for fortran mod:: support diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 0e7e364a8d..cc5dcebce8 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -1,9 +1,16 @@ # - Check sizeof a type -# CHECK_TYPE_SIZE(TYPE VARIABLE) +# CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY]) # Check if the type exists and determine size of type. if the type -# exists, the size will be stored to the variable. +# exists, the size will be stored to the variable. This also +# calls check_include_file for sys/types.h stdint.h +# and stddef.h, setting HAVE_SYS_TYPES_H, HAVE_STDINT_H, +# and HAVE_STDDEF_H. This is because many types are stored +# in these include files. # VARIABLE - variable to store size if the type exists. # HAVE_${VARIABLE} - does the variable exists or not +# BUILTIN_TYPES_ONLY - The third argument is optional and if +# it is set to the string BUILTIN_TYPES_ONLY +# this macro will not check for any header files. # The following variables may be set before calling this macro to # modify the way the check is run: # @@ -12,7 +19,18 @@ # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# These variables are referenced in CheckTypeSizeC.c so we have +# to check for them. + +include(CheckIncludeFile) + MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) + IF(NOT "${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY") + check_include_file(sys/types.h HAVE_SYS_TYPES_H) + check_include_file(stdint.h HAVE_STDINT_H) + check_include_file(stddef.h HAVE_STDDEF_H) + ENDIF(NOT "${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY") + IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") MESSAGE(STATUS "Check size of ${TYPE}") SET(CHECK_TYPE_SIZE_TYPE "${TYPE}") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index fe9025ad4a..ab00fcc723 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -93,7 +93,11 @@ # # this module required CMake 2.5 for the Boost_FIND_VERSION stuff -CMAKE_MINIMUM_REQUIRED(VERSION "2.6" FATAL_ERROR) + +# this must not be done in find modules, it changes the policy settings, which may have been +# set in the projects cmake files. +# beside that this module comes with cmake, so the cmake version is always correct, Alex +# CMAKE_MINIMUM_REQUIRED(VERSION "2.6" FATAL_ERROR) # MESSAGE(STATUS "Finding Boost libraries.... ") diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index cd170c1268..3eb54e5f5c 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -70,7 +70,11 @@ ELSE(NOT CURSES_USE_NCURSES) FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h) SET(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}") - SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "path to curses") + SET(FORCE_ARG "") + IF("${CURSES_LIBRARY}" STREQUAL "CURSES_LIBRARY-NOTFOUND") + SET(FORCE_ARG "FORCE") + ENDIF("${CURSES_LIBRARY}" STREQUAL "CURSES_LIBRARY-NOTFOUND") + SET(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" CACHE FILEPATH "path to curses" ${FORCE_ARG}) ENDIF(NOT CURSES_USE_NCURSES) diff --git a/Modules/FindKDE.cmake b/Modules/FindKDE.cmake deleted file mode 100644 index 58f32064e9..0000000000 --- a/Modules/FindKDE.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -# I don't think anybody actually used this file -# at least not in any large scale -# so it should be safe to obsolete it now -# -# Alex <neundorf@kde.org> - -MESSAGE(FATAL_ERROR "FindKDE.cmake is obsolete, please use FindKDE3.cmake or FindKDE4.cmake instead.") - diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 64d4262255..75b42cca0a 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -183,7 +183,7 @@ IF(SDL_LIBRARY_TEMP) # Set the final string here so the GUI reflects the final state. SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - SET(SDL_LIBRARY_TEMP "" CACHE INTERNAL "") + SET(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "") SET(SDL_FOUND "YES") ENDIF(SDL_LIBRARY_TEMP) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 64a0d5faf2..71d7334cee 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -270,7 +270,6 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) /opt/csw/lib /opt/lib ) - SET(TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK "" CACHE INTERNAL "") IF(VORBIS_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY}) ENDIF(VORBIS_LIBRARY) diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index f79a7026a6..6e42ba3fd5 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -130,11 +130,11 @@ IF(VTK_FOUND) SET(USE_VTK_FILE ${VTK_USE_FILE}) ELSE(VTK_FOUND) # VTK not found, explain to the user how to specify its location. - IF(NOT VTK_FIND_QUIETLY) + IF(VTK_FIND_REQUIRED) MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE}) - ELSE(NOT VTK_FIND_QUIETLY) - IF(VTK_FIND_REQUIRED) - MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE}) - ENDIF(VTK_FIND_REQUIRED) - ENDIF(NOT VTK_FIND_QUIETLY) + ELSE(VTK_FIND_REQUIRED) + IF(NOT VTK_FIND_QUIETLY) + MESSAGE(STATUS ${VTK_DIR_MESSAGE}) + ENDIF(NOT VTK_FIND_QUIETLY) + ENDIF(VTK_FIND_REQUIRED) ENDIF(VTK_FOUND) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index dfdc8eb7f8..ecc465ca13 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -57,6 +57,7 @@ IF(_CMAKE_OSX_SDKS) LIST(SORT _CMAKE_OSX_SDKS) LIST(REVERSE _CMAKE_OSX_SDKS) LIST(GET _CMAKE_OSX_SDKS 0 _CMAKE_OSX_SDKS) + SET(CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS}") # use the environment variable CMAKE_OSX_SYSROOT if it is set IF(NOT "$ENV{CMAKE_OSX_SYSROOT}" STREQUAL "") SET(_CMAKE_OSX_SDKS "$ENV{CMAKE_OSX_SYSROOT}") diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake new file mode 100644 index 0000000000..bde187e159 --- /dev/null +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -0,0 +1,13 @@ +SET (CMAKE_C_FLAGS_INIT "") +SET (CMAKE_C_FLAGS_DEBUG_INIT "-g") +SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") +SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + +FIND_PROGRAM(XIAR xiar) +IF(XIAR) + SET(CMAKE_C_CREATE_STATIC_LIBRARY + "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "${XIAR} -s <TARGET> ") +ENDIF(XIAR) +MARK_AS_ADVANCED(XIAR) diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake new file mode 100644 index 0000000000..bcc3d78774 --- /dev/null +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -0,0 +1,13 @@ +SET (CMAKE_CXX_FLAGS_INIT "") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + +FIND_PROGRAM(XIAR xiar) +IF(XIAR) + SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "${XIAR} -s <TARGET> ") +ENDIF(XIAR) +MARK_AS_ADVANCED(XIAR) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake new file mode 100644 index 0000000000..06de82b243 --- /dev/null +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -0,0 +1,14 @@ +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared") +SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,") +SET(CMAKE_Fortran_MODDIR_FLAG "-module ") + +SET (CMAKE_Fortran_FLAGS_INIT "") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index f6fdf77d43..cccd0d4ba0 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -62,6 +62,12 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_COMPILER_IS_GNUCXX) INCLUDE(Platform/UnixPaths) +# Add the compiler's implicit link directories. +IF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) + LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) +ENDIF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) + IF(NOT CMAKE_COMPILER_IS_GNUCC) SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake index 295fa3e911..2bf4753cf5 100644 --- a/Modules/Platform/Windows-ifort.cmake +++ b/Modules/Platform/Windows-ifort.cmake @@ -42,7 +42,7 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu # does the compiler support pdbtype and is it the newer compiler SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_Fortran_FLAGS_INIT "/W1") +SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp") SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/MD /O1 /D NDEBUG") diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 1fc3467fd0..9004459209 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -33,7 +33,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string templateDirectory = args[0]; this->Makefile->AddExtraDirectory(templateDirectory.c_str()); std::string tdir; - if(!cmSystemTools::FileExists(templateDirectory.c_str())) + if(!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) { tdir = this->Makefile->GetCurrentDirectory(); tdir += "/"; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 72dd1982be..305c06d67d 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -24,6 +24,7 @@ #include "cmake.h" #include <cmsys/stl/algorithm> +#include <cmsys/RegularExpression.hxx> #include <assert.h> @@ -198,6 +199,12 @@ void cmComputeLinkDepends::SetOldLinkDirMode(bool b) } //---------------------------------------------------------------------------- +void cmComputeLinkDepends::SetSharedRegex(std::string const& regex) +{ + this->SharedRegexString = regex; +} + +//---------------------------------------------------------------------------- std::vector<cmComputeLinkDepends::LinkEntry> const& cmComputeLinkDepends::Compute() { @@ -874,6 +881,9 @@ void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item) //---------------------------------------------------------------------------- void cmComputeLinkDepends::PreserveOriginalEntries() { + // Regular expression to match shared libraries. + cmsys::RegularExpression shared_lib(this->SharedRegexString.c_str()); + // Skip the part of the input sequence that already appears in the // output. std::vector<int>::const_iterator in = this->OriginalEntries.begin(); @@ -882,7 +892,8 @@ void cmComputeLinkDepends::PreserveOriginalEntries() out != this->FinalLinkOrder.end()) { cmTarget* tgt = this->EntryList[*in].Target; - if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) + if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) || + (!tgt && shared_lib.find(this->EntryList[*in].Item))) { // Skip input items known to not be static libraries. ++in; @@ -905,7 +916,8 @@ void cmComputeLinkDepends::PreserveOriginalEntries() while(in != this->OriginalEntries.end()) { cmTarget* tgt = this->EntryList[*in].Target; - if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) + if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) || + (!tgt && shared_lib.find(this->EntryList[*in].Item))) { // Skip input items known to not be static libraries. ++in; diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 3e42580df8..1b2809bd46 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -58,6 +58,10 @@ public: std::set<cmTarget*> const& GetOldWrongConfigItems() const { return this->OldWrongConfigItems; } + /** Set a regular expression that matches strings ending in a shared + library extension. */ + void SetSharedRegex(std::string const& regex); + private: // Context information. @@ -137,6 +141,7 @@ private: // Preservation of original link line. std::vector<int> OriginalEntries; void PreserveOriginalEntries(); + std::string SharedRegexString; // Compatibility help. bool OldLinkDirMode; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 5e105371a2..b133e3570b 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -511,6 +511,7 @@ bool cmComputeLinkInformation::Compute() // Compute the ordered link line items. cmComputeLinkDepends cld(this->Target, this->Config); cld.SetOldLinkDirMode(this->OldLinkDirMode); + cld.SetSharedRegex(this->SharedRegexString); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); // Add the link line items. @@ -864,7 +865,9 @@ void cmComputeLinkInformation::ComputeItemParserInfo() if(!this->SharedLinkExtensions.empty()) { std::string reg_shared = reg; - reg_shared += this->CreateExtensionRegex(this->SharedLinkExtensions); + this->SharedRegexString = + this->CreateExtensionRegex(this->SharedLinkExtensions); + reg_shared += this->SharedRegexString; #ifdef CM_COMPUTE_LINK_INFO_DEBUG fprintf(stderr, "shared regex [%s]\n", reg_shared.c_str()); #endif diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 31d0e33594..0ac0afc674 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -129,6 +129,7 @@ private: cmsys::RegularExpression ExtractStaticLibraryName; cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; + std::string SharedRegexString; void AddLinkPrefix(const char* p); void AddLinkExtension(const char* e, LinkType type); std::string CreateExtensionRegex(std::vector<std::string> const& exts); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 1e0a8d92cb..e1bbe29d9c 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -79,6 +79,12 @@ bool cmExportFileGenerator::GenerateImportFile() } std::ostream& os = *foutPtr; + // Protect that file against use with older CMake versions. + os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; + os << "IF(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" + << " MESSAGE(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" + << "ENDIF(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"; + // Isolate the file policy level. // We use 2.6 here instead of the current version because newer // versions of CMake should be able to export files imported by 2.6 diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index cd36e06477..87570d95aa 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmake.h" +#include "cmVersion.h" #include <cmsys/auto_ptr.hxx> @@ -172,6 +173,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const // versions. const char* vertest = "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4"; + fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; fout << "IF(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; for(std::map<cmStdString, cmStdString>::const_iterator diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 3cf6c0be68..d6c6f563f9 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -213,7 +213,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, file << message; file.close(); cmSystemTools::SetPermissions(fileName.c_str(), mode); - this->Makefile->AddWrittenFile(fileName.c_str()); return true; } diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 3f72cd2867..4173859876 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -90,10 +90,6 @@ public: "if it does not exist.\n" "APPEND will write a message into a file same as WRITE, except " "it will append it to the end of the file\n" - "NOTE: When using file WRITE and file APPEND, the produced file " - "cannot be used as an input to CMake (configure_file, source file ...) " - "because it will lead to an infinite loop. Use configure_file if you " - "want to generate input files to CMake.\n" "READ will read the content of a file and store it into the " "variable. It will start at the given offset and read up to numBytes. " "If the argument HEX is given, the binary data will be converted to " diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cf9d0a9d30..b5893327cb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -912,7 +912,6 @@ void cmGlobalGenerator::CheckLocalGenerators() } this->CMakeInstance->UpdateProgress ("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size()); - this->LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops(); } if(notFoundMap.size()) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index b3abec7a21..78bc0ec74c 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -153,10 +153,19 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const char* dir, cmTarget& t) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + // check to see if this is a fortran build + const char* ext = ".vcproj"; + const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; + if(this->TargetIsFortranOnly(t)) + { + ext = ".vfproj"; + project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \""; + } + + fout << project << dspname << "\", \"" << this->ConvertToSolutionPath(dir) - << "\\" << dspname << ".vcproj\", \"{" + << "\\" << dspname << ext << "\", \"{" << this->GetGUID(dspname) << "}\"\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3432622d62..fa883392de 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -35,7 +35,7 @@ void cmGlobalVisualStudio7Generator mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - mf->AddDefinition("CMAKE_GENERATOR_Fortran", "ifort"); + mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort"); this->AddPlatformDefinitions(mf); @@ -482,12 +482,21 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* dspname, - const char* dir, cmTarget&) -{ - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + const char* dir, cmTarget& target) +{ + // check to see if this is a fortran build + const char* ext = ".vcproj"; + const char* project = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""; + if(this->TargetIsFortranOnly(target)) + { + ext = ".vfproj"; + project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \""; + } + + fout << project << dspname << "\", \"" << this->ConvertToSolutionPath(dir) - << "\\" << dspname << ".vcproj\", \"{" + << "\\" << dspname << ext << "\", \"{" << this->GetGUID(dspname) << "}\"\nEndProject\n"; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index efa9adfbc5..e28b293302 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -704,3 +704,17 @@ void RegisterVisualStudioMacros(const std::string& macrosFile, } } } +bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget& target) +{ + // check to see if this is a fortran build + std::set<cmStdString> languages; + target.GetLanguages(languages); + if(languages.size() == 1) + { + if(*languages.begin() == "Fortran") + { + return true; + } + } + return false; +} diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 750418c20d..ce03049f16 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -63,6 +63,9 @@ public: */ virtual void CallVisualStudioMacro(MacroName m, const char* vsSolutionFile = 0); + + // return true if target is fortran only + bool TargetIsFortranOnly(cmTarget& t); protected: virtual void CreateGUID(const char*) {} diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 33820aa05f..3e31a42fa9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2451,14 +2451,29 @@ void cmGlobalXCodeGenerator this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); + const char* sysrootDefault = + this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); if(osxArch && sysroot) { + bool flagsUsed = false; // recompute this as it may have been changed since enable language this->Architectures.clear(); cmSystemTools::ExpandListArgument(std::string(osxArch), this->Architectures); - if(this->Architectures.size() > 1) + bool addArchFlag = true; + if(this->Architectures.size() == 1) { + const char* archOrig = + this-> + CurrentMakefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES_DEFAULT"); + if(this->Architectures[0] == archOrig) + { + addArchFlag = false; + } + } + if(addArchFlag) + { + flagsUsed = true; buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); std::string archString; @@ -2472,6 +2487,12 @@ void cmGlobalXCodeGenerator buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); } + if(!flagsUsed && sysrootDefault && + strcmp(sysroot, sysrootDefault) != 0) + { + buildSettings->AddAttribute("SDKROOT", + this->CreateString(sysroot)); + } } for( std::vector<cmXCodeObject*>::iterator i = configs.begin(); i != configs.end(); ++i) diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index c7383eafe4..a11ab98361 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -134,7 +134,8 @@ bool cmListFile::ParseFile(const char* filename, break; } } - // if no policy command is found this is an error if they use any non advanced functions or a lot of functions + // if no policy command is found this is an error if they use any + // non advanced functions or a lot of functions if(!hasVersion) { bool isProblem = true; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d8069786c8..b934126f9c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1627,6 +1627,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + const char* sysrootDefault = + this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); + bool flagsUsed = false; if(osxArch && sysroot && lang && lang[0] =='C') { std::vector<std::string> archs; @@ -1656,8 +1659,15 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, } flags += " -isysroot "; flags += sysroot; + flagsUsed = true; } } + if(!flagsUsed && sysroot && sysrootDefault && + strcmp(sysroot, sysrootDefault) != 0) + { + flags += " -isysroot "; + flags += sysroot; + } } this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); } @@ -2535,9 +2545,32 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) } //---------------------------------------------------------------------------- +static bool cmLocalGeneratorIsShellOperator(const char* str) +{ + if(strcmp(str, "<") == 0 || + strcmp(str, ">") == 0 || + strcmp(str, "<<") == 0 || + strcmp(str, ">>") == 0 || + strcmp(str, "|") == 0 || + strcmp(str, "&>") == 0 || + strcmp(str, "2>&1") == 0 || + strcmp(str, "1>&2") == 0) + { + return true; + } + return false; +} + +//---------------------------------------------------------------------------- std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, bool forEcho) { + // Do not escape shell operators. + if(cmLocalGeneratorIsShellOperator(str)) + { + return str; + } + // Compute the flags for the target shell environment. int flags = 0; if(this->WindowsVSIDE) @@ -2583,7 +2616,7 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, else { cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags); - } + } return std::string(&arg[0]); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 14201a45d2..c4f7d0ebfa 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1019,6 +1019,19 @@ cmLocalUnixMakefileGenerator3 // without the current directory being in the search path. cmd = "./" + cmd; } + if(this->WatcomWMake && + cmSystemTools::FileIsFullPath(cmd.c_str()) && + cmd.find(" ") != cmd.npos) + { + // On Watcom WMake use the windows short path for the command + // name. This is needed to avoid funny quoting problems on + // lines with shell redirection operators. + std::string scmd; + if(cmSystemTools::GetShortPath(cmd.c_str(), scmd)) + { + cmd = scmd; + } + } cmd = this->Convert(cmd.c_str(),NONE,SHELL); for(unsigned int j=1; j < commandLine.size(); ++j) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 8c5b87f874..d25962ba05 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -68,6 +68,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() lang.insert("RC"); lang.insert("IDL"); lang.insert("DEF"); + lang.insert("Fortran"); this->CreateCustomTargetsAndCommands(lang); this->FixGlobalTargets(); } @@ -200,6 +201,9 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() void cmLocalVisualStudio7Generator ::CreateSingleVCProj(const char *lname, cmTarget &target) { + this->FortranProject = + static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) + ->TargetIsFortranOnly(target); // add to the list of projects std::string pname = lname; target.SetProperty("GENERATOR_FILE_NAME",lname); @@ -208,7 +212,14 @@ void cmLocalVisualStudio7Generator fname = this->Makefile->GetStartOutputDirectory(); fname += "/"; fname += lname; - fname += ".vcproj"; + if(this->FortranProject) + { + fname += ".vfproj"; + } + else + { + fname += ".vcproj"; + } // Generate the project file and replace it atomically with // copy-if-different. We use a separate timestamp so that the IDE @@ -286,7 +297,61 @@ void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, } fout << "\t</Configurations>\n"; } - +cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = +{ + {"Preprocess", "fpp", "Run Preprocessor on files", "preprocessYes", 0}, + {"SuppressStartupBanner", "nologo", "SuppressStartupBanner", "true", 0}, + {"DebugInformationFormat", "Zi", "full debug", "debugEnabled", 0}, + {"DebugInformationFormat", "debug:full", "full debug", "debugEnabled", 0}, + {"DebugInformationFormat", "Z7", "c7 compat", "debugOldStyleInfo", 0}, + {"DebugInformationFormat", "Zd", "line numbers", "debugLineInfoOnly", 0}, + {"Optimization", "Od", "disable optimization", "optimizeDisabled", 0}, + {"Optimization", "O1", "min space", "optimizeMinSpace", 0}, + {"Optimization", "O3", "full optimize", "optimizeFull", 0}, + {"GlobalOptimizations", "Og", "global optimize", "true", 0}, + {"InlineFunctionExpansion", "Ob0", "", "expandDisable", 0}, + {"InlineFunctionExpansion", "Ob1", "", "expandOnlyInline", 0}, + {"FavorSizeOrSpeed", "Os", "", "favorSize", 0}, + {"OmitFramePointers", "Oy-", "", "false", 0}, + {"OptimizeForProcessor", "GB", "", "procOptimizeBlended", 0}, + {"OptimizeForProcessor", "G5", "", "procOptimizePentium", 0}, + {"OptimizeForProcessor", "G6", "", "procOptimizePentiumProThruIII", 0}, + {"UseProcessorExtensions", "QzxK", "", "codeForStreamingSIMD", 0}, + {"OptimizeForProcessor", "QaxN", "", "codeForPentium4", 0}, + {"OptimizeForProcessor", "QaxB", "", "codeForPentiumM", 0}, + {"OptimizeForProcessor", "QaxP", "", "codeForCodeNamedPrescott", 0}, + {"OptimizeForProcessor", "QaxT", "", "codeForCore2Duo", 0}, + {"OptimizeForProcessor", "QxK", "", "codeExclusivelyStreamingSIMD", 0}, + {"OptimizeForProcessor", "QxN", "", "codeExclusivelyPentium4", 0}, + {"OptimizeForProcessor", "QxB", "", "codeExclusivelyPentiumM", 0}, + {"OptimizeForProcessor", "QxP", "", "codeExclusivelyCodeNamedPrescott", 0}, + {"OptimizeForProcessor", "QxT", "", "codeExclusivelyCore2Duo", 0}, + {"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0}, + {"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0}, + + {"ModulePath", "module:", "", "", + cmVS7FlagTable::UserValueRequired}, + {"LoopUnrolling", "Qunroll:", "", "", + cmVS7FlagTable::UserValueRequired}, + {"AutoParallelThreshold", "Qpar-threshold:", "", "", + cmVS7FlagTable::UserValueRequired}, + {"HeapArrays", "heap-arrays:", "", "", + cmVS7FlagTable::UserValueRequired}, + {"ObjectText", "bintext:", "", "", + cmVS7FlagTable::UserValueRequired}, + {"Parallelization", "Qparallel", "", "true", 0}, + {"PrefetchInsertion", "Qprefetch-", "", "false", 0}, + {"BufferedIO", "assume:buffered_io", "", "true", 0}, + {"CallingConvention", "iface:stdcall", "", "callConventionStdCall", 0}, + {"CallingConvention", "iface:cref", "", "callConventionCRef", 0}, + {"CallingConvention", "iface:stdref", "", "callConventionStdRef", 0}, + {"CallingConvention", "iface:stdcall", "", "callConventionStdCall", 0}, + {"CallingConvention", "iface:cvf", "", "callConventionCVF", 0}, + {"EnableRecursion", "recursive", "", "true", 0}, + {"ReentrantCode", "reentrancy", "", "true", 0}, + // done up to Language + {0,0,0,0,0} +}; // fill the table here currently the comment field is not used for // anything other than documentation NOTE: Make sure the longer // commandFlag comes FIRST! @@ -379,6 +444,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {0,0,0,0,0} }; + + cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = { // option flags (some flags map to the same option) @@ -404,7 +471,8 @@ public: enum Tool { Compiler, - Linker + Linker, + FortranCompiler }; cmLocalVisualStudio7GeneratorOptions(cmLocalVisualStudio7Generator* lg, int version, @@ -485,13 +553,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // 1 == executable // 10 == utility const char* configType = "10"; + const char* projectType = 0; switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: + projectType = "typeStaticLibrary"; configType = "4"; break; case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: + projectType = "typeDynamicLibrary"; configType = "2"; break; case cmTarget::EXECUTABLE: @@ -503,7 +574,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, default: break; } - + if(this->FortranProject && projectType) + { + configType = projectType; + } std::string flags; if(strcmp(configType, "10") != 0) { @@ -516,7 +590,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, target.GetName()); return; } - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0) + if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 + || strcmp(linkLanguage, "Fortran") == 0) { std::string baseFlagVar = "CMAKE_"; baseFlagVar += linkLanguage; @@ -551,9 +626,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // Get preprocessor definitions for this directory. std::string defineFlags = this->Makefile->GetDefineFlags(); - - // Construct a set of build options for this target. - Options targetOptions(this, this->Version, Options::Compiler, this->ExtraFlagTable); + Options::Tool t = Options::Compiler; + if(this->FortranProject) + { + t = Options::FortranCompiler; + } + Options targetOptions(this, this->Version, t, this->ExtraFlagTable); targetOptions.FixExceptionHandlingDefault(); targetOptions.Parse(flags.c_str()); targetOptions.Parse(defineFlags.c_str()); @@ -599,9 +677,31 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { fout << "\t\t\tCharacterSet=\"2\">\n"; } - + const char* tool = "VCCLCompilerTool"; + if(this->FortranProject) + { + tool = "VFFortranCompilerTool"; + } fout << "\t\t\t<Tool\n" - << "\t\t\t\tName=\"VCCLCompilerTool\"\n"; + << "\t\t\t\tName=\"" << tool << "\"\n"; + if(this->FortranProject) + { + const char* target_mod_dir = + target.GetProperty("Fortran_MODULE_DIRECTORY"); + std::string modDir; + if(target_mod_dir) + { + modDir = this->Convert(target_mod_dir, + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED); + } + else + { + modDir = "."; + } + fout << "\t\t\t\tModulePath=\"" + << this->ConvertToXMLOutputPath(modDir.c_str()) << "\\$(ConfigurationName)\"\n"; + } targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector<std::string> includes; @@ -609,8 +709,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::vector<std::string>::iterator i = includes.begin(); for(;i != includes.end(); ++i) { + // output the include path std::string ipath = this->ConvertToXMLOutputPath(i->c_str()); fout << ipath << ";"; + // if this is fortran then output the include with + // a ConfigurationName on the end of it. + if(this->FortranProject) + { + ipath = i->c_str(); + ipath += "/$(ConfigurationName)"; + ipath = this->ConvertToXMLOutputPath(ipath.c_str()); + fout << ipath << ";"; + } } fout << "\"\n"; targetOptions.OutputFlagMap(fout, "\t\t\t\t"); @@ -629,8 +739,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"/>\n"; - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCResourceCompilerTool\"\n" + tool = "VCCustomBuildTool"; + if(this->FortranProject) + { + tool = "VFCustomBuildTool"; + } + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"/>\n"; + tool = "VCResourceCompilerTool"; + if(this->FortranProject) + { + tool = "VFResourceCompilerTool"; + } + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n" << "\t\t\t\tAdditionalIncludeDirectories=\""; for(i = includes.begin();i != includes.end(); ++i) { @@ -641,8 +761,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, fout << "\""; targetOptions.OutputPreprocessorDefinitions(fout, "\n\t\t\t\t", ""); fout << "/>\n"; - - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n"; + tool = "VCMIDLTool"; + if(this->FortranProject) + { + tool = "VFMIDLTool"; + } + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"; targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n"; if( this->PlatformName == "x64" ) @@ -675,8 +799,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // Add a flag telling the manifest tool to use a workaround // for FAT32 file systems, which can cause an empty manifest // to be embedded into the resulting executable. See CMake - // bug #2617. - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n" + // bug #2617. + const char* tool = "VCManifestTool"; + if(this->FortranProject) + { + tool = "VFManifestTool"; + } + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n" << "\t\t\t\tUseFAT32Workaround=\"true\"\n" << "\t\t\t/>\n"; } @@ -757,8 +886,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string libpath = target.GetDirectory(configName); libpath += "/"; libpath += targetNameFull; + const char* tool = "VCLibrarianTool"; + if(this->FortranProject) + { + tool = "VFLibrarianTool"; + } fout << "\t\t\t<Tool\n" - << "\t\t\t\tName=\"VCLibrarianTool\"\n"; + << "\t\t\t\tName=\"" << tool << "\"\n"; if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS")) { fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; @@ -792,9 +926,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string standardLibsVar = "CMAKE_"; standardLibsVar += linkLanguage; standardLibsVar += "_STANDARD_LIBRARIES"; - + const char* tool = "VCLinkerTool"; + if(this->FortranProject) + { + tool = "VFLinkerTool"; + } fout << "\t\t\t<Tool\n" - << "\t\t\t\tName=\"VCLinkerTool\"\n"; + << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -861,9 +999,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string standardLibsVar = "CMAKE_"; standardLibsVar += linkLanguage; standardLibsVar += "_STANDARD_LIBRARIES"; - + const char* tool = "VCLinkerTool"; + if(this->FortranProject) + { + tool = "VFLinkerTool"; + } fout << "\t\t\t<Tool\n" - << "\t\t\t\tName=\"VCLinkerTool\"\n"; + << "\t\t\t\tName=\"" << tool << "\"\n"; linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. @@ -1263,14 +1405,26 @@ void cmLocalVisualStudio7Generator if(ext == "idl") { aCompilerTool = "VCMIDLTool"; + if(this->FortranProject) + { + aCompilerTool = "VFMIDLTool"; + } } if(ext == "rc") { - aCompilerTool = "VCResourceCompilerTool"; + aCompilerTool = "VCResourceCompilerTool"; + if(this->FortranProject) + { + aCompilerTool = "VFResourceCompilerTool"; + } } if(ext == "def") { aCompilerTool = "VCCustomBuildTool"; + if(this->FortranProject) + { + aCompilerTool = "VFCustomBuildTool"; + } } for(std::map<cmStdString, cmLVS7GFileConfig>::const_iterator fci = fcinfo.FileConfigMap.begin(); @@ -1346,7 +1500,16 @@ WriteCustomRule(std::ostream& fout, std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); - + const char* compileTool = "VCCLCompilerTool"; + if(this->FortranProject) + { + compileTool = "VFCLCompilerTool"; + } + const char* customTool = "VCCustomBuildTool"; + if(this->FortranProject) + { + customTool = "VFCustomBuildTool"; + } for(i = configs->begin(); i != configs->end(); ++i) { cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; @@ -1355,7 +1518,7 @@ WriteCustomRule(std::ostream& fout, if(!fc.CompileFlags.empty()) { fout << "\t\t\t\t\t<Tool\n" - << "\t\t\t\t\tName=\"VCCLCompilerTool\"\n" + << "\t\t\t\t\tName=\"" << compileTool << "\"\n" << "\t\t\t\t\tAdditionalOptions=\"" << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; } @@ -1367,7 +1530,7 @@ WriteCustomRule(std::ostream& fout, command.GetEscapeOldStyle(), command.GetEscapeAllowMakeVars()); fout << "\t\t\t\t\t<Tool\n" - << "\t\t\t\t\tName=\"VCCustomBuildTool\"\n" + << "\t\t\t\t\tName=\"" << customTool << "\"\n" << "\t\t\t\t\tDescription=\"" << this->EscapeForXML(comment.c_str()) << "\"\n" << "\t\t\t\t\tCommandLine=\"" @@ -1450,9 +1613,13 @@ void cmLocalVisualStudio7Generator { return; } - + const char* tool = "VCPreBuildEventTool"; + if(this->FortranProject) + { + tool = "VFPreBuildEventTool"; + } // add the pre build rules - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\""; + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\""; bool init = false; for (std::vector<cmCustomCommand>::const_iterator cr = target.GetPreBuildCommands().begin(); @@ -1488,7 +1655,12 @@ void cmLocalVisualStudio7Generator fout << "/>\n"; // add the pre Link rules - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\""; + tool = "VCPreLinkEventTool"; + if(this->FortranProject) + { + tool = "VFPreLinkEventTool"; + } + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\""; init = false; for (std::vector<cmCustomCommand>::const_iterator cr = target.GetPreLinkCommands().begin(); @@ -1524,7 +1696,12 @@ void cmLocalVisualStudio7Generator fout << "/>\n"; // add the PostBuild rules - fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\""; + tool = "VCPostBuildEventTool"; + if(this->FortranProject) + { + tool = "VFPostBuildEventTool"; + } + fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\""; init = false; for (std::vector<cmCustomCommand>::const_iterator cr = target.GetPostBuildCommands().begin(); @@ -1561,11 +1738,76 @@ void cmLocalVisualStudio7Generator } void +cmLocalVisualStudio7Generator +::WriteProjectStartFortran(std::ostream& fout, + const char *libName, + cmTarget & target) +{ + + cmGlobalVisualStudio7Generator* gg = + static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator); + fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" + << "<VisualStudioProject\n" + << "\tProjectCreator=\"Intel Fortran\"\n" + << "\tVersion=\"9.10\"\n"; + const char* keyword = target.GetProperty("VS_KEYWORD"); + if(!keyword) + { + keyword = "Console Application"; + } + const char* projectType = 0; + switch(target.GetType()) + { + case cmTarget::STATIC_LIBRARY: + projectType = "typeStaticLibrary"; + if(keyword) + { + keyword = "Static Library"; + } + break; + case cmTarget::SHARED_LIBRARY: + case cmTarget::MODULE_LIBRARY: + projectType = "typeDynamicLibrary"; + if(!keyword) + { + keyword = "Dll"; + } + break; + case cmTarget::EXECUTABLE: + if(!keyword) + { + keyword = "Console Application"; + } + projectType = 0; + break; + case cmTarget::UTILITY: + case cmTarget::GLOBAL_TARGET: + default: + break; + } + if(projectType) + { + fout << "\tProjectType=\"" << projectType << "\">\n"; + } + fout<< "\tKeyword=\"" << keyword << "\">\n" + << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" + << "\t<Platforms>\n" + << "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n" + << "\t</Platforms>\n"; +} + + +void cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, const char *libName, cmTarget & target, std::vector<cmSourceGroup> &) { + if(this->FortranProject) + { + this->WriteProjectStartFortran(fout, libName, target); + return; + } fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" << "<VisualStudioProject\n" << "\tProjectType=\"Visual C++\"\n"; @@ -1777,6 +2019,8 @@ cmLocalVisualStudio7GeneratorOptions this->FlagTable = cmLocalVisualStudio7GeneratorFlagTable; break; case Linker: this->FlagTable = cmLocalVisualStudio7GeneratorLinkFlagTable; break; + case FortranCompiler: + this->FlagTable = cmLocalVisualStudio7GeneratorFortranFlagTable; default: break; } } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index b59936245e..edb90aa878 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -102,6 +102,8 @@ private: void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); void WriteProjectStart(std::ostream& fout, const char *libName, cmTarget &tgt, std::vector<cmSourceGroup> &sgs); + void WriteProjectStartFortran(std::ostream& fout, const char *libName, + cmTarget &tgt); void WriteVCProjBeginGroup(std::ostream& fout, const char* group, const char* filter); @@ -124,6 +126,7 @@ private: cmVS7FlagTable const* ExtraFlagTable; std::string ModuleDefinitionFile; int Version; + bool FortranProject; std::string PlatformName; // Win32 or x64 cmLocalVisualStudio7GeneratorInternals* Internal; }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 135dc287d9..bc60955bb3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -83,7 +83,7 @@ cmMakefile::cmMakefile() this->AddSourceGroup("", "^.*$"); this->AddSourceGroup ("Source Files", - "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$"); + "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"); this->AddSourceGroup("Header Files", "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"); this->AddSourceGroup("CMake Rules", "\\.rule$"); @@ -299,12 +299,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } this->GetBacktrace(backtrace); } - else if(!this->ListFileStack.empty()) + else { - // We are processing the project but are not currently executing a - // command. Add whatever context information we have. cmListFileContext lfc; - lfc.FilePath = this->ListFileStack.back(); + if(this->ListFileStack.empty()) + { + // We are not processing the project. Add the directory-level context. + lfc.FilePath = this->GetCurrentDirectory(); + lfc.FilePath += "/CMakeLists.txt"; + } + else + { + // We are processing the project but are not currently executing a + // command. Add whatever context information we have. + lfc.FilePath = this->ListFileStack.back(); + } lfc.Line = 0; if(!this->GetCMakeInstance()->GetIsInTryCompile()) { @@ -2787,33 +2796,6 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, return res; } -void cmMakefile::AddWrittenFile(const char* file) -{ this->GetCMakeInstance()->AddWrittenFile(file); } - -bool cmMakefile::HasWrittenFile(const char* file) -{ return this->GetCMakeInstance()->HasWrittenFile(file); } - -bool cmMakefile::CheckInfiniteLoops() -{ - std::vector<std::string>::iterator it; - for ( it = this->ListFiles.begin(); - it != this->ListFiles.end(); - ++ it ) - { - if ( this->HasWrittenFile(it->c_str()) ) - { - cmOStringStream str; - str << "File " << it->c_str() << - " is written by WRITE_FILE (or FILE WRITE) command and should " - "not be used as input to CMake. Please use CONFIGURE_FILE to " - "be safe. Refer to the note next to FILE WRITE command."; - cmSystemTools::Error(str.str().c_str()); - return false; - } - } - return true; -} - void cmMakefile::SetProperty(const char* prop, const char* value) { if (!prop) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index d8873f4c6b..4f54f7134e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -94,18 +94,6 @@ public: void RemoveFunctionBlocker(const cmListFileFunction& lff); /** - * Add file to the written file list. These file should not be in the list - * of dependencies because they cause infinite loops. - */ - void AddWrittenFile(const char* file); - bool HasWrittenFile(const char* file); - - /** - * Check if there are any infinite loops - */ - bool CheckInfiniteLoops(); - - /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. */ diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 1cc2b2c1ce..0a848f6783 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -46,10 +46,28 @@ std::string const& cmSourceFile::GetExtension() const //---------------------------------------------------------------------------- const char* cmSourceFile::GetLanguage() { - // Compute the final location of the file if necessary. - if(this->FullPath.empty()) + // If the language was set explicitly by the user then use it. + if(const char* lang = this->GetProperty("LANGUAGE")) { - this->GetFullPath(); + return lang; + } + + // Perform computation needed to get the language if necessary. + if(this->FullPath.empty() && this->Language.empty()) + { + if(this->Location.ExtensionIsAmbiguous()) + { + // Finalize the file location to get the extension and set the + // language. + this->GetFullPath(); + } + else + { + // Use the known extension to get the language if possible. + std::string ext = + cmSystemTools::GetFilenameLastExtension(this->Location.GetName()); + this->CheckLanguage(ext); + } } // Now try to determine the language. @@ -167,9 +185,19 @@ bool cmSourceFile::FindFullPath() } } + // If the user provided a full path, trust it. If the file is not + // there the native tool will complain at build time. + if(!this->Location.DirectoryIsAmbiguous()) + { + this->FullPath = this->Location.GetDirectory(); + this->FullPath += "/"; + this->FullPath += this->Location.GetName(); + return true; + } + cmOStringStream e; e << "Cannot find source file \"" << this->Location.GetName() << "\""; - e << "\n\nTried extensions"; + e << ". Tried extensions"; for(std::vector<std::string>::const_iterator ext = srcExts.begin(); ext != srcExts.end(); ++ext) { @@ -180,7 +208,7 @@ bool cmSourceFile::FindFullPath() { e << " ." << *ext; } - cmSystemTools::Error(e.str().c_str()); + this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str()); this->FindFullPathFailed = true; return false; } @@ -242,8 +270,19 @@ void cmSourceFile::CheckExtension() } // Try to identify the source file language from the extension. + if(this->Language.empty()) + { + this->CheckLanguage(this->Extension); + } +} + +//---------------------------------------------------------------------------- +void cmSourceFile::CheckLanguage(std::string const& ext) +{ + // Try to identify the source file language from the extension. + cmMakefile* mf = this->Location.GetMakefile(); cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); - if(const char* l = gg->GetLanguageFromExtension(this->Extension.c_str())) + if(const char* l = gg->GetLanguageFromExtension(ext.c_str())) { this->Language = l; } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 1eca56ef36..59cb7db08e 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -116,6 +116,7 @@ private: bool FindFullPath(); bool TryFullPath(const char* tryPath, const char* ext); void CheckExtension(); + void CheckLanguage(std::string const& ext); std::vector<std::string> Depends; }; diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 8afd7586a0..2fba5081c6 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -97,7 +97,6 @@ bool cmWriteFileCommand file << message << std::endl; file.close(); cmSystemTools::SetPermissions(fileName.c_str(), mode); - this->Makefile->AddWrittenFile(fileName.c_str()); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5e5859b3b0..08fbe9da6b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2081,8 +2081,6 @@ int cmake::ActualConfigure() this->GlobalGenerator->ClearEnabledLanguages(); } - this->CleanupWrittenFiles(); - // Truncate log files if (!this->InTryCompile) { @@ -2533,21 +2531,6 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) } } -void cmake::AddWrittenFile(const char* file) -{ - this->WrittenFiles.insert(file); -} - -bool cmake::HasWrittenFile(const char* file) -{ - return this->WrittenFiles.find(file) != this->WrittenFiles.end(); -} - -void cmake::CleanupWrittenFiles() -{ - this->WrittenFiles.clear(); -} - void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: diff --git a/Source/cmake.h b/Source/cmake.h index c1e9a728b0..8dd5ad12bd 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -294,11 +294,6 @@ class cmake bool GetDebugTryCompile(){return this->DebugTryCompile;} void DebugTryCompileOn(){this->DebugTryCompile = true;} - ///! Get the list of files written by CMake using FILE(WRITE / WRITE_FILE - void AddWrittenFile(const char* file); - bool HasWrittenFile(const char* file); - void CleanupWrittenFiles(); - /** * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries */ @@ -389,7 +384,6 @@ protected: std::string StartOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; - std::set<cmStdString> WrittenFiles; ///! return true if the same cmake was used to make the cache. bool CacheVersionMatches(); diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index de85c3a5d2..d205c960c7 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -75,6 +75,13 @@ static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c) } /*--------------------------------------------------------------------------*/ +static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c) +{ + return ((c == '\'') || (c == '#') || (c == '&') || + (c == '<') || (c == '>') || (c == '|') || (c == '^')); +} + +/*--------------------------------------------------------------------------*/ static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags) { /* On Windows the built-in command shell echo never needs quotes. */ @@ -99,14 +106,10 @@ static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags) } else { - /* On Windows single-quotes must be escaped in some make - environments, such as in mingw32-make. */ - if(flags & kwsysSystem_Shell_Flag_Make) + /* On Windows several special characters need quotes to preserve them. */ + if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c)) { - if(c == '\'') - { - return 1; - } + return 1; } } return 0; @@ -380,6 +383,10 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, *out++ = *c++; } + /* The make variable reference eliminates any escaping needed + for preceding backslashes. */ + windows_backslashes = 0; + /* Stop if we have reached the end of the string. */ if(!*c) { diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 1055313741..2d9fee66b2 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -1963,16 +1963,16 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 6: switch (this->ChipID.Model) { - case 1: sprintf (this->ChipID.ProcessorName,"Athlon™ (0.25 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"Athlon™ (0.18 micron)"); break; - case 3: sprintf (this->ChipID.ProcessorName,"Duron™ (SF core)"); break; - case 4: sprintf (this->ChipID.ProcessorName,"Athlon™ (Thunderbird core)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"Athlon™ (Palomino core)"); break; - case 7: sprintf (this->ChipID.ProcessorName,"Duron™ (Morgan core)"); break; + case 1: sprintf (this->ChipID.ProcessorName,"Athlon- (0.25 micron)"); break; + case 2: sprintf (this->ChipID.ProcessorName,"Athlon- (0.18 micron)"); break; + case 3: sprintf (this->ChipID.ProcessorName,"Duron- (SF core)"); break; + case 4: sprintf (this->ChipID.ProcessorName,"Athlon- (Thunderbird core)"); break; + case 6: sprintf (this->ChipID.ProcessorName,"Athlon- (Palomino core)"); break; + case 7: sprintf (this->ChipID.ProcessorName,"Duron- (Morgan core)"); break; case 8: if (this->Features.ExtendedFeatures.SupportsMP) - sprintf (this->ChipID.ProcessorName,"Athlon™ MP (Thoroughbred core)"); - else sprintf (this->ChipID.ProcessorName,"Athlon™ XP (Thoroughbred core)"); + sprintf (this->ChipID.ProcessorName,"Athlon - MP (Thoroughbred core)"); + else sprintf (this->ChipID.ProcessorName,"Athlon - XP (Thoroughbred core)"); break; default: sprintf (this->ChipID.ProcessorName,"Unknown K7 family"); return false; } diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 29c06cd305..7e9f29c046 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -150,6 +150,7 @@ ADD_EXECUTABLE(CustomCommand ${PROJECT_BINARY_DIR}/wrapped_help.c ${PROJECT_BINARY_DIR}/generated.c ${PROJECT_BINARY_DIR}/not_included.h + gen_redirect.c # default location for custom commands is in build tree ) # Add the rule to create generated.c at build time. This is placed @@ -191,18 +192,27 @@ ADD_CUSTOM_COMMAND(TARGET CustomCommandUsingTargetTest POST_BUILD ADD_SUBDIRECTORY(GeneratorInExtraDir) +############################################################################## +# Test shell operators in custom commands. + +ADD_EXECUTABLE(tcat tcat.cxx) + +ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c + DEPENDS tcat gen_redirect_in.c + COMMAND tcat < ${CMAKE_CURRENT_SOURCE_DIR}/gen_redirect_in.c > gen_redirect.c + COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> gen_redirect.c + VERBATIM + ) ############################################################################## # Test non-trivial command line arguments in custom commands. SET(EXPECTED_ARGUMENTS) -# TODO: Check shell operators < > << >> | 2>&1 1>&2 &> ! & SET(CHECK_ARGS c:/posix/path c:\\windows\\path 'single-quotes' single'quote \"double-quotes\" - double\"quote "\\;semi-colons\\;" "semi\\;colon" `back-ticks` @@ -213,15 +223,15 @@ SET(CHECK_ARGS {curly} {lcurly} rcurly} - #<angle> # angle-brackets are inconsistent on windows right now - #<langle - #rangle> + <angle> + <langle + rangle> [square] [lsquare # these have funny behavior due to special cases for rsquare] # windows registry value names in list expansion $dollar-signs$ dollar$sign - &ersands& + &ersands&x # Borland make does not like trailing ampersand one&ersand @two-ats@ one@at @@ -256,7 +266,6 @@ SET(CHECK_ARGS "'single quotes with space'" "single'quote with space" "\"double-quotes with space\"" - "double\"quote with space" "\\;semi-colons w s\\;" "semi\\;colon w s" "`back-ticks` w s" @@ -267,9 +276,9 @@ SET(CHECK_ARGS "{curly} w s" "{lcurly w s" "rcurly} w s" - #"<angle> w s" # angle-brackets are inconsistent on windows right now - #"<langle w s" - #"rangle> w s" + "<angle> w s" + "<langle w s" + "rangle> w s" "[square] w s" "[lsquare w s" # these have funny behavior due to special cases for "rsquare] w s" # windows registry value names in list expansion @@ -303,16 +312,27 @@ SET(CHECK_ARGS "one|pipe w s" "#two-pounds# w s" "one#pound w s" - ~ ` ! @ \# $ % ^ & _ - + = | : "\;" \" ' , . ? "(" ")" { } [] -# < > << >> &> 2>&1 1>&2 -# \\ # Need to test last to avoid ; escape in list. -# # Make tools need help when this is the last argument. + ~ ` ! @ \# $ % ^ & _ - + = : "\;" \" ' , . ? "(" ")" { } [] ) IF(NOT MINGW) # * # MinGW programs on windows always expands the wildcard! # / # MSys make converts a leading slash to the mingw home directory LIST(APPEND CHECK_ARGS * /) ENDIF(NOT MINGW) + +# The windows command shell does not support a double quote by itself: +# double\"quote +# without messing up quoting of arguments following it. + +# Make tools need help with escaping a single backslash +# \ +# at the end of a command because they think it is a continuation +# character. + +# We now have special cases for shell operators: +# | < > << >> &> 2>&1 1>&2 +# to allow custom commands to perform redirection. + FOREACH(arg ${CHECK_ARGS}) SET(ARG "${arg}") STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") diff --git a/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt b/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt index e838e7b08f..195a47792a 100644 --- a/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt +++ b/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt @@ -1,3 +1,5 @@ +ADD_DEFINITIONS(-DGENERATOR_EXTERN) + # add the executable which will be used for generating files ADD_EXECUTABLE(generator_extern ../generator.cxx) SET_TARGET_PROPERTIES(generator_extern PROPERTIES OUTPUT_NAME the_external_generator) diff --git a/Tests/CustomCommand/gen_redirect_in.c b/Tests/CustomCommand/gen_redirect_in.c new file mode 100644 index 0000000000..8dd8f43f0c --- /dev/null +++ b/Tests/CustomCommand/gen_redirect_in.c @@ -0,0 +1,5 @@ +#if 1 + +int gen_redirect() { return 3; } + +/* endif should be concatenated to generated file */ diff --git a/Tests/CustomCommand/generator.cxx b/Tests/CustomCommand/generator.cxx index 99da90ceb4..cceac073a3 100644 --- a/Tests/CustomCommand/generator.cxx +++ b/Tests/CustomCommand/generator.cxx @@ -8,8 +8,12 @@ int main(int argc, char *argv[]) return 1; } FILE *fp = fopen(argv[1],"w"); - +#ifdef GENERATOR_EXTERN fprintf(fp,"int generated() { return 3; }\n"); +#else + fprintf(fp,"extern int gen_redirect(void);\n"); + fprintf(fp,"int generated() { return gen_redirect(); }\n"); +#endif fclose(fp); return 0; } diff --git a/Tests/CustomCommand/tcat.cxx b/Tests/CustomCommand/tcat.cxx new file mode 100644 index 0000000000..89e3cb0a2e --- /dev/null +++ b/Tests/CustomCommand/tcat.cxx @@ -0,0 +1,11 @@ +#include <stdio.h> + +int main() +{ + int c; + while((c = getc(stdin), c != EOF)) + { + putc(c, stdout); + } + return 0; +} |