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

Stephen Kelly steveire at gmail.com
Tue Jan 3 19:43:51 EST 2017


René J.V. Bertin wrote:

> The
> issue was a project that requested an earlier CMake version
> (2.8.something) further down. 

There should be no 'further down'. There should be exactly one use of 
cmake_minimum_required per buildsystem. If you are hitting this issue 
because you are cloning random repos and using add_subdirectory, you're 
essentially getting undefined behavior, unless the target repo is designed 
to let you do that. 

That is - some buildsystems check whether they are top-level and only then 
invoke cmake_minimum_required. Something like:

 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   # Building standalone
   cmake_minimum_required(VERSION 3.3)
   project(Dependency)
 endif()

 add_executable(etc)



if you use add_subdirectory with top-level projects which don't explicitly 
do something like that, you're getting undefined , and generally unexpected 
behavior in many ways.

Thanks,

Steve.




More information about the cmake-developers mailing list