diff options
author | Brad King <brad.king@kitware.com> | 2021-10-27 16:58:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-27 16:58:02 (GMT) |
commit | efc6c23a47e456b066089ed6f8fd11a1ca4396d3 (patch) | |
tree | db943cd15d492038d8286484e857c1e77a148be7 /Source | |
parent | af6414c6c5e9767f0f997523af8fe1e5a71f6093 (diff) | |
download | CMake-efc6c23a47e456b066089ed6f8fd11a1ca4396d3.zip CMake-efc6c23a47e456b066089ed6f8fd11a1ca4396d3.tar.gz CMake-efc6c23a47e456b066089ed6f8fd11a1ca4396d3.tar.bz2 |
bootstrap: Do not declare cmSystemTools functions that are not implemented
Convert runtime error messages into compile-time errors.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallExportGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 24 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 4 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 6 |
5 files changed, 19 insertions, 22 deletions
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index d932fd9..820f24a 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -85,7 +85,9 @@ void cmInstallExportGenerator::ComputeTempDir() } if (useMD5) { // Replace the destination path with a hash to keep it short. +#ifndef CMAKE_BOOTSTRAP this->TempDir += cmSystemTools::ComputeStringMD5(this->Destination); +#endif } else { std::string dest = this->Destination; // Avoid unix full paths. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 95c9eea..3a4c386 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2831,7 +2831,10 @@ void cmLocalGenerator::IncludeFileInUnitySources( unity_file << "/* " << pathToHash << " */\n" << "#undef " << *uniqueIdName << "\n" << "#define " << *uniqueIdName << " unity_" - << cmSystemTools::ComputeStringMD5(pathToHash) << "\n"; +#ifndef CMAKE_BOOTSTRAP + << cmSystemTools::ComputeStringMD5(pathToHash) << "\n" +#endif + ; } if (beforeInclude) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7d878b2..1b07358 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1158,39 +1158,26 @@ void cmSystemTools::MoveFileIfDifferent(const std::string& source, RemoveFile(source); } +#ifndef CMAKE_BOOTSTRAP std::string cmSystemTools::ComputeFileHash(const std::string& source, cmCryptoHash::Algo algo) { -#if !defined(CMAKE_BOOTSTRAP) cmCryptoHash hash(algo); return hash.HashFile(source); -#else - (void)source; - cmSystemTools::Message("hashsum not supported in bootstrapping mode", - "Error"); - return std::string(); -#endif } std::string cmSystemTools::ComputeStringMD5(const std::string& input) { -#if !defined(CMAKE_BOOTSTRAP) cmCryptoHash md5(cmCryptoHash::AlgoMD5); return md5.HashString(input); -#else - (void)input; - cmSystemTools::Message("md5sum not supported in bootstrapping mode", - "Error"); - return ""; -#endif } +# ifdef _WIN32 std::string cmSystemTools::ComputeCertificateThumbprint( const std::string& source) { std::string thumbprint; -#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) CRYPT_INTEGER_BLOB cryptBlob; HCERTSTORE certStore = NULL; PCCERT_CONTEXT certContext = NULL; @@ -1247,14 +1234,11 @@ std::string cmSystemTools::ComputeCertificateThumbprint( } CloseHandle(certFile); } -#else - (void)source; - cmSystemTools::Message("ComputeCertificateThumbprint is not implemented", - "Error"); -#endif return thumbprint; } +# endif +#endif void cmSystemTools::Glob(const std::string& directory, const std::string& regexp, diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 715724c..19dabe8 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -179,6 +179,7 @@ public: static void MoveFileIfDifferent(const std::string& source, const std::string& destination); +#ifndef CMAKE_BOOTSTRAP //! Compute the hash of a file static std::string ComputeFileHash(const std::string& source, cmCryptoHash::Algo algo); @@ -186,8 +187,11 @@ public: /** Compute the md5sum of a string. */ static std::string ComputeStringMD5(const std::string& input); +# ifdef _WIN32 //! Get the SHA thumbprint for a certificate file static std::string ComputeCertificateThumbprint(const std::string& source); +# endif +#endif /** * Run a single executable command diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index f742ace..265c1fd 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1588,7 +1588,11 @@ int cmcmd::HashSumFile(std::vector<std::string> const& args, std::cerr << "Error: " << filename << " is a directory" << std::endl; retval++; } else { - std::string value = cmSystemTools::ComputeFileHash(filename, algo); + std::string value +#ifndef CMAKE_BOOTSTRAP + = cmSystemTools::ComputeFileHash(filename, algo) +#endif + ; if (value.empty()) { // To mimic "md5sum/shasum" behavior in a shell: std::cerr << filename << ": No such file or directory" << std::endl; |