[cmake-developers] COMPILE_FEATURES, Mac and non-Apple clang versions

Ben Boeckel ben.boeckel at kitware.com
Wed Jan 4 10:12:51 EST 2017


On Wed, Jan 04, 2017 at 12:12:46 +1100, Craig Scott wrote:
> We have many projects which do exactly the scenario you mention above where
> a project can be built standalone or added to another project via
> add_subdirectory(). We have not found it necessary to test if a project is
> top level or not before calling cmake_minimum_required(). The behaviour is
> well-defined and performs as per the documentation in regard to policies
> and minimum CMake versions as far as we've observed. Can you point me/us at
> documentation or code which shows why this should be considered undefined
> behaviour? I'm particularly interested in this case since we use it
> frequently in production.

I agree; I've seen projects do multiple cmake_minimum_required() calls
and work as one would expect. However, the problem is, it seems to me,
with CMP0025 specifically because it changes the logic around the
identity detection of the compiler. The compiler is only identified
once, so once it is detected as being X, it will always be X, even if
CMP0025 changes in the future (via explicit setting, a change to the
version in the cmake_minimum_required() call, etc.) without resetting
the build tree.

--Ben


More information about the cmake-developers mailing list