diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7a9a6cd7a..a24c1eeb7 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -175,7 +175,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator() ->GetLanguageFromExtension(ext.c_str())); const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH"); - fprintf(fout, "cmake_policy(VERSION 2.6)\n"); + fprintf(fout, "cmake_policy(VERSION %u.%u)\n", + cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion()); if(def) { fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);