Commit 9062e6d9 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: fix for bug 1866, make -G,-D -C options allow for space between arg and value

parent a1371381
...@@ -246,6 +246,10 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) ...@@ -246,6 +246,10 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
if(arg.find("-D",0) == 0) if(arg.find("-D",0) == 0)
{ {
std::string entry = arg.substr(2); std::string entry = arg.substr(2);
if(entry.size() == 0)
{
entry = args[++i];
}
std::string var, value; std::string var, value;
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type) || if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type) ||
...@@ -268,8 +272,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) ...@@ -268,8 +272,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
std::string path = arg.substr(2); std::string path = arg.substr(2);
if ( path.size() == 0 ) if ( path.size() == 0 )
{ {
cmSystemTools::Error("No initial cache file provided."); path = args[++i];
return false;
} }
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());
...@@ -384,6 +387,10 @@ void cmake::SetArgs(const std::vector<std::string>& args) ...@@ -384,6 +387,10 @@ void cmake::SetArgs(const std::vector<std::string>& args)
else if(arg.find("-G",0) == 0) else if(arg.find("-G",0) == 0)
{ {
std::string value = arg.substr(2); std::string value = arg.substr(2);
if(value.size() == 0)
{
value = args[++i];
}
cmGlobalGenerator* gen = cmGlobalGenerator* gen =
this->CreateGlobalGenerator(value.c_str()); this->CreateGlobalGenerator(value.c_str());
if(!gen) if(!gen)
......
...@@ -318,20 +318,20 @@ private: ...@@ -318,20 +318,20 @@ private:
}; };
#define CMAKE_STANDARD_OPTIONS_TABLE \ #define CMAKE_STANDARD_OPTIONS_TABLE \
{"-C<initial-cache>", "Pre-load cmake cache from given file.", \ {"-C <initial-cache>", "Pre-load cmake cache from given file.", \
"When cmake is first run in an empty build tree, it creates a " \ "When cmake is first run in an empty build tree, it creates a " \
"CMakeCache.txt file and populates it with customizable settings " \ "CMakeCache.txt file and populates it with customizable settings " \
"for the project. This option may be used to specify a file from " \ "for the project. This option may be used to specify a file from " \
"which to load cache entries before the first pass through " \ "which to load cache entries before the first pass through " \
"the project's cmake listfiles. The loaded entries take priority " \ "the project's cmake listfiles. The loaded entries take priority " \
"over the project's default values."}, \ "over the project's default values."}, \
{"-D<var>:<type>=<value>", "Create a cmake cache entry.", \ {"-D <var>:<type>=<value>", "Create a cmake cache entry.", \
"When cmake is first run in an empty build tree, it creates a " \ "When cmake is first run in an empty build tree, it creates a " \
"CMakeCache.txt file and populates it with customizable settings " \ "CMakeCache.txt file and populates it with customizable settings " \
"for the project. This option may be used to specify a setting " \ "for the project. This option may be used to specify a setting " \
"that takes priority over the project's default value. The option " \ "that takes priority over the project's default value. The option " \
"may be repeated for as many cache entries as desired."}, \ "may be repeated for as many cache entries as desired."}, \
{"-G<generator-name>", "Specify a makefile generator.", \ {"-G <generator-name>", "Specify a makefile generator.", \
"CMake may support multiple native build systems on certain platforms. " \ "CMake may support multiple native build systems on certain platforms. " \
"A makefile generator is responsible for generating a particular build " \ "A makefile generator is responsible for generating a particular build " \
"system. Possible generator names are specified in the Generators " \ "system. Possible generator names are specified in the Generators " \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment