summaryrefslogtreecommitdiffstats
path: root/Source/cmakemain.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-10-30 00:49:50 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-10-30 00:49:50 (GMT)
commitd21532cd02e18b1677983849a9f5d7454e24bb74 (patch)
treed0b5b80e42b4c0915787bbbcd9ae6f6065f82353 /Source/cmakemain.cxx
parent3b7c4b2a7b784a767bcf31774014d06b97c98d4f (diff)
downloadCMake-d21532cd02e18b1677983849a9f5d7454e24bb74.zip
CMake-d21532cd02e18b1677983849a9f5d7454e24bb74.tar.gz
CMake-d21532cd02e18b1677983849a9f5d7454e24bb74.tar.bz2
ENH: Ok, no more argument needed for script mode
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r--Source/cmakemain.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 3f94332..472ea7d 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -183,7 +183,7 @@ int do_cmake(int ac, char** av)
list_all_cached = true;
list_help = true;
}
- else if (strncmp(av[i], "-M", 2) == 0)
+ else if (strncmp(av[i], "--script", strlen("--script")) == 0)
{
script_mode = true;
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)
{
int ret = cmake::CMakeCommand(args);
@@ -216,7 +231,7 @@ int do_cmake(int ac, char** av)
{
cmCacheManager::CacheEntryType t = it.GetType();
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
- t != cmCacheManager::UNINITIALIZED )
+ t != cmCacheManager::UNINITIALIZED )
{
bool advanced = it.PropertyExists("ADVANCED");
if ( list_all_cached || !advanced)