[CMake] Howto install executables that aren't targets
Eric Noulard
eric.noulard at gmail.com
Wed Mar 9 11:24:07 EST 2016
2016-03-09 16:58 GMT+01:00 Winfried <winkus4u at arcor.de>:
> Hi Caleb,
>
> yes, I also suppose that it's some kind of permission issue, but I don't
> know how to handle it:
>
> All other install commands work exept those that should also copy to
> /usr/bin.
> I also tried to install those with another order, here is that code form
> subdirectory 'tools':
> install( FILES nqc
> nbc
> tuxm_aar-04_make.sh
> tuxm_asuro_make.sh
> tuxm_nxt_make.sh
> tuxm_nxtsim_make.sh
> tuxm_rcx_make.sh
> RUNTIME DESTINATION /usr/bin)
>
The problem here is that you ask to install the files/programs to an
absolute path
i.e. "/usr/bin".
Not all CPack generator can transparently handle absolute install path.
Usually one uses relative install path like "bin" package it and then
when you unpack (the RPM, the zip, the STGZ etc...) you chose the
installation prefix.
In your case CPack is trying to install to /usr/bin where you may not have
the right to write.
For more information on CPack and absolute destination handling see:
- CPACK_ABSOLUTE_DESTINATION_FILES
<https://cmake.org/cmake/help/v3.0/variable/CPACK_ABSOLUTE_DESTINATION_FILES.html>
- CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
<https://cmake.org/cmake/help/v3.0/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.html>
- CPACK_PACKAGING_INSTALL_PREFIX
<https://cmake.org/cmake/help/v3.0/variable/CPACK_PACKAGING_INSTALL_PREFIX.html>
- CPACK_SET_DESTDIR
<https://cmake.org/cmake/help/v3.0/variable/CPACK_SET_DESTDIR.html>
- CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
<https://cmake.org/cmake/help/v3.0/variable/CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.html>
>
> 'cmake ..' runs normal without an error, but when I call CPack by executing
> 'make package' the error always appears when it tries to pack the first of
> the above files. Here's the complete error message of the CPack part
> (before
> it is only i18n stuff output):
> Run CPack packaging tool...
> /usr/bin/cpack --config ./CPackConfig.cmake
> CPack: Create package using STGZ
> CPack: Install projects
> CPack: - Run preinstall target for: TuxMinds
> CPack: - Install project: TuxMinds
> CMake Error at
> /opt/build/tuxminds_3.96_20141203_cmake/build/tools/cmake_install.cmake:44
> (file):
> file INSTALL cannot copy file
>
> "/opt/build/tuxminds_3.96_20141203_cmake/tools/nqc" to "/usr/bin/nqc".
> Call Stack (most recent call first):
> /opt/build/tuxminds_3.96_20141203_cmake/build/cmake_install.cmake:41
> (include)
>
> CPack Error: Error when generating package: TuxMinds
> make: *** [package] Fehler 1
>
> When I exclude subdirectory 'tools' the package is successfully built by
> 'make package'.
>
> Here's the output of 'ls -la' for that directory:
> insgesamt 3512
> drwxr-xr-x 1 me users 300 9. Mär 16:26 .
> drwxr-xr-x 1 me users 1924 9. Mär 16:26 ..
> -rw-r--r-- 1 me users 389 9. Mär 16:26 CMakeLists.txt
> -rw-r--r-- 1 me users 419 9. Mär 16:26 CMakeLists.txt~
> drwxr-xr-x 1 me users 42 18. Dez 2013 .deps
> -rw-r--r-- 1 me users 105 29. Mär 2014 Makefile.am
> -rw-r--r-- 1 me users 13732 3. Dez 2014 Makefile.in
> -rwxr-xr-x 1 me users 3123348 15. Mär 2011 nbc
> -rwxr-xr-x 1 me users 420440 15. Jan 2012 nqc
> -rwxr-xr-x 1 me users 968 17. Nov 2014 tuxm_aar-04_make.sh
> -rwxr-xr-x 1 me users 1249 4. Dez 2013 tuxm_asuro_make.sh
> -rwxr-xr-x 1 me users 1544 4. Dez 2013 tuxm_nxt_make.sh
> -rwxr-xr-x 1 me users 834 5. Dez 2013 tuxm_nxtsim_make.sh
> -rwxr-xr-x 1 me users 1056 4. Dez 2013 tuxm_rcx_make.sh
>
> nothing unusual as I think.
>
> If you need some more information, please let me know...
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/Howto-install-executables-that-aren-t-targets-tp7592951p7592955.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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
>
--
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160309/e66ea104/attachment.html>
More information about the CMake
mailing list