[CMake] Copying another target's executable into OS X app bundle with CMake 3

Kevin Wojniak kainjow at kainjow.com
Fri Oct 31 16:11:21 EDT 2014


Hi, we have several projects setup where the main target has a dependency on a smaller target and the smaller target’s executable gets copied into the main target’s OS X app bundle. We’ve been doing this with a combination of getting the target’s LOCATION property and making that path a source of the main target and setting its MACOSX_PACKAGE_LOCATION property.

However with CMake 3’s policy change we’re trying to replace usage of this. Unfortunately it looks like we have to now use add_custom_command() and $<TARGET_FILE:…>. This works, but I’m wondering if there’s a better way to accomplish what I’m after? It’d be great if CMake had some command that takes generator expressions but places targets into a bundle. We don’t use the “install” targets as we need the bundles to be setup with the executables for debugging.

Also it’d be very hand to have a generator expression to get the target’s bundle folder. To do that now we have to use "$<TARGET_FILE_DIR:${TARGET}>/..” but it’d be nice and clean to have something like $<TARGET_BUNDLE:…>

Thanks,
Kevin



More information about the CMake mailing list