1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

Source: Simplify FindProgram calls

Remove defaulted arguments.  Remove unnecessary `.c_str()`.
This commit is contained in:
Brad King
2025-04-07 19:13:52 -04:00
parent d88b3e3ece
commit 5d700abda4
6 changed files with 10 additions and 14 deletions

View File

@@ -27,8 +27,7 @@ int cmCPackBundleGenerator::InitializeInternal()
}
if (this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP")) {
std::string const codesign_path = cmSystemTools::FindProgram(
"codesign", std::vector<std::string>(), false);
std::string const codesign_path = cmSystemTools::FindProgram("codesign");
if (codesign_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,

View File

@@ -75,8 +75,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
paths.emplace_back("/Applications/Xcode.app/Contents/Developer/Tools");
paths.emplace_back("/Developer/Tools");
std::string const hdiutil_path =
cmSystemTools::FindProgram("hdiutil", std::vector<std::string>(), false);
std::string const hdiutil_path = cmSystemTools::FindProgram("hdiutil");
if (hdiutil_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate hdiutil command" << std::endl);
@@ -85,7 +84,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
this->SetOptionIfNotSet("CPACK_COMMAND_HDIUTIL", hdiutil_path);
std::string const setfile_path =
cmSystemTools::FindProgram("SetFile", paths, false);
cmSystemTools::FindProgram("SetFile", paths);
if (setfile_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate SetFile command" << std::endl);
@@ -93,7 +92,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path);
std::string const rez_path = cmSystemTools::FindProgram("Rez", paths, false);
std::string const rez_path = cmSystemTools::FindProgram("Rez", paths);
if (rez_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate Rez command" << std::endl);

View File

@@ -46,8 +46,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
#endif
SetOptionIfNotSet("CPACK_INNOSETUP_EXECUTABLE", "ISCC");
std::string const& isccPath = cmSystemTools::FindProgram(
GetOption("CPACK_INNOSETUP_EXECUTABLE"), path, false);
std::string const& isccPath =
cmSystemTools::FindProgram(GetOption("CPACK_INNOSETUP_EXECUTABLE"), path);
if (isccPath.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,

View File

@@ -466,7 +466,7 @@ int cmCPackNSISGenerator::InitializeInternal()
this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis");
nsisPath = cmSystemTools::FindProgram(
*this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false);
*this->GetOption("CPACK_NSIS_EXECUTABLE"), path);
if (nsisPath.empty()) {
cmCPackLogger(

View File

@@ -127,9 +127,7 @@ int cmCPackProductBuildGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/Applications");
std::vector<std::string> no_paths;
std::string program =
cmSystemTools::FindProgram("pkgbuild", no_paths, false);
std::string program = cmSystemTools::FindProgram("pkgbuild");
if (program.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find pkgbuild executable" << std::endl);
@@ -137,7 +135,7 @@ int cmCPackProductBuildGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_PKGBUILD", program);
program = cmSystemTools::FindProgram("productbuild", no_paths, false);
program = cmSystemTools::FindProgram("productbuild");
if (program.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find productbuild executable" << std::endl);

View File

@@ -1708,7 +1708,7 @@ std::string cmCTestTestHandler::FindExecutable(
// if everything else failed, check the users path, but only if a full path
// wasn't specified
if (fullPath.empty() && filepath.empty()) {
std::string path = cmSystemTools::FindProgram(filename.c_str());
std::string path = cmSystemTools::FindProgram(filename);
if (!path.empty()) {
resultingConfig.clear();
return path;