MantisBT - CMake
View Issue Details
0013784CMakeCMakepublic2012-12-10 21:042016-06-10 14:31
valentin 
Kitware Robot 
normalminorhave not tried
closedmoved 
AppleMac OSX
CMake 2.8.5 
 
0013784: [OSX] Copy directories as easily as files into the application bundle
First of all, I apologize for my English :)

I'm here to submit a feature request about the Copy File Phase into the application CFBundle.
Currently, Cmake doc tells us to handle this phase with the set_source_files_properties() command, instead of any other, like the install() command that Xcode didn't properly transcribe.
But if I go on this way, and use the default Makefile generator, copying directories juste create an empty file as use Xcode generator works fine.

Copying directory (with target or source properties) can be useful to copy a framework or an external resource.
 
I suggest just add something like the second line
  std::string copyCommand = "$(CMAKE_COMMAND) -E copy";
  copyCommand += cmSystemTools::FileIsDirectory(input) ? "_directory " : " ";
in the cmMakefileTargetGenerator::WriteMacOSXContentRules function

I understand this more a hack than a conceptual solution, but since the design of this "Copy phase" was initially developed for a file-by-file copy, this is the easier and harmless workaround I see.

The ideal solution would be to port the MACOSX_PACKAGE_LOCATION property on the set_target_properties() command

I apologize if this request was already made or wrote.
Copy a directory with set_property(SOURCE ${DIR} PROPERTY MACOSX_PACKAGE_LOCATION Resources)
and use the Makefile generator.
No tags attached.
Issue History
2012-12-10 21:04valentinNew Issue
2012-12-11 22:09valentinNote Added: 0031869
2012-12-11 22:10valentinNote Edited: 0031869bug_revision_view_page.php?bugnote_id=31869#r971
2013-10-27 10:57tim blechmannNote Added: 0034265
2015-01-11 00:02Davy DurhamNote Added: 0037661
2016-06-10 14:28Kitware RobotNote Added: 0042168
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0031869)
valentin   
2012-12-11 22:09   
(edited on: 2012-12-11 22:10)
Sorry,
void cmMakefileTargetGenerator::WriteMacOSXContentRules
became
void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() (cmSourceFile& source, const char* pkgloc)
in 2.8.10.2

and
  std::string copyCommand = "$(CMAKE_COMMAND) -E ";
  copyCommand += cmSystemTools::FileIsDirectory(input) ? "copy_directory " : "copy ";
would be a nicer workaround ;)

(0034265)
tim blechmann   
2013-10-27 10:57   
i'd love to see the same features:
* allow MACOSX_PACKAGE_LOCATION on targets (in order to install build products to an app bundle)
* allow directories as sources, which can then be copied to the bundle
(0037661)
Davy Durham   
2015-01-11 00:02   
I too wish that MACOSX_PACKAGE_LOCATION could be used for copying directories. I have some directories that need to be placed into Resources/. In the meantime I have a hack that uses a POST_BUILD rule to run 'cp -r'
(0042168)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.