ENH: Add support for adding content to bundles
This commit is contained in:
parent
5d722df21f
commit
40272a16bd
|
@ -47,6 +47,8 @@ IF(NOT XCODE)
|
||||||
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name")
|
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name")
|
||||||
ENDIF(NOT XCODE)
|
ENDIF(NOT XCODE)
|
||||||
|
|
||||||
|
SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
|
||||||
|
|
||||||
SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
|
SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
|
||||||
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
|
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
|
||||||
SET(CMAKE_C_CREATE_SHARED_LIBRARY
|
SET(CMAKE_C_CREATE_SHARED_LIBRARY
|
||||||
|
|
|
@ -1542,15 +1542,54 @@ cmLocalUnixMakefileGenerator3
|
||||||
{
|
{
|
||||||
objectName = objectName.substr(0, dot_pos);
|
objectName = objectName.substr(0, dot_pos);
|
||||||
}
|
}
|
||||||
objectName +=
|
if ( source.GetPropertyAsBool("KEEP_EXTENSION") )
|
||||||
this->GlobalGenerator->GetLanguageOutputExtensionFromExtension(
|
{
|
||||||
source.GetSourceExtension().c_str());
|
if ( !source.GetSourceExtension().empty() )
|
||||||
|
{
|
||||||
|
objectName += "." + source.GetSourceExtension();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objectName +=
|
||||||
|
this->GlobalGenerator->GetLanguageOutputExtensionFromExtension(
|
||||||
|
source.GetSourceExtension().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// Convert to a safe name.
|
// Convert to a safe name.
|
||||||
objectName = this->CreateSafeUniqueObjectFileName(objectName.c_str());
|
objectName = this->CreateSafeUniqueObjectFileName(objectName.c_str());
|
||||||
|
|
||||||
// Prepend the target directory.
|
// Prepend the target directory.
|
||||||
std::string obj = this->GetTargetDirectory(target);
|
std::string obj;
|
||||||
|
const char* fileTargetDirectory = source.GetProperty("MACOSX_PACKAGE_LOCATION");
|
||||||
|
if ( fileTargetDirectory )
|
||||||
|
{
|
||||||
|
std::string targetName;
|
||||||
|
std::string targetNameReal;
|
||||||
|
target.GetExecutableNames(targetName, targetNameReal,
|
||||||
|
this->ConfigurationName.c_str());
|
||||||
|
if ( target.GetPropertyAsBool("MACOSX_BUNDLE") )
|
||||||
|
{
|
||||||
|
// Construct the full path version of the names.
|
||||||
|
obj = this->ExecutableOutputPath;
|
||||||
|
if(obj.empty())
|
||||||
|
{
|
||||||
|
obj = this->Makefile->GetStartOutputDirectory();
|
||||||
|
obj += "/";
|
||||||
|
}
|
||||||
|
obj += targetName + ".app/Contents/";
|
||||||
|
obj += fileTargetDirectory;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Framework not handled yet
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj = this->GetTargetDirectory(target);
|
||||||
|
}
|
||||||
obj += "/";
|
obj += "/";
|
||||||
obj += objectName;
|
obj += objectName;
|
||||||
if(nameWithoutTargetDir)
|
if(nameWithoutTargetDir)
|
||||||
|
@ -1763,6 +1802,11 @@ const char*
|
||||||
cmLocalUnixMakefileGenerator3
|
cmLocalUnixMakefileGenerator3
|
||||||
::GetSourceFileLanguage(const cmSourceFile& source)
|
::GetSourceFileLanguage(const cmSourceFile& source)
|
||||||
{
|
{
|
||||||
|
const char* lang = source.GetProperty("LANGUAGE");
|
||||||
|
if ( lang )
|
||||||
|
{
|
||||||
|
return lang;
|
||||||
|
}
|
||||||
// Identify the language of the source file.
|
// Identify the language of the source file.
|
||||||
return (this->GlobalGenerator
|
return (this->GlobalGenerator
|
||||||
->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
|
->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
|
||||||
|
|
|
@ -28,7 +28,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
|
||||||
{
|
{
|
||||||
// create the build.make file and directory, put in the common blocks
|
// create the build.make file and directory, put in the common blocks
|
||||||
this->CreateRuleFile();
|
this->CreateRuleFile();
|
||||||
|
|
||||||
// Add in any rules for custom commands
|
// Add in any rules for custom commands
|
||||||
this->WriteCustomCommandsForTarget();
|
this->WriteCustomCommandsForTarget();
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
// Add a dependency on the rule file itself.
|
// Add a dependency on the rule file itself.
|
||||||
this->LocalGenerator->AppendRuleDepend(depends,
|
this->LocalGenerator->AppendRuleDepend(depends,
|
||||||
this->BuildFileNameFull.c_str());
|
this->BuildFileNameFull.c_str());
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator obj =
|
for(std::vector<std::string>::const_iterator obj =
|
||||||
this->ExternalObjects.begin();
|
this->ExternalObjects.begin();
|
||||||
obj != this->ExternalObjects.end(); ++obj)
|
obj != this->ExternalObjects.end(); ++obj)
|
||||||
{
|
{
|
||||||
|
@ -111,13 +111,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
// Make bundle directories
|
// Make bundle directories
|
||||||
outpath += targetName;
|
outpath += targetName;
|
||||||
outpath += ".app/Contents/MacOS/";
|
outpath += ".app/Contents/MacOS/";
|
||||||
std::string f1 =
|
std::string f1 =
|
||||||
this->Makefile->GetModulesFile("MacOSXBundleInfo.plist.in");
|
this->Makefile->GetModulesFile("MacOSXBundleInfo.plist.in");
|
||||||
if ( f1.size() == 0 )
|
if ( f1.size() == 0 )
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("could not find Mac OSX bundle template file.");
|
cmSystemTools::Error("could not find Mac OSX bundle template file.");
|
||||||
}
|
}
|
||||||
std::string macdir =
|
std::string macdir =
|
||||||
this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
|
this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||||
if ( macdir.size() == 0 )
|
if ( macdir.size() == 0 )
|
||||||
{
|
{
|
||||||
|
@ -130,6 +130,25 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
macdir += targetName;
|
macdir += targetName;
|
||||||
macdir += ".app/Contents/";
|
macdir += ".app/Contents/";
|
||||||
|
|
||||||
|
std::vector<cmSourceFile*>::iterator sourceIt;
|
||||||
|
for ( sourceIt = this->Target->GetSourceFiles().begin();
|
||||||
|
sourceIt != this->Target->GetSourceFiles().end();
|
||||||
|
++ sourceIt )
|
||||||
|
{
|
||||||
|
const char* subDir = (*sourceIt)->GetProperty("MACOSX_PACKAGE_LOCATION");
|
||||||
|
if ( subDir )
|
||||||
|
{
|
||||||
|
std::string newDir = macdir;
|
||||||
|
newDir += subDir;
|
||||||
|
if ( !cmSystemTools::MakeDirectory(newDir.c_str()) )
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Cannot create a subdirectory for \"",
|
||||||
|
newDir.c_str(), "\".");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Configure the Info.plist file. Note that it needs the executable name
|
// Configure the Info.plist file. Note that it needs the executable name
|
||||||
// to be set.
|
// to be set.
|
||||||
std::string f2 = macdir + "Info.plist";
|
std::string f2 = macdir + "Info.plist";
|
||||||
|
@ -232,7 +251,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
cmLocalGenerator::START_OUTPUT,
|
cmLocalGenerator::START_OUTPUT,
|
||||||
cmLocalGenerator::UNCHANGED));
|
cmLocalGenerator::UNCHANGED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a command to remove any existing files for this executable.
|
// Add a command to remove any existing files for this executable.
|
||||||
std::vector<std::string> commands1;
|
std::vector<std::string> commands1;
|
||||||
|
@ -240,7 +259,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
*this->Target, "target");
|
*this->Target, "target");
|
||||||
this->LocalGenerator->CreateCDCommand(commands1,
|
this->LocalGenerator->CreateCDCommand(commands1,
|
||||||
this->Makefile->GetStartOutputDirectory(),
|
this->Makefile->GetStartOutputDirectory(),
|
||||||
this->Makefile->GetHomeOutputDirectory());
|
this->Makefile->GetHomeOutputDirectory());
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
commands1.clear();
|
commands1.clear();
|
||||||
|
|
||||||
|
@ -257,7 +276,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
std::string linkRuleVar = "CMAKE_";
|
std::string linkRuleVar = "CMAKE_";
|
||||||
linkRuleVar += linkLanguage;
|
linkRuleVar += linkLanguage;
|
||||||
linkRuleVar += "_LINK_EXECUTABLE";
|
linkRuleVar += "_LINK_EXECUTABLE";
|
||||||
std::string linkRule =
|
std::string linkRule =
|
||||||
this->Makefile->GetRequiredDefinition(linkRuleVar.c_str());
|
this->Makefile->GetRequiredDefinition(linkRuleVar.c_str());
|
||||||
cmSystemTools::ExpandListArgument(linkRule, commands1);
|
cmSystemTools::ExpandListArgument(linkRule, commands1);
|
||||||
this->LocalGenerator->CreateCDCommand
|
this->LocalGenerator->CreateCDCommand
|
||||||
|
@ -317,9 +336,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the build rule.
|
// Write the build rule.
|
||||||
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream,
|
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream,
|
||||||
0,
|
0,
|
||||||
targetFullPathReal.c_str(),
|
targetFullPathReal.c_str(),
|
||||||
depends, commands, false);
|
depends, commands, false);
|
||||||
|
|
||||||
// The symlink name for the target should depend on the real target
|
// The symlink name for the target should depend on the real target
|
||||||
|
@ -331,7 +350,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
commands.clear();
|
commands.clear();
|
||||||
depends.push_back(targetFullPathReal.c_str());
|
depends.push_back(targetFullPathReal.c_str());
|
||||||
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
|
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
|
||||||
targetFullPath.c_str(),
|
targetFullPath.c_str(),
|
||||||
depends, commands, false);
|
depends, commands, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,11 +360,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
dir += this->LocalGenerator->GetTargetDirectory(*this->Target);
|
dir += this->LocalGenerator->GetTargetDirectory(*this->Target);
|
||||||
std::string buildTargetRuleName = dir;
|
std::string buildTargetRuleName = dir;
|
||||||
buildTargetRuleName += relink?"/preinstall":"/build";
|
buildTargetRuleName += relink?"/preinstall":"/build";
|
||||||
buildTargetRuleName =
|
buildTargetRuleName =
|
||||||
this->Convert(buildTargetRuleName.c_str(),
|
this->Convert(buildTargetRuleName.c_str(),
|
||||||
cmLocalGenerator::HOME_OUTPUT,
|
cmLocalGenerator::HOME_OUTPUT,
|
||||||
cmLocalGenerator::MAKEFILE);
|
cmLocalGenerator::MAKEFILE);
|
||||||
this->LocalGenerator->WriteConvenienceRule(*this->BuildFileStream,
|
this->LocalGenerator->WriteConvenienceRule(*this->BuildFileStream,
|
||||||
targetFullPath.c_str(),
|
targetFullPath.c_str(),
|
||||||
buildTargetRuleName.c_str());
|
buildTargetRuleName.c_str());
|
||||||
|
|
||||||
|
|
|
@ -237,8 +237,6 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
|
void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
|
||||||
{
|
{
|
||||||
|
@ -282,6 +280,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
|
||||||
(this->LocalGenerator->ConvertToFullPath(dir).c_str());
|
(this->LocalGenerator->ConvertToFullPath(dir).c_str());
|
||||||
|
|
||||||
// Save this in the target's list of object files.
|
// Save this in the target's list of object files.
|
||||||
|
if ( source.GetPropertyAsBool("EXTRA_CONTENT") )
|
||||||
|
{
|
||||||
|
this->ExtraContent.insert(obj);
|
||||||
|
}
|
||||||
this->Objects.push_back(obj);
|
this->Objects.push_back(obj);
|
||||||
std::string relativeObj = this->LocalGenerator->GetHomeRelativeOutputPath();
|
std::string relativeObj = this->LocalGenerator->GetHomeRelativeOutputPath();
|
||||||
relativeObj += obj;
|
relativeObj += obj;
|
||||||
|
@ -587,6 +589,7 @@ void cmMakefileTargetGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefileTargetGenerator::WriteCustomCommands()
|
void cmMakefileTargetGenerator::WriteCustomCommands()
|
||||||
{
|
{
|
||||||
// add custom commands to the clean rules?
|
// add custom commands to the clean rules?
|
||||||
|
@ -667,6 +670,10 @@ cmMakefileTargetGenerator
|
||||||
for(std::vector<std::string>::const_iterator i = this->Objects.begin();
|
for(std::vector<std::string>::const_iterator i = this->Objects.begin();
|
||||||
i != this->Objects.end(); ++i)
|
i != this->Objects.end(); ++i)
|
||||||
{
|
{
|
||||||
|
if ( this->ExtraContent.find(i->c_str()) != this->ExtraContent.end() )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
*this->BuildFileStream << " " << lineContinue << "\n";
|
*this->BuildFileStream << " " << lineContinue << "\n";
|
||||||
if(objName)
|
if(objName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ class cmSourceFile;
|
||||||
* \brief Support Routines for writing makefiles
|
* \brief Support Routines for writing makefiles
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class cmMakefileTargetGenerator
|
class cmMakefileTargetGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor to set the ivars
|
// constructor to set the ivars
|
||||||
|
@ -49,12 +49,12 @@ public:
|
||||||
/* the main entry point for this class. Writes the Makefiles associated
|
/* the main entry point for this class. Writes the Makefiles associated
|
||||||
with this target */
|
with this target */
|
||||||
virtual void WriteRuleFiles() = 0;
|
virtual void WriteRuleFiles() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// create the file and directory etc
|
// create the file and directory etc
|
||||||
void CreateRuleFile();
|
void CreateRuleFile();
|
||||||
|
|
||||||
// outputs the rules for any custom commands used by this target
|
// outputs the rules for any custom commands used by this target
|
||||||
void WriteCustomCommandsForTarget();
|
void WriteCustomCommandsForTarget();
|
||||||
|
|
||||||
|
@ -75,38 +75,38 @@ protected:
|
||||||
|
|
||||||
// write the build rule for an object
|
// write the build rule for an object
|
||||||
void WriteObjectBuildFile(std::string &obj,
|
void WriteObjectBuildFile(std::string &obj,
|
||||||
const char *lang,
|
const char *lang,
|
||||||
cmSourceFile& source,
|
cmSourceFile& source,
|
||||||
std::vector<std::string>& depends);
|
std::vector<std::string>& depends);
|
||||||
|
|
||||||
// write the depend.make file for an object
|
// write the depend.make file for an object
|
||||||
void WriteObjectDependRules(cmSourceFile& source,
|
void WriteObjectDependRules(cmSourceFile& source,
|
||||||
std::vector<std::string>& depends);
|
std::vector<std::string>& depends);
|
||||||
|
|
||||||
// this is responsible for writing all of the rules for all this
|
// this is responsible for writing all of the rules for all this
|
||||||
// directories custom commands (but not utility targets)
|
// directories custom commands (but not utility targets)
|
||||||
void WriteCustomCommands();
|
void WriteCustomCommands();
|
||||||
void GenerateCustomRuleFile(const cmCustomCommand& cc);
|
void GenerateCustomRuleFile(const cmCustomCommand& cc);
|
||||||
|
|
||||||
// write out the variable that lists the objects for this target
|
// write out the variable that lists the objects for this target
|
||||||
void WriteObjectsVariable(std::string& variableName,
|
void WriteObjectsVariable(std::string& variableName,
|
||||||
std::string& variableNameExternal);
|
std::string& variableNameExternal);
|
||||||
|
|
||||||
// Return the a string with -F flags on apple
|
// Return the a string with -F flags on apple
|
||||||
std::string GetFrameworkFlags();
|
std::string GetFrameworkFlags();
|
||||||
|
|
||||||
// append intertarget dependencies
|
// append intertarget dependencies
|
||||||
void AppendTargetDepends(std::vector<std::string>& depends);
|
void AppendTargetDepends(std::vector<std::string>& depends);
|
||||||
|
|
||||||
virtual void CloseFileStreams();
|
virtual void CloseFileStreams();
|
||||||
void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,
|
void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,
|
||||||
std::string& linkFlags);
|
std::string& linkFlags);
|
||||||
cmStdString TargetName;
|
cmStdString TargetName;
|
||||||
cmTarget *Target;
|
cmTarget *Target;
|
||||||
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
||||||
cmGlobalGenerator *GlobalGenerator;
|
cmGlobalGenerator *GlobalGenerator;
|
||||||
cmMakefile *Makefile;
|
cmMakefile *Makefile;
|
||||||
|
|
||||||
// the full path to the build file
|
// the full path to the build file
|
||||||
std::string BuildFileName;
|
std::string BuildFileName;
|
||||||
std::string BuildFileNameFull;
|
std::string BuildFileNameFull;
|
||||||
|
@ -132,19 +132,20 @@ protected:
|
||||||
// objects used by this target
|
// objects used by this target
|
||||||
std::vector<std::string> Objects;
|
std::vector<std::string> Objects;
|
||||||
std::vector<std::string> ExternalObjects;
|
std::vector<std::string> ExternalObjects;
|
||||||
|
std::set<std::string> ExtraContent;
|
||||||
|
|
||||||
// Set of object file names that will be built in this directory.
|
// Set of object file names that will be built in this directory.
|
||||||
std::set<cmStdString> ObjectFiles;
|
std::set<cmStdString> ObjectFiles;
|
||||||
|
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
// Convenience routines that do nothing more than forward to
|
// Convenience routines that do nothing more than forward to
|
||||||
// implementaitons
|
// implementaitons
|
||||||
std::string Convert(const char* source,
|
std::string Convert(const char* source,
|
||||||
cmLocalGenerator::RelativeRoot relative,
|
cmLocalGenerator::RelativeRoot relative,
|
||||||
cmLocalGenerator::OutputFormat output =
|
cmLocalGenerator::OutputFormat output =
|
||||||
cmLocalGenerator::UNCHANGED,
|
cmLocalGenerator::UNCHANGED,
|
||||||
bool optional = false)
|
bool optional = false)
|
||||||
{
|
{
|
||||||
return this->LocalGenerator->Convert(source, relative, output, optional);
|
return this->LocalGenerator->Convert(source, relative, output, optional);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
||||||
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
||||||
|
|
||||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
PURPOSE. See the above copyright notices for more information.
|
PURPOSE. See the above copyright notices for more information.
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
|
@ -63,7 +63,8 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(
|
||||||
++j;
|
++j;
|
||||||
if(j == args.end())
|
if(j == args.end())
|
||||||
{
|
{
|
||||||
this->SetError("called with incorrect number of arguments COMPILE_FLAGS with no flags");
|
this->SetError("called with incorrect number of arguments "
|
||||||
|
"COMPILE_FLAGS with no flags");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
propertyPairs.push_back(*j);
|
propertyPairs.push_back(*j);
|
||||||
|
@ -85,6 +86,7 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(
|
||||||
{
|
{
|
||||||
// now loop through the rest of the arguments, new style
|
// now loop through the rest of the arguments, new style
|
||||||
++j;
|
++j;
|
||||||
|
bool dontPush = false;
|
||||||
while (j != args.end())
|
while (j != args.end())
|
||||||
{
|
{
|
||||||
propertyPairs.push_back(*j);
|
propertyPairs.push_back(*j);
|
||||||
|
@ -96,6 +98,25 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(
|
||||||
generated = true;
|
generated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(*j == "MACOSX_PACKAGE_LOCATION")
|
||||||
|
{
|
||||||
|
doingFiles = false;
|
||||||
|
++j;
|
||||||
|
if(j == args.end())
|
||||||
|
{
|
||||||
|
this->SetError("called with incorrect number of arguments "
|
||||||
|
"MACOSX_PACKAGE_LOCATION with no flags");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
propertyPairs.push_back(*j);
|
||||||
|
propertyPairs.push_back("EXTRA_CONTENT");
|
||||||
|
propertyPairs.push_back("1");
|
||||||
|
propertyPairs.push_back("KEEP_EXTENSION");
|
||||||
|
propertyPairs.push_back("1");
|
||||||
|
propertyPairs.push_back("LANGUAGE");
|
||||||
|
propertyPairs.push_back("MacOSX_Content");
|
||||||
|
dontPush = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++j;
|
++j;
|
||||||
|
@ -105,8 +126,12 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(
|
||||||
this->SetError("called with incorrect number of arguments.");
|
this->SetError("called with incorrect number of arguments.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
propertyPairs.push_back(*j);
|
if ( !dontPush )
|
||||||
|
{
|
||||||
|
propertyPairs.push_back(*j);
|
||||||
|
}
|
||||||
++j;
|
++j;
|
||||||
|
dontPush = false;
|
||||||
}
|
}
|
||||||
// break out of the loop because j is already == end
|
// break out of the loop because j is already == end
|
||||||
break;
|
break;
|
||||||
|
@ -117,16 +142,17 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->SetError("called with illegal arguments, maybe missing a PROPERTIES specifier?");
|
this->SetError("called with illegal arguments, maybe missing a "
|
||||||
|
"PROPERTIES specifier?");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now loop over all the files
|
// now loop over all the files
|
||||||
int i;
|
int i;
|
||||||
unsigned int k;
|
unsigned int k;
|
||||||
for(i = 0; i < numFiles; ++i)
|
for(i = 0; i < numFiles; ++i)
|
||||||
{
|
{
|
||||||
// get the source file
|
// get the source file
|
||||||
cmSourceFile* sf =
|
cmSourceFile* sf =
|
||||||
this->Makefile->GetOrCreateSource(args[i].c_str(), generated);
|
this->Makefile->GetOrCreateSource(args[i].c_str(), generated);
|
||||||
|
|
|
@ -1,9 +1,36 @@
|
||||||
PROJECT(BundleTest)
|
PROJECT(BundleTest)
|
||||||
SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
|
SET(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
|
||||||
|
SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
|
||||||
|
|
||||||
|
ADD_CUSTOM_COMMAND(
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
|
||||||
|
COMMAND /bin/cp
|
||||||
|
ARGS "${CMAKE_CURRENT_SOURCE_DIR}/randomResourceFile.plist.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist")
|
||||||
|
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
|
||||||
|
PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION Resources
|
||||||
|
)
|
||||||
|
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(
|
||||||
|
SomeRandomFile.txt
|
||||||
|
PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION MacOS
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
|
||||||
|
|
||||||
# Test building a bundle linking to a shared library.
|
# Test building a bundle linking to a shared library.
|
||||||
ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
|
ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
|
||||||
ADD_EXECUTABLE(BundleTest MACOSX_BUNDLE BundleTest.cxx)
|
ADD_EXECUTABLE(BundleTest
|
||||||
|
MACOSX_BUNDLE
|
||||||
|
BundleTest.cxx
|
||||||
|
SomeRandomFile.txt
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
|
||||||
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
|
TARGET_LINK_LIBRARIES(BundleTest BundleTestLib)
|
||||||
|
|
||||||
# Test bundle installation.
|
# Test bundle installation.
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?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>Package</key>
|
||||||
|
<string>CMake</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
Loading…
Reference in New Issue