diff options
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 4 | ||||
-rw-r--r-- | Modules/CheckTypeSize.cmake | 12 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 97 | ||||
-rw-r--r-- | Source/cmFileCommand.h | 25 |
4 files changed, 39 insertions, 99 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index e30db35..121dbc7 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -74,10 +74,8 @@ MACRO(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) "Compilation of the ${lang} compiler identification source \"" "${CMAKE_${lang}_COMPILER_ID_SRC}\" produced \"" "${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n") - # only check if we don't have it yet + # only check if we don't have it yet IF(NOT CMAKE_${lang}_COMPILER_ID) -# SET(CMAKE_${lang}_COMPILER_ID_EXE "${CMAKE_${lang}_COMPILER_ID_DIR}/ConvertedToBinary") -# FILE(HEX_TO_BIN "${CMAKE_${lang}_COMPILER_ID_EXE_TRY}" "${CMAKE_${lang}_COMPILER_ID_EXE}") # Read the compiler identification string from the executable file. FILE(STRINGS ${CMAKE_${lang}_COMPILER_ID_EXE} CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:") diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 7bbc6d2..058dbaf 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -16,11 +16,11 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") MESSAGE(STATUS "Check size of ${TYPE}") SET(CHECK_TYPE_SIZE_TYPE "${TYPE}") - SET(MACRO_CHECK_TYPE_SIZE_FLAGS + SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${CMAKE_REQUIRED_FLAGS}") FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H) IF("${def}") - SET(MACRO_CHECK_TYPE_SIZE_FLAGS + SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") ENDIF("${def}") ENDFOREACH(def) @@ -33,7 +33,7 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n") ENDFOREACH(def) IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_TYPE_SIZE_ADD_LIBRARIES + SET(CHECK_TYPE_SIZE_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") ENDIF(CMAKE_REQUIRED_LIBRARIES) IF(CMAKE_REQUIRED_INCLUDES) @@ -56,8 +56,6 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" ) IF(HAVE_${VARIABLE}) -# FILE(HEX_TO_BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" -# "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.even_more_bin") FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" CMAKE_CHECKTYPESIZE_STRINGS LIMIT_COUNT 2 REGEX "INFO:sizeof") @@ -75,11 +73,11 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) ENDFOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS}) MESSAGE(STATUS "Check size of ${TYPE} - done") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n") ELSE(HAVE_${VARIABLE}) MESSAGE(STATUS "Check size of ${TYPE} - failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n") SET(${VARIABLE}) ENDIF(HAVE_${VARIABLE}) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f75ed79..80b9008 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -76,10 +76,6 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args) { return this->HandleStringsCommand(args); } -/* else if ( subCommand == "HEX_TO_BIN" ) - { - return this->HandleHex2BinCommand(args); - }*/ else if ( subCommand == "GLOB" ) { return this->HandleGlobCommand(args, false); @@ -236,7 +232,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) std::string line; bool has_newline = false; while (sizeLimit != 0 && - cmSystemTools::GetLineFromStream(file, line, &has_newline, + cmSystemTools::GetLineFromStream(file, line, &has_newline, sizeLimit) ) { if (sizeLimit > 0) @@ -262,53 +258,6 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -/*bool cmFileCommand::HandleHex2BinCommand(std::vector<std::string> const& args) -{ - if(args.size() != 3) - { - this->SetError("HEX_TO_BIN requires an input and an output file name"); - return false; - } - // Get the file to read. - std::string inFileName = args[1]; - if(!cmsys::SystemTools::FileIsFullPath(inFileName.c_str())) - { - inFileName = this->Makefile->GetCurrentDirectory(); - inFileName += "/" + args[1]; - } - - // Get the file to write. - std::string outFileName = args[2]; - if(!cmsys::SystemTools::FileIsFullPath(outFileName.c_str())) - { - outFileName = this->Makefile->GetCurrentDirectory(); - outFileName += "/" + args[2]; - } - - if ( !this->Makefile->CanIWriteThisFile(outFileName.c_str()) ) - { - std::string e - = "attempted to write a file: " + outFileName + - " into a source directory."; - this->SetError(e.c_str()); - cmSystemTools::SetFatalErrorOccured(); - return false; - } - - std::string dir = cmSystemTools::GetFilenamePath(outFileName); - cmSystemTools::MakeDirectory(dir.c_str()); - - bool success = cmHexFileConverter::TryConvert(inFileName.c_str(), - outFileName.c_str()); - if (!success) - { - success = cmSystemTools::CopyFileAlways(inFileName.c_str(), - outFileName.c_str()); - } - return success; -} */ - -//---------------------------------------------------------------------------- bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) { if(args.size() < 3) @@ -485,7 +434,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) fileName = binaryFileName; } } - + // Open the specified file. #if defined(_WIN32) || defined(__CYGWIN__) std::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); @@ -1089,7 +1038,7 @@ bool cmFileInstaller::InstallDirectory(const char* source, } //---------------------------------------------------------------------------- -void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer, +void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer, mode_t& permissions_file, mode_t& permissions_dir, int itype, @@ -1190,7 +1139,7 @@ void cmFileCommand //---------------------------------------------------------------------------- -bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, +bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, std::string& destination) { if ( destination.size() < 2 ) @@ -1199,7 +1148,7 @@ bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, "No DESTINATION provided or ."); return false; } - + const char* destdir = cmSystemTools::GetEnv("DESTDIR"); if ( destdir && *destdir ) { @@ -1299,9 +1248,9 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args) std::map<cmStdString, const char*> properties; bool optional = false; - bool result = this->ParseInstallArgs(args, installer, components, - configurations, properties, - itype, rename, destination, files, + bool result = this->ParseInstallArgs(args, installer, components, + configurations, properties, + itype, rename, destination, files, optional); if (result == true) { @@ -1640,7 +1589,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector<std::string> const& args, this->GetTargetTypeFromString(stype, itype); - this->HandleInstallPermissions(installer, + this->HandleInstallPermissions(installer, permissions_file, permissions_dir, itype, @@ -1759,10 +1708,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer, cmSystemTools::RemoveFile(soname.c_str()); cmSystemTools::RemoveFile(libname.c_str()); - if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(), + if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(), libname.c_str()) ) { - std::string errstring = "error when creating symlink from: " + std::string errstring = "error when creating symlink from: " + libname + " to " + soname_nopath; this->SetError(errstring.c_str()); return false; @@ -1770,10 +1719,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer, installer.ManifestAppend(libname); if ( toFile != soname ) { - if ( !cmSystemTools::CreateSymlink(fromName.c_str(), + if ( !cmSystemTools::CreateSymlink(fromName.c_str(), soname.c_str()) ) { - std::string errstring = "error when creating symlink from: " + std::string errstring = "error when creating symlink from: " + soname + " to " + fromName; this->SetError(errstring.c_str()); return false; @@ -1805,10 +1754,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer, cmSystemTools::RemoveFile(exename.c_str()); - if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(), + if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(), exename.c_str()) ) { - std::string errstring = "error when creating symlink from: " + std::string errstring = "error when creating symlink from: " + exename + " to " + exename_nopath; this->SetError(errstring.c_str()); return false; @@ -1901,22 +1850,22 @@ bool cmFileCommand::HandleRelativePathCommand( if(!cmSystemTools::FileIsFullPath(directoryName.c_str())) { - std::string errstring = - "RelativePath must be passed a full path to the directory: " + std::string errstring = + "RelativePath must be passed a full path to the directory: " + directoryName; this->SetError(errstring.c_str()); return false; } if(!cmSystemTools::FileIsFullPath(fileName.c_str())) { - std::string errstring = - "RelativePath must be passed a full path to the file: " + std::string errstring = + "RelativePath must be passed a full path to the file: " + fileName; this->SetError(errstring.c_str()); return false; } - std::string res = cmSystemTools::RelativePath(directoryName.c_str(), + std::string res = cmSystemTools::RelativePath(directoryName.c_str(), fileName.c_str()); this->Makefile->AddDefinition(outVar.c_str(), res.c_str()); @@ -1949,7 +1898,7 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, //---------------------------------------------------------------------------- bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> - const& args, + const& args, bool nativePath) { std::vector<std::string>::const_iterator i = args.begin(); @@ -1965,7 +1914,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> #else char pathSep = ':'; #endif - std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(), + std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(), pathSep); i++; const char* var = i->c_str(); @@ -1986,7 +1935,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> *j = cmSystemTools::ConvertToOutputPath(j->c_str()); // remove double quotes in the path cmsys::String& s = *j; - + if(s.size() > 1 && s[0] == '\"' && s[s.size()-1] == '\"') { s = s.substr(1,s.size()-2); diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 029e698..6dffd27 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,7 +31,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmFileCommand; } @@ -55,11 +55,11 @@ public: /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() { return "File manipulation command."; } - + /** * More documentation. */ @@ -74,7 +74,6 @@ public: " [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n" " [NEWLINE_CONSUME] [REGEX regex]\n" " [NO_HEX_CONVERSION])\n" - " FILE(HEX_TO_BIN inputfile outputfile)\n" " FILE(GLOB variable [RELATIVE path] [globbing expressions]...)\n" " FILE(GLOB_RECURSE variable [RELATIVE path] \n" " [globbing expressions]...)\n" @@ -100,9 +99,6 @@ public: "return (CR) characters are ignored. It works also for Intel Hex and " "Motorola S-record files, which are automatically converted to binary " "format when reading them. Disable this using NO_HEX_CONVERSION.\n " -/* "HEX_TO_BIN will convert an Intel hex file or Motorola S-record file " - "to a binary file. If the input file is no such file it will simply " - "be copied. \n"*/ "LIMIT_COUNT sets the maximum number of strings to return. " "LIMIT_INPUT sets the maximum number of bytes to read from " "the input file. " @@ -145,7 +141,7 @@ public: " a cmake style path into the native path style \\ for windows and / " "for UNIX."; } - + cmTypeMacro(cmFileCommand, cmCommand); protected: @@ -153,15 +149,14 @@ protected: bool HandleWriteCommand(std::vector<std::string> const& args, bool append); bool HandleReadCommand(std::vector<std::string> const& args); bool HandleStringsCommand(std::vector<std::string> const& args); -// bool HandleHex2BinCommand(std::vector<std::string> const& args); bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse); bool HandleMakeDirectoryCommand(std::vector<std::string> const& args); - + bool HandleRelativePathCommand(std::vector<std::string> const& args); bool HandleCMakePathCommand(std::vector<std::string> const& args, bool nativePath); void ComputeVersionedName(std::string& name, const char* version); - + // FILE(INSTALL ...) related functions bool HandleInstallCommand(std::vector<std::string> const& args); bool ParseInstallArgs(std::vector<std::string> const& args, @@ -186,9 +181,9 @@ protected: const bool optional ); void GetTargetTypeFromString(const std::string& stype, int& itype) const; - bool HandleInstallDestination(cmFileInstaller& installer, + bool HandleInstallDestination(cmFileInstaller& installer, std::string& destination); - void HandleInstallPermissions(cmFileInstaller& installer, + void HandleInstallPermissions(cmFileInstaller& installer, mode_t& permissions_file, mode_t& permissions_dir, int itype, |