Add check so that java projects build without C++

This commit is contained in:
Andy Cedilnik 2002-12-11 12:09:52 -05:00
parent d6f98c2a82
commit 682e2c7b8b
3 changed files with 84 additions and 73 deletions

View File

@ -153,42 +153,47 @@ void cmGlobalVisualStudio7Generator::SetupTests()
void cmGlobalVisualStudio7Generator::GenerateConfigurations() void cmGlobalVisualStudio7Generator::GenerateConfigurations()
{ {
// process the configurations // process the configurations
std::string configTypes = const char* ct
m_CMakeInstance->GetCacheDefinition("CMAKE_CONFIGURATION_TYPES"); = m_CMakeInstance->GetCacheDefinition("CMAKE_CONFIGURATION_TYPES");
std::string::size_type start = 0; if ( ct )
std::string::size_type endpos = 0;
while(endpos != std::string::npos)
{ {
endpos = configTypes.find(' ', start); std::string configTypes = ct;
std::string config;
std::string::size_type len; std::string::size_type start = 0;
if(endpos != std::string::npos) std::string::size_type endpos = 0;
while(endpos != std::string::npos)
{ {
len = endpos - start; endpos = configTypes.find(' ', start);
} std::string config;
else std::string::size_type len;
{ if(endpos != std::string::npos)
len = configTypes.size() - start;
}
config = configTypes.substr(start, len);
if(config == "Debug" || config == "Release" ||
config == "MinSizeRel" || config == "RelWithDebInfo")
{
// only add unique configurations
if(std::find(m_Configurations.begin(),
m_Configurations.end(), config) == m_Configurations.end())
{ {
m_Configurations.push_back(config); len = endpos - start;
} }
else
{
len = configTypes.size() - start;
}
config = configTypes.substr(start, len);
if(config == "Debug" || config == "Release" ||
config == "MinSizeRel" || config == "RelWithDebInfo")
{
// only add unique configurations
if(std::find(m_Configurations.begin(),
m_Configurations.end(), config) == m_Configurations.end())
{
m_Configurations.push_back(config);
}
}
else
{
cmSystemTools::Error(
"Invalid configuration type in CMAKE_CONFIGURATION_TYPES: ",
config.c_str(),
" (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)");
}
start = endpos+1;
} }
else
{
cmSystemTools::Error(
"Invalid configuration type in CMAKE_CONFIGURATION_TYPES: ",
config.c_str(),
" (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)");
}
start = endpos+1;
} }
if(m_Configurations.size() == 0) if(m_Configurations.size() == 0)
{ {

View File

@ -775,47 +775,50 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
while(fin) while(fin)
{ {
fin.getline(buffer, 2048); fin.getline(buffer, 2048);
std::string line = buffer; std::string line = buffer;
const char* mfcFlag = m_Makefile->GetDefinition("CMAKE_MFC_FLAG"); const char* mfcFlag = m_Makefile->GetDefinition("CMAKE_MFC_FLAG");
if(!mfcFlag) if(!mfcFlag)
{ {
mfcFlag = "0"; mfcFlag = "0";
} }
cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE", cmSystemTools::ReplaceString(line, "CMAKE_CUSTOM_RULE_CODE",
customRuleCode.c_str()); customRuleCode.c_str());
cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG", cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG",
mfcFlag); mfcFlag);
cmSystemTools::ReplaceString(line, "CM_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
libOptions.c_str()); libOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
libDebugOptions.c_str()); libDebugOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
libOptimizedOptions.c_str()); libOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_MULTILINE_LIBRARIES",
libMultiLineOptions.c_str()); libMultiLineOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_MULTILINE_DEBUG_LIBRARIES",
libMultiLineDebugOptions.c_str()); libMultiLineDebugOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIMIZED_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIMIZED_LIBRARIES",
libMultiLineOptimizedOptions.c_str()); libMultiLineOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
m_IncludeOptions.c_str()); m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
// because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH
// are already quoted in the template file, // are already quoted in the template file,
// we need to remove the quotes here, we still need // we need to remove the quotes here, we still need
// to convert to output path for unix to win32 conversion // to convert to output path for unix to win32 conversion
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH", cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
removeQuotes( removeQuotes(
cmSystemTools::ConvertToOutputPath(libPath.c_str())).c_str()); cmSystemTools::ConvertToOutputPath(libPath.c_str())).c_str());
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH", cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
removeQuotes( removeQuotes(
cmSystemTools::ConvertToOutputPath(exePath.c_str())).c_str()); cmSystemTools::ConvertToOutputPath(exePath.c_str())).c_str());
cmSystemTools::ReplaceString(line, cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES", "EXTRA_DEFINES",
m_Makefile->GetDefineFlags()); m_Makefile->GetDefineFlags());
cmGlobalGenerator* gen = this->GetGlobalGenerator();
if ( gen->GetLanguageEnabled("C") ||gen->GetLanguageEnabled("CXX") )
{
std::string flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE"); std::string flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE");
flags += " -DCMAKE_INTDIR=\\\"Release\\\""; flags += " -DCMAKE_INTDIR=\\\"Release\\\"";
cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flags.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flags.c_str());
@ -831,8 +834,8 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS",
m_Makefile-> m_Makefile->
GetDefinition("CMAKE_CXX_FLAGS")); GetDefinition("CMAKE_CXX_FLAGS"));
}
fout << line.c_str() << std::endl; fout << line.c_str() << std::endl;
} }
} }

View File

@ -329,7 +329,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
} }
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n"; fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
fout << "\t\t\t\tObjectFile=\"" << configName << "\\\"\n"; fout << "\t\t\t\tObjectFile=\"" << configName << "\\\"\n";
fout << "\t\t\t\tWarningLevel=\"" << m_Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") << "\"\n"; if ( m_Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") )
{
fout << "\t\t\t\tWarningLevel=\"" << m_Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") << "\"\n";
}
fout << "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n" fout << "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n"
<< "\t\t\t\tDebugInformationFormat=\"3\""; << "\t\t\t\tDebugInformationFormat=\"3\"";
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool