ENH: Ok, no more argument needed for script mode
This commit is contained in:
parent
3b7c4b2a7b
commit
d21532cd02
|
@ -1047,3 +1047,11 @@ std::string cmSystemTools::ConvertToOutputPath(const char* path)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmSystemTools::StringEndsWith(const char* str1, const char* str2)
|
||||||
|
{
|
||||||
|
if ( !str1 || !str2 || strlen(str1) < strlen(str2) )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return !strncmp(str1 + (strlen(str1)-strlen(str2)), str2, strlen(str2));
|
||||||
|
}
|
||||||
|
|
|
@ -240,6 +240,9 @@ public:
|
||||||
s_ForceUnixPaths = v;
|
s_ForceUnixPaths = v;
|
||||||
}
|
}
|
||||||
static std::string ConvertToOutputPath(const char* path);
|
static std::string ConvertToOutputPath(const char* path);
|
||||||
|
|
||||||
|
//! Check if the first string ends with the second one.
|
||||||
|
static bool StringEndsWith(const char* str1, const char* str2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool s_ForceUnixPaths;
|
static bool s_ForceUnixPaths;
|
||||||
|
|
|
@ -215,9 +215,9 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||||
std::cerr << "loading initial cache file " << path.c_str() << "\n";
|
std::cerr << "loading initial cache file " << path.c_str() << "\n";
|
||||||
this->ReadListFile(path.c_str());
|
this->ReadListFile(path.c_str());
|
||||||
}
|
}
|
||||||
else if(arg.find("-M",0) == 0)
|
else if(arg.find("--script",0) == 0)
|
||||||
{
|
{
|
||||||
std::string path = arg.substr(2);
|
std::string path = arg.substr(strlen("--script"));
|
||||||
if ( path.size() == 0 )
|
if ( path.size() == 0 )
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("No cmake scrpt provided.");
|
cmSystemTools::Error("No cmake scrpt provided.");
|
||||||
|
@ -308,7 +308,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
// skip for now
|
// skip for now
|
||||||
}
|
}
|
||||||
else if(arg.find("-M",0) == 0)
|
else if(arg.find("--script",0) == 0)
|
||||||
{
|
{
|
||||||
// skip for now
|
// skip for now
|
||||||
}
|
}
|
||||||
|
@ -848,6 +848,7 @@ int cmake::DoPreConfigureChecks()
|
||||||
cmSystemTools::Error(
|
cmSystemTools::Error(
|
||||||
"The source directory does not appear to contain CMakeLists.txt.\n"
|
"The source directory does not appear to contain CMakeLists.txt.\n"
|
||||||
"Specify --help for usage, or press the help button on the CMake GUI.");
|
"Specify --help for usage, or press the help button on the CMake GUI.");
|
||||||
|
abort();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ int do_cmake(int ac, char** av)
|
||||||
list_all_cached = true;
|
list_all_cached = true;
|
||||||
list_help = true;
|
list_help = true;
|
||||||
}
|
}
|
||||||
else if (strncmp(av[i], "-M", 2) == 0)
|
else if (strncmp(av[i], "--script", strlen("--script")) == 0)
|
||||||
{
|
{
|
||||||
script_mode = true;
|
script_mode = true;
|
||||||
args.push_back(av[i]);
|
args.push_back(av[i]);
|
||||||
|
@ -194,6 +194,21 @@ int do_cmake(int ac, char** av)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( args.size() > 0 )
|
||||||
|
{
|
||||||
|
std::string &arg = args[args.size()-1];
|
||||||
|
if ( cmSystemTools::StringEndsWith(arg.c_str(), ".cmake") &&
|
||||||
|
cmSystemTools::FileExists(arg.c_str()) &&
|
||||||
|
!cmSystemTools::FileIsDirectory(arg.c_str()) )
|
||||||
|
{
|
||||||
|
std::vector<std::string>::iterator it = args.end();
|
||||||
|
-- it;
|
||||||
|
std::string ar = "--script" + arg;
|
||||||
|
args.insert(it, ar);
|
||||||
|
script_mode = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(command)
|
if(command)
|
||||||
{
|
{
|
||||||
int ret = cmake::CMakeCommand(args);
|
int ret = cmake::CMakeCommand(args);
|
||||||
|
@ -216,7 +231,7 @@ int do_cmake(int ac, char** av)
|
||||||
{
|
{
|
||||||
cmCacheManager::CacheEntryType t = it.GetType();
|
cmCacheManager::CacheEntryType t = it.GetType();
|
||||||
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
|
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
|
||||||
t != cmCacheManager::UNINITIALIZED )
|
t != cmCacheManager::UNINITIALIZED )
|
||||||
{
|
{
|
||||||
bool advanced = it.PropertyExists("ADVANCED");
|
bool advanced = it.PropertyExists("ADVANCED");
|
||||||
if ( list_all_cached || !advanced)
|
if ( list_all_cached || !advanced)
|
||||||
|
|
Loading…
Reference in New Issue