[CMake] CPack: avoid creating unnecessary man dirs

Alex Turbov i.zaufi at gmail.com
Sat Oct 29 15:04:33 EDT 2016


set `CPACK_INSTALL_PREFIX` to `/usr`... by default it set to
`CMAKE_INSTALL_PREFIX` which is `/usr/local` if you don't set it at `cmake`
run


On Sun, Oct 30, 2016 at 2:39 AM, Robert J. Hansen <rjh at sixdemonbag.org>
wrote:

> > Use `|CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` to add a man's dir
> > to 'exclude' list, so RPM package wouldn't have a dir, but files from
> > it... so it wouldn't conflict w/ `filesystem` package.
>
> Thank you; that solved one problem and exposed another.
>
> In my old Autotools build, I used preprocessor defines to set at
> compile-time where the binary should look for its data files.  In my
> top-level CMakeLists.txt I set a CMake variable as:
>
>         set(PKGDATADIR ${CMAKE_INSTALL_FULL_DATADIR}/nsrlsvr)
>
> And in src/CMakeLists.txt I set the preprocessor define:
>
>         add_definitions(-DPKGDATADIR="${PKGDATADIR}")
>
> When I build the RPM and install it, though, something weird happens:
>
>         [rjh at localhost nsrlsvr]$ /usr/bin/nsrlsvr --help
>         nsrlsvr options:
>           ... (output omitted) ...
>           -f [ --file ] arg (=/usr/local/share/nsrlsvr/hashes.txt)
>                                                 hash file
>
> The default argument for -f is not /usr/share/nsrlsvr/hashes.txt, as it
> should be for an RPM, but /usr/local/share/nsrlsvr/hashes.txt, as if it
> were a locally-compiled package.
>
> My first thought was that I should replace CMAKE_INSTALL_FULL_DATADIR
> with CMAKE_INSTALL_DATADIR, but that was also less than useful:
>
>         nsrlsvr options:
>           ... (output omitted) ...
>           -f [ --file ] arg (=share/nsrlsvr/hashes.txt)
>                                                 hash file
>
> How can I fix this?
>
> ("Have your code use a relative offset from where the binary is located"
> is an acceptable answer; I'm hoping there's a better one, though!)
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161030/87a0691c/attachment.html>


More information about the CMake mailing list