mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`, now with "east const" enforcement. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Issue: #26123
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#ifndef EXE_COMMON_H
|
|
#define EXE_COMMON_H
|
|
|
|
#include <cstdlib>
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
inline int runRealExe(int const argc, char** argv)
|
|
{
|
|
std::vector<std::string> args;
|
|
std::string realMocPath;
|
|
std::string const pathArg = "EXE_PATH=";
|
|
std::string cmd;
|
|
if (argc > 1) {
|
|
for (int i = 1; i < argc; ++i) {
|
|
std::string const arg = argv[i];
|
|
if (arg.find(pathArg) != std::string::npos) {
|
|
realMocPath = arg.substr(pathArg.length());
|
|
// if EXE_PATH contains spaces, wrap it in quotes
|
|
if (realMocPath.find(" ") != std::string::npos) {
|
|
realMocPath = "\"" + realMocPath + "\"";
|
|
}
|
|
} else {
|
|
args.push_back(arg);
|
|
}
|
|
}
|
|
}
|
|
#ifdef _WIN32
|
|
cmd += "cmd /C \"";
|
|
#endif
|
|
cmd += realMocPath + " ";
|
|
for (auto arg : args) {
|
|
// if arg contains spaces, wrap it in quotes
|
|
if (arg.find(' ') != std::string::npos) {
|
|
cmd += " \"" + arg + "\"";
|
|
} else {
|
|
cmd += " " + arg;
|
|
}
|
|
}
|
|
#ifdef _WIN32
|
|
cmd += "\"";
|
|
#endif
|
|
std::cout << "Running real exe:" << cmd << std::endl;
|
|
return std::system(cmd.c_str());
|
|
}
|
|
|
|
#endif
|