diff options
author | Brad King <brad.king@kitware.com> | 2001-06-08 18:40:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2001-06-08 18:40:28 (GMT) |
commit | cff74e9a78b79c1dc3a0a689bf454a2e78ee6f9f (patch) | |
tree | fb6884214c521f84f3b83da6624c2196a81f1ec5 /Source/cmCableWrapTclCommand.cxx | |
parent | 1ede7e4e243bab5373a257e4ebeb1d3c21dec75d (diff) | |
download | CMake-cff74e9a78b79c1dc3a0a689bf454a2e78ee6f9f.zip CMake-cff74e9a78b79c1dc3a0a689bf454a2e78ee6f9f.tar.gz CMake-cff74e9a78b79c1dc3a0a689bf454a2e78ee6f9f.tar.bz2 |
ENH: Added proper request for/generation of CABLE, GCCXML, and GCCXML_FLAGS cache entries. This also allowed the correct generation of gccxml rules.
Diffstat (limited to 'Source/cmCableWrapTclCommand.cxx')
-rw-r--r-- | Source/cmCableWrapTclCommand.cxx | 127 |
1 files changed, 93 insertions, 34 deletions
diff --git a/Source/cmCableWrapTclCommand.cxx b/Source/cmCableWrapTclCommand.cxx index 8fca056..57eea82 100644 --- a/Source/cmCableWrapTclCommand.cxx +++ b/Source/cmCableWrapTclCommand.cxx @@ -252,46 +252,44 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name, cmSystemTools::Error("Error opening file for writing: ", classCxxName.c_str()); } - + + // Generate the rule to have GCC-XML parse the classes to be wrapped. { - std::string command = "${GCCXML}"; - m_Makefile->ExpandVariablesInString(command); - // Only add the rule if GCC-XML is available. - if((command != "") && (command != "${GCCXML}")) - { - std::vector<std::string> depends; - depends.push_back(command); - command = cmSystemTools::EscapeSpaces(command.c_str()); - - std::string defineFlags = m_Makefile->GetDefineFlags(); - std::string includeFlags = "-I"; - includeFlags += std::string("\"") + m_Makefile->GetStartDirectory() + "\""; - - const std::vector<std::string>& includes = - m_Makefile->GetIncludeDirectories(); - for(std::vector<std::string>::const_iterator i = includes.begin(); - i != includes.end(); ++i) - { - includeFlags += " -I"; - includeFlags += cmSystemTools::EscapeSpaces(i->c_str()); - } - - command += " "+defineFlags+" "+includeFlags+" -fsyntax-only \"-fxml="+classXmlName+"\" "+classCxxName; - - std::vector<std::string> outputs; - outputs.push_back(classXmlName); + std::string command = this->GetGccXmlFromCache(); + std::vector<std::string> depends; + depends.push_back(command); + + std::string commandArgs = this->GetGccXmlFlagsFromCache(); + commandArgs += " "; + commandArgs += m_Makefile->GetDefineFlags(); + commandArgs += " -I\""; + commandArgs += m_Makefile->GetStartDirectory(); + commandArgs += "\""; - m_Makefile->AddCustomCommand(classCxxName.c_str(), - command.c_str(), - "", - depends, - outputs, m_TargetName.c_str()); + const std::vector<std::string>& includes = + m_Makefile->GetIncludeDirectories(); + for(std::vector<std::string>::const_iterator i = includes.begin(); + i != includes.end(); ++i) + { + commandArgs += " -I"; + commandArgs += cmSystemTools::EscapeSpaces(i->c_str()); } + + commandArgs += " -fsyntax-only -fxml="+classXmlName+" "+classCxxName; + + std::vector<std::string> outputs; + outputs.push_back(classXmlName); + + m_Makefile->AddCustomCommand(classCxxName.c_str(), + command.c_str(), + commandArgs.c_str(), + depends, + outputs, m_TargetName.c_str()); } + // Generate the rule to run cable on the GCC-XML output to generate wrappers. { - std::string command = "${CABLE}"; - m_Makefile->ExpandVariablesInString(command); + std::string command = this->GetCableFromCache(); std::vector<std::string> depends; depends.push_back(command); std::string commandArgs = " "+classConfigName+" -tcl "+classTclFullName+".cxx"; @@ -321,3 +319,64 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name, file.GetDepends().push_back("wrapCalls.h"); m_Makefile->AddSource(file, m_TargetName.c_str()); } + + +/** + * Get the "GCCXML" cache entry value. If there is no cache entry for GCCXML, + * one will be created and initialized to NOTFOUND. + */ +std::string cmCableWrapTclCommand::GetGccXmlFromCache() const +{ + const char* gccxml = + cmCacheManager::GetInstance()->GetCacheValue("GCCXML"); + if(gccxml) + { return gccxml; } + + m_Makefile->AddDefinition("GCCXML","NOTFOUND"); + cmCacheManager::GetInstance()->AddCacheEntry("GCCXML", + "NOTFOUND", + "Path to GCC-XML executable.", + cmCacheManager::FILEPATH); + return "NOTFOUND"; +} + + +/** + * Get the "GCCXML_FLAGS" cache entry value. If there is no cache + * entry for GCCXML_FLAGS, one will be created and initialized "". + */ +std::string cmCableWrapTclCommand::GetGccXmlFlagsFromCache() const +{ + const char* gccxmlFlags = + cmCacheManager::GetInstance()->GetCacheValue("GCCXML_FLAGS"); + if(gccxmlFlags) + { return gccxmlFlags; } + + m_Makefile->AddDefinition("GCCXML_FLAGS",""); + cmCacheManager::GetInstance()->AddCacheEntry( + "GCCXML_FLAGS", + "", + "Flags to GCC-XML to get it to parse the native compiler's headers.", + cmCacheManager::STRING); + return ""; +} + + +/** + * Get the "CABLE" cache entry value. If there is no cache entry for CABLE, + * one will be created and initialized to NOTFOUND. + */ +std::string cmCableWrapTclCommand::GetCableFromCache() const +{ + const char* cable = + cmCacheManager::GetInstance()->GetCacheValue("CABLE"); + if(cable) + { return cable; } + + m_Makefile->AddDefinition("CABLE","NOTFOUND"); + cmCacheManager::GetInstance()->AddCacheEntry("CABLE", + "NOTFOUND", + "Path to CABLE executable.", + cmCacheManager::FILEPATH); + return "NOTFOUND"; +} |