[CMake] cpack output path question

Eric Noulard eric.noulard at gmail.com
Mon Feb 19 10:13:10 EST 2007


2007/2/19, Duncan Mac-Vicar Prett <dmacvicar at suse.de>:
>
> Hi guys,
>
> We are trying to switch libzypp (solver) to cmake.
> Everything has been straighforward, except for one thing I can't find in the
> docs or the cmake book.
>
> In the CMAKE_SOURCE_DIR, I have a spec.in file I configure without problems to
> the CMAKE_BINARY_DIR/package directory
>
> But, I haven't found the way to generate the tarball via cpack into this
> CMAKE_BINARY_DIR/package directory instead of CMAKE_BINARY_DIR

I don't know how you would do that but you may move the file
after you invoke cpack by doing:

ADD_CUSTOM_TARGET(my_package_source
 COMMAND ${CMAKE_MAKE_PROGRAM} package_source
 COMMAND ${CMAKE_COMMAND} -E copy
${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz ${CMAKE_BINARY_DIR}/package
 COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz
)

this is not "nice" but it should work.


> Also I would need to copy a file from  CMAKE_SOURCE_DIR/package to
> CMAKE_BINARY_DIR/package

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/package/thefile
                             ${CMAKE_BINARY_DIR}/package/thefile
                             COPYONLY)


should work

> is there a way to do all this from a single make something target? How can I
> modify the package_source target to do this?

I don't know if you can "MODIFY" the target.

-- 
Erk


More information about the CMake mailing list