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 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers