Hi, Please find attached a patch that fixes Ninja generator.
Unlike Unix Makefiles generator it was possible to change compiler path without being notified, without the cache being deleted and more important the generated Ninja solution was not updated with the new compilers while the CMake cache was.
I also activated the tests for this feature when building/testing CMake using Ninja
Regards, Sylvain
>From e68aa37ebcb249293ffde51ba7999ef988770cd0 Mon Sep 17 00:00:00 2001 From: Sylvain Joubert <joubert...@gmail.com> Date: Sat, 20 Sep 2014 22:37:52 +0200 Subject: [PATCH] Prevent compilers to be silently modified when using Ninja generator Unlike with Unix Makefiles generator modifying compiler paths was not protected with Ninja generator It was possible to modify them in the cache without the expected effect on the generated solution Also activate corresponding tests with Ninja --- Source/cmGlobalNinjaGenerator.cxx | 9 +++++++++ Tests/RunCMake/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 09ee128..50e1abb 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -540,6 +540,15 @@ void cmGlobalNinjaGenerator cmSystemTools::Error("The Ninja generator does not support Fortran yet."); } this->cmGlobalGenerator::EnableLanguage(langs, makefile, optional); + for(std::vector<std::string>::const_iterator l = langs.begin(); + l != langs.end(); ++l) + { + if(*l == "NONE") + { + continue; + } + this->ResolveLanguageCompiler(*l, makefile, optional); + } } bool cmGlobalNinjaGenerator::UsingMinGW = false; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 549aed8..fd3bb03 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -50,7 +50,7 @@ add_RunCMake_test(CMP0051) add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CTest) -if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() add_RunCMake_test(CompilerNotFound) -- 2.1.0
-- 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