On 09/16/2015 03:14 PM, Brad King wrote: > That eliminates my concern. This is now in 'master' as:
Project: Determine default language dialect for the compiler. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7235334a However, I just discovered that it breaks use of toolchain files that force a compiler and set the version: $ cat ~/toolchain.cmake include(CMakeForceCompiler) CMAKE_FORCE_C_COMPILER(/usr/bin/gcc GNU) set(CMAKE_C_COMPILER_VERSION 5.2) $ cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain.cmake ../CMake/Tests/COnly CMake Error at /.../share/cmake-3.3/Modules/Compiler/GNU-C.cmake:27 (message): CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for GNU (/usr/bin/gcc) version 5.2 Call Stack (most recent call first): /.../share/cmake-3.3/Modules/CMakeCInformation.cmake:33 (include) CMakeLists.txt:3 (project) This is because the language standard default is computed while determining the compiler id, but that is skipped when using a toolchain file that forces the compiler. I think we need to: * Tolerate the lack of CMAKE_<LANG>_STANDARD_COMPUTED_DEFAULT and fall back to our old lookup table. * Allow toolchain files to set CMAKE_<LANG>_STANDARD_DEFAULT themselves just as they can set CMAKE_<LANG>_COMPILER_{ID,VERSION} now. * Add a RunCMake test that uses incrementally more complex toolchain files like the above (ID only, ID+version, ID+version+standard). ----------------------------------------------------------------------- This may also reveal a larger problem in that compiler features functionality does not work well with toolchain files that force the compiler. Doing so skips the test for a working compiler, but that also skips ABI and Features detection: http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeTestCCompiler.cmake;hb=v3.3.2#l73 Asking toolchain files to set the ABI information was not too much, but the compiler feature detection produces a lot of information that toolchain files should not have to spell out. We may need to consider moving the ABI and Feature checks to somewhere that occurs even when forcing the compiler with a toolchain file. That is beyond the scope of the immediate need for a fix to the above error though. Thanks, -Brad -- 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