summaryrefslogtreecommitdiffstats
path: root/Source/cmAddExecutableCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-02-28 23:59:19 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-02-28 23:59:19 (GMT)
commitb1a74218401a6d990b570cae8141cad97fb8dc19 (patch)
tree3775e35ac3f08525ad6808e53f0faf027fe9f357 /Source/cmAddExecutableCommand.cxx
parent6ab87555ea483601cb1829f3b6e9d3d77d6746ff (diff)
downloadCMake-b1a74218401a6d990b570cae8141cad97fb8dc19.zip
CMake-b1a74218401a6d990b570cae8141cad97fb8dc19.tar.gz
CMake-b1a74218401a6d990b570cae8141cad97fb8dc19.tar.bz2
ENH: Styart working on bundles support and abstract WIN32_EXECUTABLE
Diffstat (limited to 'Source/cmAddExecutableCommand.cxx')
-rw-r--r--Source/cmAddExecutableCommand.cxx60
1 files changed, 53 insertions, 7 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 09aae18..71f3b57 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -30,16 +30,62 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
++s;
bool use_win32 = false;
-
- if (*s == "WIN32")
+ bool use_macbundle = false;
+ while ( s != args.end() )
{
- ++s;
- use_win32 = true;
+ if (*s == "WIN32")
+ {
+ ++s;
+ use_win32 = true;
+ }
+ else if ( *s == "MACBUNDLE" )
+ {
+ ++s;
+ use_macbundle = true;
+ }
+ else
+ {
+ break;
+ }
}
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;
}
-