tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Always do out-of-tree builds with CMake?


The vast majority of projects I've seen in the wild which use CMake
state in their documentation to do something along the lines of:

    $ mkdir build
    $ cd build
    $ cmake ..

I.e., they recommend doing an out-of-tree build.

In many cases you can get away with not needing to make that extra
'build' directory -- does this by default. But sometimes, you
simply can't. Out-of-tree builds are *required* in several instances.

My point is: this out-of-tree behavior is NOT what implements.
So here's a proposal: change 'USE_CMAKE=yes' to *always* do out-of-tree

Here's how it'd look at a high level:

- USE_CMAKE=yes would imply creating a new build directory at configure
  time (default: "${WRKDIR}/build").
- CMAKE_ARG_PATH would default to ${WRKSRC} instead of '.'

Besides, it could be argued that this is what we *should* be doing
anyway, taking into consideration:

- it's how most upstream maintainers *want* you to do to build their
- Kitware's tutorials tell you do this [1]
- (I swear I've seen a document from Kitware that says out-of-tree
  builds are more than a mere suggestion -- but I might have dreamed

And I can't imagine this change *in principle* to negatively affect our
existing CMake-based packages. Like, some CMake-based packages require
out-of-tree builds but I don't think there's such thing as one which
requires an *in-tree* build, see what I mean?

But maybe getting rid of all of those 'pre-configure:'s that we've added
to accommodate out-of-tree builds in the first place -- that might cause
a lot of trouble. Maybe not.

What do we think?




Home | Main Index | Thread Index | Old Index