MCPcopy Create free account
hub / github.com/Kitware/CMake / ClearDependencies

Method ClearDependencies

Source/cmLocalUnixMakefileGenerator3.cxx:1890–1945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1888}
1889
1890void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
1891 bool verbose)
1892{
1893 // Get the list of target files to check
1894 cmValue infoDef = mf->GetDefinition("CMAKE_DEPEND_INFO_FILES");
1895 if (!infoDef) {
1896 return;
1897 }
1898 cmList files{ *infoDef };
1899
1900 // Each depend information file corresponds to a target. Clear the
1901 // dependencies for that target.
1902 cmDepends clearer;
1903 clearer.SetVerbose(verbose);
1904 for (std::string const& file : files) {
1905 auto snapshot = mf->GetState()->CreateBaseSnapshot();
1906 cmMakefile lmf(mf->GetGlobalGenerator(), snapshot);
1907 lmf.ReadListFile(file);
1908
1909 if (!lmf.GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES").empty()) {
1910 std::string dir = cmSystemTools::GetFilenamePath(file);
1911
1912 // Clear the implicit dependency makefile.
1913 std::string dependFile = dir + "/depend.make";
1914 clearer.Clear(dependFile);
1915
1916 // Remove the internal dependency check file to force
1917 // regeneration.
1918 std::string internalDependFile = dir + "/depend.internal";
1919 cmSystemTools::RemoveFile(internalDependFile);
1920 }
1921
1922 auto depsFiles = lmf.GetSafeDefinition("CMAKE_DEPENDS_DEPENDENCY_FILES");
1923 if (!depsFiles.empty()) {
1924 auto dir = cmCMakePath(file).GetParentPath();
1925 // Clear the implicit dependency makefile.
1926 auto depFile = cmCMakePath(dir).Append("compiler_depend.make");
1927 clearer.Clear(depFile.GenericString());
1928
1929 // Remove the internal dependency check file
1930 auto internalDepFile =
1931 cmCMakePath(dir).Append("compiler_depend.internal");
1932 cmSystemTools::RemoveFile(internalDepFile.GenericString());
1933
1934 // Touch timestamp file to force dependencies regeneration
1935 auto DepTimestamp = cmCMakePath(dir).Append("compiler_depend.ts");
1936 cmSystemTools::Touch(DepTimestamp.GenericString(), true);
1937
1938 // clear the dependencies files generated by the compiler
1939 cmList dependencies{ depsFiles, cmList::EmptyElements::Yes };
1940 cmDependsCompiler depsManager;
1941 depsManager.SetVerbose(verbose);
1942 depsManager.ClearDependencies(dependencies);
1943 }
1944 }
1945}
1946
1947void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(

Callers

nothing calls this directly

Calls 12

cmCMakePathClass · 0.85
CreateBaseSnapshotMethod · 0.80
GetParentPathMethod · 0.80
GenericStringMethod · 0.80
GetDefinitionMethod · 0.45
SetVerboseMethod · 0.45
GetStateMethod · 0.45
GetGlobalGeneratorMethod · 0.45
ReadListFileMethod · 0.45
emptyMethod · 0.45
ClearMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected