[CMake] cpack help

David Blado dblado at decarta.com
Tue Nov 14 14:19:25 EST 2006


David,

Thanks a bunch for the good info!

Let me explain how I've built my hierarchy and what is I'm trying to
package.

My directory / build structure looks like this:

Root/
	CMakeLists (includes subdirs below (ADD_SUBDIRECTORY))
	srcDirLib1/
	srcDirLib2/
	srcDirLib3/
	Dir/
		srcDirLib1/
		srcDirLib2/
	srcDirLib4/

My goal is to package all the libs up as one product.  If I understand
your description, if my srcDirLib directories have the 'install' rule,
the install can't be any higher up than parallel to it's CMakeLists??

To package the way I want, I think I need Root/installDir to be the
installDir.  I guess I might be able to get around this by moving my
INSTALL() rules up to the top level Root/CMakeLists.

Does this make sense to you?

Cheers,
David


-----Original Message-----
From: David Cole [mailto:david.cole at kitware.com] 
Sent: Monday, November 13, 2006 6:25 PM
To: David Blado
Cc: cmake at cmake.org
Subject: Re: RE: Re: [CMake] cpack help

Actually, I'm not sure what the rule is/should be for absolute paths
with respect to CPack's packaging.

Directory names that do *not* start with an absolute path indicator
(like "/" or "C:/") are your best bet for CMake install rules. Then
they will go underneath CMAKE_INSTALL_PREFIX for the "make install"
target. (Or env var DESTDIR if set prior to a "make install".)

CPack tries to install into a subdir of the binary tree so that it can
take a snapshot of that install and use it as the source of its output
(which should be a package that an end user can install anywhere he
likes...) That last statement is the real reason not to use absolute
paths in an install rule. End users should control where things are
installed unless there's a hard requirement about where a "system"
file should go...

The bottom line is this, though: by default CPack merely uses the
"make install" root directory as its input. So, for a file to be
packaged by CPack, you have to keep all the files you want installed
underneath the "make install" root or really dig in to CPack's scripts
and source code to figure out how to override the default behavior
intelligently...

Hope this helps,
David


On 11/13/06, David Blado <dblado at decarta.com> wrote:
>
>
>
>
> Hi Dave,
>
>
>
> I tracked this down as a potential issue w/ the way that cpack reads
the
> INSTALL feature of cmake.  If I do INSTALL into a higher directory
than
> CMAKE_CURRENT_SOURCE_DIR, then cpack does not package anything.  If my
> DESTINATION is in CMAKE_CURRENT_SOURCE_DIR, then the tar package is
created.
>
>
>
> Example:
>
>
>
> INSTALL(TARGETS ${LIB_NAME}
>
>   RUNTIME DESTINATION bin CONFIGURATIONS release
>
>   LIBRARY DESTINATION lib CONFIGURATIONS release
>
>   ARCHIVE DESTINATION lib CONFIGURATIONS release
>
> )
>
>
>
> Packages correctly
>
>
>
> INSTALL(TARGETS ${LIB_NAME}
>
>   RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../bin
> CONFIGURATIONS release
>
>   LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
> CONFIGURATIONS release
>
>   ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
> CONFIGURATIONS release
>
> )
>
>
>
>
>
> Does not package anything.
>
>
>
> INSTALL(TARGETS ${LIB_NAME}
>
>   RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin CONFIGURATIONS
release
>
>   LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib CONFIGURATIONS
release
>
>   ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib CONFIGURATIONS
release
>
> )
>
>
>
> Also does not package anything.
>
>
>
> I couldn't find anything in the docs that state that using an absolute
path
> will break CPack.
>
>
>
> Any ideas?
>
>
>
> Cheers,
>  David
>
>
>
>
>
>
>
>
> -----Original Message-----
>  From: David Cole [mailto:david.cole at kitware.com]
>  Sent: Friday, November 10, 2006 3:16 AM
>  To: David Blado
>  Subject: Re: Re: [CMake] cpack help
>
>
>
> Sorry for the false response... At least I didn't copy the list.
>
>
>
> I just re-read your new email and see that you *do* have INSTALL
commands.
>
>
>
> Hmmm...... Sounds like something else must be wrong.
>
>
>
> Any other clues? Is there a copy of your "make install" tree
>
> underneath the _CPack_* directory in your binary tree...? Does it look
>
> right?
>
>
>
>
>
> Dave
>
>
>
>
>
> On 11/10/06, David Cole <david.cole at kitware.com> wrote:
>
> > Like Andy hinted at in his response to your Dart mailing list
>
> > question, it's empty because you have no INSTALL commands in your
>
> > CMakeLists.txt file. Do you expect something to be installed without
>
> > any INSTALL commands?
>
> >
>
> > CPack packages up into an "end user runnable install package" the
>
> > results of a "make install" command for your project. If your
>
> > project's "make install" command results in an empty tree, then
CPack
>
> > is correctly creating an empty .tar.gz in this case...
>
> >
>
> > HTH,
>
> > David Cole
>
> >
>
> > On 11/10/06, David Blado <dblado at decarta.com> wrote:
>
> > >
>
> > >
>
> > >
>
> > >
>
> > > Hi All,
>
> > >
>
> > >
>
> > >
>
> > > I was hoping that someone here could help me out w/ cpack.  I've
copied
>
> > > sample CMakeLists cpack section with no success.  Every time I
issue
> make
>
> > > package the package comes out empty.
>
> > >
>
> > >
>
> > >
>
> > > I do have some INSTALL commands defined and they work perfectly
fine
> when I
>
> > > do 'make install'
>
> > >
>
> > >
>
> > >
>
> > > I see the following:
>
> > >
>
> > >
>
> > >
>
> > > Run CPack packaging tool...
>
> > >
>
> > > CPack: Create package using TGZ
>
> > >
>
> > > CPack: Install projects
>
> > >
>
> > > CPack: - Run preinstall target for: test
>
> > >
>
> > > CPack: - Install project: test
>
> > >
>
> > > CPack: Compress package
>
> > >
>
> > > CPack: Finalize package
>
> > >
>
> > > CPack: Package
>
> > >
> /home/dblado/dds4.1.3/Common2/TMClib/src/test-0.1.1-Linux.tar.gz
>
> > > generated.
>
> > >
>
> > >
>
> > >
>
> > > But if I do tar ztvf on the file, it's empty.
>
> > >
>
> > >
>
> > >
>
> > > Anyone have any hints or tips?  I've tried w/ a basic
'INCLUDE(CPack)'
> as
>
> > > well as specifying the options @
>
> > > http://www.cmake.org/Wiki/CMake:Packaging_With_CPack
>
> > >
>
> > >
>
> > >
>
> > > Any help would be greatly appreciated.
>
> > >
>
> > >
>
> > >
>
> > > Cheers,
>
> > >  David
>
> > >
>
> > >
>
> > > _______________________________________________
>
> > > CMake mailing list
>
> > > CMake at cmake.org
>
> > > http://www.cmake.org/mailman/listinfo/cmake
>
> > >
>
> > >
>
> >



More information about the CMake mailing list