BUG: Generated try-compile CMakeLists.txt file should call cmake_policy with the current version of CMake, not just 2.6.

This commit is contained in:
Brad King 2008-03-07 08:53:22 -05:00
parent 680104a490
commit 1d23ea1a2d
1 changed files with 2 additions and 1 deletions

View File

@ -175,7 +175,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator() const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator()
->GetLanguageFromExtension(ext.c_str())); ->GetLanguageFromExtension(ext.c_str()));
const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH"); 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) if(def)
{ {
fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);