ENH: Styart working on bundles support and abstract WIN32_EXECUTABLE
This commit is contained in:
parent
6ab87555ea
commit
b1a7421840
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${APPLE_GUI_EXECUTABLE}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${APPLE_GUI_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${APPLE_GUI_ICON}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${APPLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${APPLE_GUI_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${APPLE_GUI_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${APPLE_GUI_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${APPLE_GUI_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSRequiresCarbon</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${APPLE_GUI_COPYRIGHT}</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -30,16 +30,62 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
|
|
||||||
++s;
|
++s;
|
||||||
bool use_win32 = false;
|
bool use_win32 = false;
|
||||||
|
bool use_macbundle = false;
|
||||||
if (*s == "WIN32")
|
while ( s != args.end() )
|
||||||
{
|
{
|
||||||
++s;
|
if (*s == "WIN32")
|
||||||
use_win32 = true;
|
{
|
||||||
|
++s;
|
||||||
|
use_win32 = true;
|
||||||
|
}
|
||||||
|
else if ( *s == "MACBUNDLE" )
|
||||||
|
{
|
||||||
|
++s;
|
||||||
|
use_macbundle = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> srclists(s, args.end());
|
std::vector<std::string> srclists(s, args.end());
|
||||||
m_Makefile->AddExecutable(exename.c_str(), srclists, use_win32);
|
cmTarget* tgt = m_Makefile->AddExecutable(exename.c_str(), srclists);
|
||||||
|
if ( use_win32 )
|
||||||
|
{
|
||||||
|
tgt->SetProperty("WIN32_EXECUTABLE", "ON");
|
||||||
|
}
|
||||||
|
if ( use_macbundle)
|
||||||
|
{
|
||||||
|
tgt->SetProperty("MACOSX_BUNDLE", "ON");
|
||||||
|
#ifdef __APPLE__
|
||||||
|
cmListFileFunction func;
|
||||||
|
func.m_Name = "CONFIGURE_FILE";
|
||||||
|
std::string f1 = m_Makefile->GetModulesFile("MacOSXBundleInfo.plist.in");
|
||||||
|
if ( f1.size() == 0 )
|
||||||
|
{
|
||||||
|
this->SetError("could not find Mac OSX bundle template file.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string macdir = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||||
|
if ( macdir.size() == 0 )
|
||||||
|
{
|
||||||
|
macdir = m_Makefile->GetCurrentOutputDirectory();
|
||||||
|
if(macdir.size() && macdir[macdir.size()-1] != '/')
|
||||||
|
{
|
||||||
|
macdir += "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
macdir += exename + ".app/Contents/";
|
||||||
|
std::string f2 = macdir + "Info.plist";
|
||||||
|
macdir += "MacOS";
|
||||||
|
cmSystemTools::MakeDirectory(macdir.c_str());
|
||||||
|
|
||||||
|
func.m_Arguments.push_back(cmListFileArgument(f1, true));
|
||||||
|
func.m_Arguments.push_back(cmListFileArgument(f2, true));
|
||||||
|
m_Makefile->ExecuteCommand(func);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,11 @@ void cmAddExecutable(void *arg, const char *exename,
|
||||||
{
|
{
|
||||||
srcs2.push_back(srcs[i]);
|
srcs2.push_back(srcs[i]);
|
||||||
}
|
}
|
||||||
mf->AddExecutable(exename, srcs2, (win32 ? true : false));
|
cmTarget* tg = mf->AddExecutable(exename, srcs2);
|
||||||
|
if ( win32 )
|
||||||
|
{
|
||||||
|
tg->SetProperty("WIN32_EXECUTABLE", "ON");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmAddUtilityCommand(void *arg, const char* utilityName,
|
void cmAddUtilityCommand(void *arg, const char* utilityName,
|
||||||
|
|
|
@ -219,50 +219,24 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmFindPackageCommand::FindModule(bool& found, bool quiet)
|
bool cmFindPackageCommand::FindModule(bool& found, bool quiet)
|
||||||
{
|
{
|
||||||
// Search the CMAKE_MODULE_PATH for a Find<name>.cmake module.
|
std::string module = "/Find";
|
||||||
found = false;
|
module += this->Name;
|
||||||
std::string module;
|
module += ".cmake";
|
||||||
std::vector<std::string> modulePath;
|
std::string mfile = m_Makefile->GetModulesFile(module.c_str());
|
||||||
const char* def = m_Makefile->GetDefinition("CMAKE_MODULE_PATH");
|
if ( mfile.size() )
|
||||||
if(def)
|
|
||||||
{
|
{
|
||||||
cmSystemTools::ExpandListArgument(def, modulePath);
|
if(quiet)
|
||||||
}
|
|
||||||
|
|
||||||
// Also search in the standard modules location.
|
|
||||||
def = m_Makefile->GetDefinition("CMAKE_ROOT");
|
|
||||||
if(def)
|
|
||||||
{
|
|
||||||
std::string rootModules = def;
|
|
||||||
rootModules += "/Modules";
|
|
||||||
modulePath.push_back(rootModules);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look through the possible module directories.
|
|
||||||
for(std::vector<std::string>::iterator i = modulePath.begin();
|
|
||||||
i != modulePath.end(); ++i)
|
|
||||||
{
|
|
||||||
module = *i;
|
|
||||||
cmSystemTools::ConvertToUnixSlashes(module);
|
|
||||||
module += "/Find";
|
|
||||||
module += this->Name;
|
|
||||||
module += ".cmake";
|
|
||||||
if(cmSystemTools::FileExists(module.c_str()))
|
|
||||||
{
|
{
|
||||||
found = true;
|
// Tell the module that is about to be read that it should find
|
||||||
|
// quietly.
|
||||||
if(quiet)
|
std::string quietly = this->Name;
|
||||||
{
|
quietly += "_FIND_QUIETLY";
|
||||||
// Tell the module that is about to be read that it should find
|
m_Makefile->AddDefinition(quietly.c_str(), "1");
|
||||||
// quietly.
|
|
||||||
std::string quietly = this->Name;
|
|
||||||
quietly += "_FIND_QUIETLY";
|
|
||||||
m_Makefile->AddDefinition(quietly.c_str(), "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the module we found.
|
|
||||||
return this->ReadListFile(module.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the module we found.
|
||||||
|
found = true;
|
||||||
|
return this->ReadListFile(mfile.c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,6 @@ void cmLocalGenerator::GenerateInstallRules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
fname = exeOutPath;
|
fname = exeOutPath;
|
||||||
fname += this->GetFullTargetName(l->first.c_str(), l->second);
|
fname += this->GetFullTargetName(l->first.c_str(), l->second);
|
||||||
|
@ -253,8 +252,7 @@ void cmLocalGenerator::AddInstallRule(std::ostream& fout, const char* dest,
|
||||||
switch ( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break;
|
case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break;
|
||||||
case cmTarget::WIN32_EXECUTABLE: stype = "EXECUTABLE"; break;
|
|
||||||
case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break;
|
case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break;
|
||||||
case cmTarget::SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break;
|
case cmTarget::SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break;
|
||||||
case cmTarget::MODULE_LIBRARY: stype = "MODULE"; break;
|
case cmTarget::MODULE_LIBRARY: stype = "MODULE"; break;
|
||||||
|
@ -302,7 +300,6 @@ std::string cmLocalGenerator::GetFullTargetName(const char* n,
|
||||||
suffixVar = "CMAKE_SHARED_MODULE_SUFFIX";
|
suffixVar = "CMAKE_SHARED_MODULE_SUFFIX";
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
targetSuffix = cmSystemTools::GetExecutableExtension();
|
targetSuffix = cmSystemTools::GetExecutableExtension();
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
case cmTarget::INSTALL_FILES:
|
case cmTarget::INSTALL_FILES:
|
||||||
|
|
|
@ -350,7 +350,6 @@ std::string cmLocalUnixMakefileGenerator::GetBaseTargetName(const char* n,
|
||||||
prefixVar = "CMAKE_SHARED_MODULE_PREFIX";
|
prefixVar = "CMAKE_SHARED_MODULE_PREFIX";
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
case cmTarget::INSTALL_FILES:
|
case cmTarget::INSTALL_FILES:
|
||||||
case cmTarget::INSTALL_PROGRAMS:
|
case cmTarget::INSTALL_PROGRAMS:
|
||||||
|
@ -383,7 +382,6 @@ std::string cmLocalUnixMakefileGenerator::GetFullTargetName(const char* n,
|
||||||
suffixVar = "CMAKE_SHARED_MODULE_SUFFIX";
|
suffixVar = "CMAKE_SHARED_MODULE_SUFFIX";
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
targetSuffix = cmSystemTools::GetExecutableExtension();
|
targetSuffix = cmSystemTools::GetExecutableExtension();
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
case cmTarget::INSTALL_FILES:
|
case cmTarget::INSTALL_FILES:
|
||||||
|
@ -454,8 +452,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
||||||
for(cmTargets::const_iterator l = tgts.begin();
|
for(cmTargets::const_iterator l = tgts.begin();
|
||||||
l != tgts.end(); l++)
|
l != tgts.end(); l++)
|
||||||
{
|
{
|
||||||
if ((l->second.GetType() == cmTarget::EXECUTABLE ||
|
if ( l->second.GetType() == cmTarget::EXECUTABLE )
|
||||||
l->second.GetType() == cmTarget::WIN32_EXECUTABLE))
|
|
||||||
{
|
{
|
||||||
path = "... ";
|
path = "... ";
|
||||||
path += l->first + cmSystemTools::GetExecutableExtension();
|
path += l->first + cmSystemTools::GetExecutableExtension();
|
||||||
|
@ -499,8 +496,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
||||||
for(cmTargets::const_iterator l = tgts.begin();
|
for(cmTargets::const_iterator l = tgts.begin();
|
||||||
l != tgts.end(); l++)
|
l != tgts.end(); l++)
|
||||||
{
|
{
|
||||||
if ((l->second.GetType() == cmTarget::EXECUTABLE ||
|
if (l->second.GetType() == cmTarget::EXECUTABLE &&
|
||||||
l->second.GetType() == cmTarget::WIN32_EXECUTABLE) &&
|
|
||||||
l->second.IsInAll())
|
l->second.IsInAll())
|
||||||
{
|
{
|
||||||
path = m_ExecutableOutputPath;
|
path = m_ExecutableOutputPath;
|
||||||
|
@ -676,8 +672,7 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
||||||
std::string linkLibs;
|
std::string linkLibs;
|
||||||
|
|
||||||
// Flags to link an executable to shared libraries.
|
// Flags to link an executable to shared libraries.
|
||||||
if( tgt.GetType() == cmTarget::EXECUTABLE ||
|
if( tgt.GetType() == cmTarget::EXECUTABLE )
|
||||||
tgt.GetType() == cmTarget::WIN32_EXECUTABLE )
|
|
||||||
{
|
{
|
||||||
if(cxx)
|
if(cxx)
|
||||||
{
|
{
|
||||||
|
@ -1320,6 +1315,16 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
||||||
const cmTarget &t)
|
const cmTarget &t)
|
||||||
{
|
{
|
||||||
std::string linkFlags;
|
std::string linkFlags;
|
||||||
|
bool win32_executable = false;
|
||||||
|
bool macosx_bundle = false;
|
||||||
|
if ( t.GetPropertyAsBool("WIN32_EXECUTABLE") )
|
||||||
|
{
|
||||||
|
win32_executable = true;
|
||||||
|
}
|
||||||
|
if ( t.GetPropertyAsBool("MACOSX_BUNDLE") )
|
||||||
|
{
|
||||||
|
macosx_bundle = true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||||
buildType = cmSystemTools::UpperCase(buildType);
|
buildType = cmSystemTools::UpperCase(buildType);
|
||||||
|
@ -1335,6 +1340,14 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
||||||
target += "/";
|
target += "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if ( macosx_bundle )
|
||||||
|
{
|
||||||
|
// Make bundle directories
|
||||||
|
target += name;
|
||||||
|
target += ".app/Contents/MacOS/";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
target += name;
|
target += name;
|
||||||
target += cmSystemTools::GetExecutableExtension();
|
target += cmSystemTools::GetExecutableExtension();
|
||||||
target = this->ConvertToRelativeOutputPath(target.c_str());
|
target = this->ConvertToRelativeOutputPath(target.c_str());
|
||||||
|
@ -1384,6 +1397,7 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
||||||
std::string comment = "executable";
|
std::string comment = "executable";
|
||||||
|
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
|
|
||||||
std::string customCommands = this->CreatePreBuildRules(t, name);
|
std::string customCommands = this->CreatePreBuildRules(t, name);
|
||||||
if(customCommands.size() > 0)
|
if(customCommands.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -1406,7 +1420,7 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
||||||
linkFlags += " ";
|
linkFlags += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t.GetType() == cmTarget::WIN32_EXECUTABLE)
|
if(win32_executable)
|
||||||
{
|
{
|
||||||
linkFlags += this->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
|
linkFlags += this->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
|
||||||
linkFlags += " ";
|
linkFlags += " ";
|
||||||
|
@ -1526,7 +1540,6 @@ void cmLocalUnixMakefileGenerator::OutputTargets(std::ostream& fout)
|
||||||
this->OutputModuleLibraryRule(fout, l->first.c_str(), l->second);
|
this->OutputModuleLibraryRule(fout, l->first.c_str(), l->second);
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
this->OutputExecutableRule(fout, l->first.c_str(), l->second);
|
this->OutputExecutableRule(fout, l->first.c_str(), l->second);
|
||||||
break;
|
break;
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
|
@ -1564,8 +1577,7 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
|
||||||
|| (l->second.GetType() == cmTarget::MODULE_LIBRARY)
|
|| (l->second.GetType() == cmTarget::MODULE_LIBRARY)
|
||||||
|| (l->second.GetType() == cmTarget::STATIC_LIBRARY)
|
|| (l->second.GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
|| (l->second.GetType() == cmTarget::EXECUTABLE)
|
|| (l->second.GetType() == cmTarget::EXECUTABLE)
|
||||||
|| (l->second.GetType() == cmTarget::UTILITY)
|
|| (l->second.GetType() == cmTarget::UTILITY))
|
||||||
|| (l->second.GetType() == cmTarget::WIN32_EXECUTABLE))
|
|
||||||
{
|
{
|
||||||
fout << this->CreateMakeVariable(l->first.c_str(), "_DEPEND_LIBS") << " = ";
|
fout << this->CreateMakeVariable(l->first.c_str(), "_DEPEND_LIBS") << " = ";
|
||||||
|
|
||||||
|
@ -2434,7 +2446,6 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
||||||
<< installNameReal << "\" \"" << installNameSO << "\" \"" << installName
|
<< installNameReal << "\" \"" << installNameSO << "\" \"" << installName
|
||||||
<< "\"\n";
|
<< "\"\n";
|
||||||
}; break;
|
}; break;
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
fname = m_ExecutableOutputPath;
|
fname = m_ExecutableOutputPath;
|
||||||
fname += this->GetFullTargetName(l->first.c_str(), l->second);
|
fname += this->GetFullTargetName(l->first.c_str(), l->second);
|
||||||
|
|
|
@ -97,9 +97,6 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second);
|
this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second);
|
||||||
break;
|
break;
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
this->SetBuildType(WIN32_EXECUTABLE,l->first.c_str(), l->second);
|
|
||||||
break;
|
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
this->SetBuildType(UTILITY, l->first.c_str(), l->second);
|
this->SetBuildType(UTILITY, l->first.c_str(), l->second);
|
||||||
break;
|
break;
|
||||||
|
@ -581,16 +578,20 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
|
||||||
m_DSPFooterTemplate += "/DLLFooter.dsptemplate";
|
m_DSPFooterTemplate += "/DLLFooter.dsptemplate";
|
||||||
break;
|
break;
|
||||||
case EXECUTABLE:
|
case EXECUTABLE:
|
||||||
m_DSPHeaderTemplate = root;
|
if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") )
|
||||||
m_DSPHeaderTemplate += "/EXEHeader.dsptemplate";
|
{
|
||||||
m_DSPFooterTemplate = root;
|
m_DSPHeaderTemplate = root;
|
||||||
m_DSPFooterTemplate += "/EXEFooter.dsptemplate";
|
m_DSPHeaderTemplate += "/EXEWinHeader.dsptemplate";
|
||||||
break;
|
m_DSPFooterTemplate = root;
|
||||||
case WIN32_EXECUTABLE:
|
m_DSPFooterTemplate += "/EXEFooter.dsptemplate";
|
||||||
m_DSPHeaderTemplate = root;
|
}
|
||||||
m_DSPHeaderTemplate += "/EXEWinHeader.dsptemplate";
|
else
|
||||||
m_DSPFooterTemplate = root;
|
{
|
||||||
m_DSPFooterTemplate += "/EXEFooter.dsptemplate";
|
m_DSPHeaderTemplate = root;
|
||||||
|
m_DSPHeaderTemplate += "/EXEHeader.dsptemplate";
|
||||||
|
m_DSPFooterTemplate = root;
|
||||||
|
m_DSPFooterTemplate += "/EXEFooter.dsptemplate";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UTILITY:
|
case UTILITY:
|
||||||
m_DSPHeaderTemplate = root;
|
m_DSPHeaderTemplate = root;
|
||||||
|
|
|
@ -235,7 +235,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
|
||||||
configType = "2";
|
configType = "2";
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
configType = "1";
|
configType = "1";
|
||||||
break;
|
break;
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
|
@ -491,8 +490,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string extraLinkOptions;
|
std::string extraLinkOptions;
|
||||||
if((target.GetType() == cmTarget::EXECUTABLE) ||
|
if(target.GetType() == cmTarget::EXECUTABLE)
|
||||||
(target.GetType() == cmTarget::WIN32_EXECUTABLE))
|
|
||||||
{
|
{
|
||||||
extraLinkOptions = m_Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
|
extraLinkOptions = m_Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
|
||||||
}
|
}
|
||||||
|
@ -575,7 +573,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
||||||
fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
|
fout << "\t\t\t\tImportLibrary=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
|
||||||
|
|
||||||
fout << "\t\t\t<Tool\n"
|
fout << "\t\t\t<Tool\n"
|
||||||
<< "\t\t\t\tName=\"VCLinkerTool\"\n"
|
<< "\t\t\t\tName=\"VCLinkerTool\"\n"
|
||||||
|
|
|
@ -1053,29 +1053,16 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::AddExecutable(const char *exeName,
|
cmTarget* cmMakefile::AddExecutable(const char *exeName,
|
||||||
const std::vector<std::string> &srcs)
|
const std::vector<std::string> &srcs)
|
||||||
{
|
|
||||||
this->AddExecutable(exeName,srcs,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmMakefile::AddExecutable(const char *exeName,
|
|
||||||
const std::vector<std::string> &srcs,
|
|
||||||
bool win32)
|
|
||||||
{
|
{
|
||||||
cmTarget target;
|
cmTarget target;
|
||||||
if (win32)
|
target.SetType(cmTarget::EXECUTABLE);
|
||||||
{
|
|
||||||
target.SetType(cmTarget::WIN32_EXECUTABLE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
target.SetType(cmTarget::EXECUTABLE);
|
|
||||||
}
|
|
||||||
target.SetInAll(true);
|
target.SetInAll(true);
|
||||||
target.GetSourceLists() = srcs;
|
target.GetSourceLists() = srcs;
|
||||||
this->AddGlobalLinkInformation(exeName, target);
|
this->AddGlobalLinkInformation(exeName, target);
|
||||||
m_Targets.insert(cmTargets::value_type(exeName,target));
|
cmTargets::iterator it =
|
||||||
|
m_Targets.insert(cmTargets::value_type(exeName,target)).first;
|
||||||
|
|
||||||
// Add an entry into the cache
|
// Add an entry into the cache
|
||||||
std::string exePath = exeName;
|
std::string exePath = exeName;
|
||||||
|
@ -1084,6 +1071,7 @@ void cmMakefile::AddExecutable(const char *exeName,
|
||||||
AddCacheEntry(exePath.c_str(),
|
AddCacheEntry(exePath.c_str(),
|
||||||
this->GetCurrentOutputDirectory(),
|
this->GetCurrentOutputDirectory(),
|
||||||
"Path to an executable", cmCacheManager::INTERNAL);
|
"Path to an executable", cmCacheManager::INTERNAL);
|
||||||
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2186,3 +2174,35 @@ std::string cmMakefile::FindLibrary(const char* name,
|
||||||
|
|
||||||
return cmSystemTools::FindLibrary(name, path);
|
return cmSystemTools::FindLibrary(name, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmMakefile::GetModulesFile(const char* filename)
|
||||||
|
{
|
||||||
|
std::vector<std::string> modulePath;
|
||||||
|
const char* def = this->GetDefinition("CMAKE_MODULE_PATH");
|
||||||
|
if(def)
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(def, modulePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also search in the standard modules location.
|
||||||
|
def = this->GetDefinition("CMAKE_ROOT");
|
||||||
|
if(def)
|
||||||
|
{
|
||||||
|
std::string rootModules = def;
|
||||||
|
rootModules += "/Modules";
|
||||||
|
modulePath.push_back(rootModules);
|
||||||
|
}
|
||||||
|
//std::string Look through the possible module directories.
|
||||||
|
for(std::vector<std::string>::iterator i = modulePath.begin();
|
||||||
|
i != modulePath.end(); ++i)
|
||||||
|
{
|
||||||
|
std::string itempl = *i;
|
||||||
|
cmSystemTools::ConvertToUnixSlashes(itempl);
|
||||||
|
itempl += filename;
|
||||||
|
if(cmSystemTools::FileExists(itempl.c_str()))
|
||||||
|
{
|
||||||
|
return itempl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -165,10 +165,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Add an executable to the build.
|
* Add an executable to the build.
|
||||||
*/
|
*/
|
||||||
void AddExecutable(const char *exename,
|
cmTarget* AddExecutable(const char *exename,
|
||||||
const std::vector<std::string> &srcs);
|
const std::vector<std::string> &srcs);
|
||||||
void AddExecutable(const char *exename,
|
|
||||||
const std::vector<std::string> &srcs, bool win32);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a utility to the build. A utiltity target is
|
* Add a utility to the build. A utiltity target is
|
||||||
|
@ -618,6 +616,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void GetListOfMacros(std::string& macros);
|
void GetListOfMacros(std::string& macros);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a location of a file in cmake or custom modules directory
|
||||||
|
*/
|
||||||
|
std::string GetModulesFile(const char* name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// add link libraries and directories to the target
|
// add link libraries and directories to the target
|
||||||
void AddGlobalLinkInformation(const char* name, cmTarget& target);
|
void AddGlobalLinkInformation(const char* name, cmTarget& target);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class cmSourceFile;
|
||||||
class cmTarget
|
class cmTarget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum TargetType { EXECUTABLE, WIN32_EXECUTABLE, STATIC_LIBRARY,
|
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
|
||||||
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, INSTALL_FILES,
|
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, INSTALL_FILES,
|
||||||
INSTALL_PROGRAMS };
|
INSTALL_PROGRAMS };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue