Query: %cmake not doing out-of-tree builds?

Kevin Kofler kevin.kofler at chello.at
Sun Oct 11 12:00:44 UTC 2015


Neal Gompa wrote:
> Over the last few weeks, I've been working on a number of packages that
> use CMake for the build system for various distros, and I've noticed
> something rather peculiar. Of all the distros I've built packages for
> (Fedora/CentOS, openSUSE, Mageia, Debian, and Ubuntu), only Fedora/CentOS
> does not automatically do CMake building in a subdirectory such that the
> build artifacts don't mix in with the source tree. Essentially, the %cmake
> macro doesn't enforce builds are out-of-tree.
> 
> Is there a particular reason for this?

Our %cmake macro does not pass the directory name at all. Instead, it is 
YOUR job to pass "%cmake ." or "%cmake ..". This is needed for flexibility, 
because some packages support only in-tree build and some only out-of-tree 
build. (IMHO, both sets of packages are broken, it is easy to support both 
with CMake. But it is easy to build the packages the way they want to be 
built.)

I don't believe in automagic macros that attempt to do everything for you, 
and then don't give you the flexibility to override things where needed. I 
prefer seeing in the specfile what is really going on. So I think %cmake is 
right the way it is now. (And anyway, we can't really change it now, it 
would require changing all specfiles in Fedora that use %cmake.)

And by the way, CMake does a lot more than just allowing out-of-tree builds, 
so that is not "the whole *point* of CMake". :-)

        Kevin Kofler



More information about the devel mailing list