[CMake] how to make OpenGTL rpm?

Eric Noulard eric.noulard at gmail.com
Wed Jul 16 03:55:53 EDT 2008


2008/7/15 Matthew Woehlke <mw_triad at users.sourceforge.net>:
>>> I'm trying to build an rpm of OpenGTL, with no success. I added
>>> 'set(CPACK_GENERATOR "TGZ;RPM")' and 'include(CPack)' to the
>>> CMakeLists.txt,

Can you confirm you are using CMake 2.6.0 ?
Then how do you invoke CPack?

cpack -G RPM?
make package?

>>> but when I try to build the RPM, it wants to write to /usr (ah, shouldn't
>>> rpm building NOT need to install first?!), and if I run it as root, it
>>> installs but yields an empty rpm.

CPack RPM shouldn't try to write to /usr unless there is
some abolsute installed path _and_ you are not setting

SET(CPACK_SET_DESTDIR "ON")

 **** Before include(CPack) ****

>
> ...no change that I can see. Ah, should I be setting CMAKE_INSTALL_PREFIX to
> anything special?

No any install prefix should work, however

The root CMakeLists.txt of
http://www.opengtl.org/download/OpenGTL-0.9.4.tar.bz2
reads:

set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/)
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/)
set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin/)
set(SHARE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/OpenGTL/)

then in CMakeLists.txt in subdirectories one reads (for example)

install( TARGETS ctli DESTINATION ${BIN_INSTALL_DIR} )

thus here you use "ABSOLUTE PATH" in install command.
you should

set(BIN_INSTALL_DIR "bin")
and then
install( TARGETS ctli DESTINATION ${BIN_INSTALL_DIR})

is a relative (to CMAKE_INSTALL_PREFIX) install command.

Now could you try 2 things:

1)  Check that you inserted
     SET(CPACK_SET_DESTDIR "ON")
     **** Before include(CPack) **** in the main CMakeLists.txt and retry

    If it fails would you try to go to your build directory and run:
    cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM

2) Change your absolute path to relative ones
     and retry.


As a last question, you tell us RPM is not working but
is TGZ ok ?
I think TGZ should suffer of the same trouble.

-- 
Erk


More information about the CMake mailing list