| 1945 | } |
| 1946 | |
| 1947 | void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( |
| 1948 | std::ostream& cmakefileStream, cmGeneratorTarget* target) |
| 1949 | { |
| 1950 | // To enable dependencies filtering |
| 1951 | cmakefileStream << "\n" |
| 1952 | "# Consider dependencies only in project.\n" |
| 1953 | "set(CMAKE_DEPENDS_IN_PROJECT_ONLY " |
| 1954 | << (cmIsOn(this->Makefile->GetSafeDefinition( |
| 1955 | "CMAKE_DEPENDS_IN_PROJECT_ONLY")) |
| 1956 | ? "ON" |
| 1957 | : "OFF") |
| 1958 | << ")\n\n"; |
| 1959 | |
| 1960 | bool requireFortran = false; |
| 1961 | if (target->HaveFortranSources(this->GetConfigName())) { |
| 1962 | requireFortran = true; |
| 1963 | } |
| 1964 | |
| 1965 | auto const& implicitLangs = |
| 1966 | this->GetImplicitDepends(target, cmDependencyScannerKind::CMake); |
| 1967 | |
| 1968 | // list the languages |
| 1969 | cmakefileStream << "# The set of languages for which implicit " |
| 1970 | "dependencies are needed:\n" |
| 1971 | "set(CMAKE_DEPENDS_LANGUAGES\n"; |
| 1972 | for (auto const& implicitLang : implicitLangs) { |
| 1973 | cmakefileStream << " \"" << implicitLang.first << "\"\n"; |
| 1974 | if (requireFortran && implicitLang.first == "Fortran"_s) { |
| 1975 | requireFortran = false; |
| 1976 | } |
| 1977 | } |
| 1978 | if (requireFortran) { |
| 1979 | cmakefileStream << " \"Fortran\"\n"; |
| 1980 | } |
| 1981 | cmakefileStream << " )\n"; |
| 1982 | |
| 1983 | if (!implicitLangs.empty()) { |
| 1984 | // now list the files for each language |
| 1985 | cmakefileStream |
| 1986 | << "# The set of files for implicit dependencies of each language:\n"; |
| 1987 | for (auto const& implicitLang : implicitLangs) { |
| 1988 | auto const& lang = implicitLang.first; |
| 1989 | |
| 1990 | cmakefileStream << "set(CMAKE_DEPENDS_CHECK_" << lang << '\n'; |
| 1991 | auto const& implicitPairs = implicitLang.second; |
| 1992 | |
| 1993 | // for each file pair |
| 1994 | for (auto const& implicitPair : implicitPairs) { |
| 1995 | for (auto const& di : implicitPair.second) { |
| 1996 | cmakefileStream << " \"" << di << "\" \"" << implicitPair.first |
| 1997 | << "\"\n"; |
| 1998 | } |
| 1999 | } |
| 2000 | cmakefileStream << " )\n"; |
| 2001 | |
| 2002 | // Tell the dependency scanner what compiler is used. |
| 2003 | std::string cidVar = cmStrCat("CMAKE_", lang, "_COMPILER_ID"); |
| 2004 | cmValue cid = this->Makefile->GetDefinition(cidVar); |
no test coverage detected