1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

KWSys 2025-04-09 (0fa969cb)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 0fa969cb0ba76ef5f426e6ea56a63a5fe3cdc6ac (master).

Upstream Shortlog
-----------------

Brad King (3):
      4336afc4 SystemTools: Remove redundant FindProgramPath function
      54219234 SystemTools: Remove redundant FindProgram signatures
      7a633bad SystemTools: Remove FindLibrary

Daniel Pfeifer (1):
      ac633613 CTestConfig: Remove unused variables
This commit is contained in:
KWSys Upstream
2025-04-09 09:27:33 -04:00
committed by Brad King
parent d64343249c
commit 21c464252f
3 changed files with 1 additions and 171 deletions

View File

@@ -1,9 +1,5 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing#kwsys for details.
set(CTEST_PROJECT_NAME "KWSys")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
set(CTEST_DROP_METHOD "https")
set(CTEST_DROP_SITE "open.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard")
set(CTEST_DROP_SITE_CDASH TRUE)
set(CTEST_SUBMIT_URL "https://open.cdash.org/submit.php?project=PublicDashboard")

View File

@@ -2893,17 +2893,6 @@ std::string SystemTools::FindDirectory(
* the system search path. Returns the full path to the executable if it is
* found. Otherwise, the empty string is returned.
*/
std::string SystemTools::FindProgram(char const* nameIn,
std::vector<std::string> const& userPaths,
bool no_system_path)
{
if (!nameIn || !*nameIn) {
return "";
}
return SystemTools::FindProgram(std::string(nameIn), userPaths,
no_system_path);
}
std::string SystemTools::FindProgram(std::string const& name,
std::vector<std::string> const& userPaths,
bool no_system_path)
@@ -2975,105 +2964,6 @@ std::string SystemTools::FindProgram(std::string const& name,
return "";
}
std::string SystemTools::FindProgram(std::vector<std::string> const& names,
std::vector<std::string> const& path,
bool noSystemPath)
{
for (std::string const& name : names) {
// Try to find the program.
std::string result = SystemTools::FindProgram(name, path, noSystemPath);
if (!result.empty()) {
return result;
}
}
return "";
}
/**
* Find the library with the given name. Searches the given path and then
* the system search path. Returns the full path to the library if it is
* found. Otherwise, the empty string is returned.
*/
std::string SystemTools::FindLibrary(std::string const& name,
std::vector<std::string> const& userPaths)
{
// See if the executable exists as written.
if (SystemTools::FileExists(name, true)) {
return SystemTools::CollapseFullPath(name);
}
// Add the system search path to our path.
std::vector<std::string> path;
SystemTools::GetPath(path);
// now add the additional paths
path.reserve(path.size() + userPaths.size());
path.insert(path.end(), userPaths.begin(), userPaths.end());
// Add a trailing slash to all paths to aid the search process.
for (std::string& p : path) {
if (p.empty() || p.back() != '/') {
p += '/';
}
}
std::string tryPath;
for (std::string const& p : path) {
#if defined(__APPLE__)
tryPath = p;
tryPath += name;
tryPath += ".framework";
if (SystemTools::FileIsDirectory(tryPath)) {
return SystemTools::CollapseFullPath(tryPath);
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
tryPath = p;
tryPath += name;
tryPath += ".lib";
if (SystemTools::FileExists(tryPath, true)) {
return SystemTools::CollapseFullPath(tryPath);
}
#else
tryPath = p;
tryPath += "lib";
tryPath += name;
tryPath += ".so";
if (SystemTools::FileExists(tryPath, true)) {
return SystemTools::CollapseFullPath(tryPath);
}
tryPath = p;
tryPath += "lib";
tryPath += name;
tryPath += ".a";
if (SystemTools::FileExists(tryPath, true)) {
return SystemTools::CollapseFullPath(tryPath);
}
tryPath = p;
tryPath += "lib";
tryPath += name;
tryPath += ".sl";
if (SystemTools::FileExists(tryPath, true)) {
return SystemTools::CollapseFullPath(tryPath);
}
tryPath = p;
tryPath += "lib";
tryPath += name;
tryPath += ".dylib";
if (SystemTools::FileExists(tryPath, true)) {
return SystemTools::CollapseFullPath(tryPath);
}
tryPath = p;
tryPath += "lib";
tryPath += name;
tryPath += ".dll";
if (SystemTools::FileExists(tryPath, true)) {
return SystemTools::CollapseFullPath(tryPath);
}
#endif
}
// Couldn't find the library.
return "";
}
std::string SystemTools::GetRealPath(std::string const& path,
std::string* errorMessage)
{
@@ -3380,33 +3270,6 @@ bool SystemTools::SplitProgramPath(std::string const& in_name,
return true;
}
bool SystemTools::FindProgramPath(char const* argv0, std::string& pathOut,
std::string& errorMsg)
{
std::vector<std::string> failures;
std::string self = argv0 ? argv0 : "";
failures.push_back(self);
SystemTools::ConvertToUnixSlashes(self);
self = SystemTools::FindProgram(self);
if (!SystemTools::FileIsExecutable(self)) {
failures.push_back(self);
std::ostringstream msg;
msg << "Can not find the command line program ";
msg << "\n";
if (argv0) {
msg << " argv[0] = \"" << argv0 << "\"\n";
}
msg << " Attempted paths:\n";
for (std::string const& ff : failures) {
msg << " \"" << ff << "\"\n";
}
errorMsg = msg.str();
return false;
}
pathOut = self;
return true;
}
static void SystemToolsAppendComponents(
std::vector<std::string>& out_components,
std::vector<std::string>::iterator first,

View File

@@ -382,21 +382,6 @@ public:
static bool SplitProgramPath(std::string const& in_name, std::string& dir,
std::string& file, bool errorReport = true);
/**
* Given argv[0] for a unix program find the full path to a running
* executable. argv0 can be null for windows WinMain programs
* in this case GetModuleFileName will be used to find the path
* to the running executable. If argv0 is not a full path,
* then this will try to find the full path. If the path is not
* found false is returned, if found true is returned. An error
* message of the attempted paths is stored in errorMsg.
* exeName is the name of the executable.
* buildDir is a possibly null path to the build directory.
* installPrefix is a possibly null pointer to the install directory.
*/
static bool FindProgramPath(char const* argv0, std::string& pathOut,
std::string& errorMsg);
/**
* Given a path to a file or directory, convert it to a full path.
* This collapses away relative paths relative to the cwd argument
@@ -726,24 +711,10 @@ public:
/**
* Find an executable in the system PATH, with optional extra paths
*/
static std::string FindProgram(
char const* name,
std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
static std::string FindProgram(
std::string const& name,
std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
static std::string FindProgram(
std::vector<std::string> const& names,
std::vector<std::string> const& path = std::vector<std::string>(),
bool no_system_path = false);
/**
* Find a library in the system PATH, with optional extra paths
*/
static std::string FindLibrary(std::string const& name,
std::vector<std::string> const& path);
/**
* Return true if the file is a directory