[CMake] Cpack not packaging anything

Eric Noulard eric.noulard at gmail.com
Mon Nov 26 13:43:42 EST 2012


2012/11/26 Thomas Nilsson <thomas.nilsson at responsive.se>:
>
> Eric Noulard skrev 2012-11-26 17:22:
>
>> 2012/11/26 Thomas Nilsson <thomas.nilsson at responsive.se>:
>>>
>>> Found this: http://www.cmake.org/pipermail/cmake/2008-July/022958.html
>>>
>>> CPack can't handle absolute install paths (like /usr/local/include)
>>> unless
>>> CPACK_SET_DESTDIR is set, then it installs in the specified location and
>>> picks the files from there. Normal behaviour is to install in a temporary
>>> location by modifying the CMAKE_INSTALL_PREFIX and fetching them from
>>> there.
>>
>> This is not entirely true, CPack RPM and DEB may automatically handle
>> absolute install path.
>
>
> I didn't make myself clear. My exploration only refers to TGZ-packaging, so
> far. Sorry.

OK, no problem.

> But my real problem is then that I can't get CPack to work without
> CPACK_SET_DESTDIR.
>
> My (inherited) CMakeList.txt:s does specify
>
>     set(CMAKE_INSTALL_PREFIX /usr/local)
>
> but also things like
>
>     install(... DESTINATION ${BIN_INSTALL_DIR} ...)
>     set(BIN_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/bin)
>     set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
>
> I am starting to suspect that the expansion of this binds all install
> targets to the absolute path in CMAKE_INSTALL_PREFIX. And that it instead
> should be something like
>
>     install(... DESTINATION ${BIN_INSTALL_DIR} ...)
>     set(BIN_INSTALL_DIR bin)

Precisely!!
But I doubt the order of definition of your vars is the good one:

set(BIN_INSTALL_DIR bin)
install(... DESTINATION ${BIN_INSTALL_DIR} ...)

should be the good one.


The baseline is
"Do not use absolute prefix to install(...  DESTINATION ...)
 unless you really want to put something in absolute place"

 (like  /etc/what/ever.conf)


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list