[aur-general] Compiling with CMake
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
On 08/09/2022 20:59, Guilhem Saurel via aur-general wrote:
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
Why? Isn't it the job of the PKGBUILD maintainer to maintain the PKGBUILD so the software builds according to the upstream build instructions?
On 08/09/2022 20:59, Guilhem Saurel via aur-general wrote:
Or even better
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/usr cmake --build build Any opinions ? Should we put that on the wiki² ?
Sorry, I jumped too fast. -.- It does look like this is the default recommendation according to the template, https://wiki.archlinux.org/title/CMake_package_guidelines#Template
participants (2)
-
Guilhem Saurel
-
Jonathon Fernyhough