[CMake] CMAKE 2.6.0: Wrong dependencies when CMake<LANG>Information.cmake is missing
Wojciech Migda
wojtek.golf at interia.pl
Sun Jun 8 11:33:06 EDT 2008
Hi,
I did have a problem with cmake regenerating the whole build tree
everytime I executed make. As it turned out the rebuild was done due to
the dependency check made in
cmGlobalUnixMakefileGenerator3::WriteMainCMakefile. It came out that the
CMAKE_MAKEFILE_DEPENDS list in Makefile.cmake contained the current
directory (".") entry, which appeared to be always more recent than the
newest output - CMakeFiles/cmake.check_cache. It was enough to remove
the "." entry to get rid of the rebuild. Anyway I kept investigating.
As it appeared the "." entry was present due to me using user-defined
assembler compiler for the build. Commenting out the relevant
ENABLE_LANGUAGE command in CMakeLists.txt led to proper behaviour. But
why ? I looked at the cmGlobalGenerator::EnableLanguage function and
after debugging I noticed that when a check for
CMake<LANG>Information.cmake was made, a file which was missing - I did
put all assembly compiler definitions into CMake<LANG>Compiler.cmake, a
call to GetModulesFile returned an empty string. ReadListFile executed
with that empty string did not fail, and that probably led to the "."
directory being present in the CMAKE_MAKEFILE_DEPENDS list.
I confirmed that by setting the CMAKE_<LANG>_INFORMATION_LOADED variable
before execution of ENABLE_LANGUAGE - the dependencies were correct.
Nonetheless I'd expect that a fix with additional check for ifpath being
empty is introduced in
cmGlobalGenerator.cxx/cmGlobalGenerator::EnableLanguage.
I've prepared a patch against the 2.6.0 version. Unfortunately I could
not find the patch format instructions for cmake, so I took those for
linux kernel (diff -up).
--- cmake-2.6.0/Source/cmGlobalGenerator.cxx.orig 2008-05-05
18:25:54.000000000 +0000
+++ cmake-2.6.0/Source/cmGlobalGenerator.cxx 2008-06-08
15:28:43.986483015 +0000
@@ -415,10 +415,10 @@ cmGlobalGenerator::EnableLanguage(std::v
fpath += lang;
fpath += "Information.cmake";
fpath = mf->GetModulesFile(fpath.c_str());
- if(!mf->ReadListFile(0,fpath.c_str()))
+ if(!mf->ReadListFile(0,fpath.c_str()) || fpath.empty())
{
cmSystemTools::Error("Could not find cmake module file:",
- fpath.c_str());
+ "CMake", lang, "Information.cmake");
}
}
if (needSetLanguageEnabledMaps[lang])
The latest HEAD version 1.233 appears to have the same problem.
With best regards,
Wojciech Migda
---------------------------------------------------------------
Sprawdz jak zdobyc zdrowy usmiech!
Kliknij >> http://link.interia.pl/f1e26
More information about the CMake
mailing list