[CMake] Custom target with CPack fails

Alexander Broekhuis a.broekhuis at gmail.com
Tue Feb 18 08:31:35 EST 2014


Hi all,

I've already replied to an older thread mentioning the same issue, but
still saw no reply.

I have a problem with CPack when using in combination with a custom top
level target.

In my setup I have custom command which uses CPack to create a zip file.
For me this zip file is a top level artefact (tight to a top level target).
This top level target used to be a library, but for several reason I now
want to use a custom target.
However, if I simply change my CMake file from add_library(name ..) to
add_custom_target(name ALL) the build fails. The output I get is:

CPack: Create package using ZIP
CPack: Install projects
CPack: - Run preinstall target for: org.apache.incubator.celix.helloworld
CPack Error: Problem running install command: /usr/bin/make "preinstall"
Please check
/Path/to/build/Celix/celix-build/examples/hello_world/_CPack_Packages/ZIP/PreinstallOutput.log
for errors
CPack Error: Error when generating package:
org.apache.incubator.celix.helloworld
make[2]: *** [org.apache.incubator.celix.helloworld] Error 1
make[1]: ***
[examples/hello_world/CMakeFiles/org.apache.incubator.celix.helloworld.dir/all]
Error 2
make: *** [all] Error 2

Strangely, if I make the custom target not a top level target, but instead
create another (root only) custom top level target, and add the cpack
target to it using a dependency, it works. While this works, this has the
problem that the top level target is only visible in the root of my
project, not in the respective sub directory (which I still would like to
have).

Is there something I am doing wrong? If not, why is there a difference
between add_library in combination with a custom command running CPack and
add_cuctom_library and the cpack command?

-- 
Met vriendelijke groet,

Alexander Broekhuis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140218/44198f7b/attachment.html>


More information about the CMake mailing list