[aur-general] Compiling with CMake
Guilhem Saurel
guilhem at saurel.me
Thu Sep 8 19:59:45 UTC 2022
Hi,
In AUR, there are many packages with an old-school
> mkdir build && cd build
> cmake -DCMAKE_INSTALL_PREFIX=/usr ..
> make
Other packages say they require ninja and use
> mkdir build && cd build
> cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja ..
> ninja
But I think we should let the end user choose if they want make or ninja, by
letting them configure their CMAKE_GENERATOR environment variable¹
Currently if someone has CMAKE_GENERATOR=Ninja in their environment, many AUR
packages in the first category will fail, because eg.:
> […]
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/nim/.cache/paru/clone/octomap/src/octomap-1.9.8/octomap/build
> make: *** No targets specified and no makefile found. Stop.
And on the other hand for the second case, packages say they require ninja while
they would work as well with make.
Therefore I think we should ask CMake to compile, no matter which generator is
available on the machine and/or was chosen by the user, with:
> mkdir build && cd build
> cmake -DCMAKE_INSTALL_PREFIX=/usr ..
> cmake --build .
Or even better
> cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/usr
> cmake --build build
Any opinions ? Should we put that on the wiki² ?
Or write an RFC, like ³ ?
Cheers !
Guilhem,
aka. Nim65s
¹: https://cmake.org/cmake/help/latest/envvar/CMAKE_GENERATOR.html
²: https://wiki.archlinux.org/title/CMake_package_guidelines
³: https://gitlab.archlinux.org/archlinux/rfcs/-/merge_requests/10
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20220908/19ff3ac1/attachment.sig>
More information about the aur-general
mailing list