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

Method GetIncludeFlags

Source/cmLocalGenerator.cxx:898–997  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896}
897
898std::string cmLocalGenerator::GetIncludeFlags(
899 std::vector<std::string> const& includeDirs, cmGeneratorTarget* target,
900 std::string const& lang, std::string const& config, bool forResponseFile)
901{
902 if (lang.empty()) {
903 return "";
904 }
905
906 std::vector<std::string> includes = includeDirs;
907 MoveSystemIncludesToEnd(includes, config, lang, target);
908
909 OutputFormat shellFormat = forResponseFile ? RESPONSE : SHELL;
910 std::ostringstream includeFlags;
911
912 std::string const& includeFlag =
913 this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang));
914 bool quotePaths = false;
915 if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) {
916 quotePaths = true;
917 }
918 std::string sep = " ";
919 bool repeatFlag = true;
920 // should the include flag be repeated like ie. -IA -IB
921 if (cmValue incSep = this->Makefile->GetDefinition(
922 cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))) {
923 // if there is a separator then the flag is not repeated but is only
924 // given once i.e. -classpath a:b:c
925 sep = *incSep;
926 repeatFlag = false;
927 }
928
929 // Support special system include flag if it is available and the
930 // normal flag is repeated for each directory.
931 cmValue sysIncludeFlag = nullptr;
932 cmValue sysIncludeFlagWarning = nullptr;
933 if (repeatFlag) {
934 sysIncludeFlag = this->Makefile->GetDefinition(
935 cmStrCat("CMAKE_INCLUDE_SYSTEM_FLAG_", lang));
936 sysIncludeFlagWarning = this->Makefile->GetDefinition(
937 cmStrCat("CMAKE_INCLUDE_SYSTEM_FLAG_", lang, "_WARNING"));
938 }
939
940 cmValue fwSearchFlag = this->Makefile->GetDefinition(
941 cmStrCat("CMAKE_", lang, "_FRAMEWORK_SEARCH_FLAG"));
942 cmValue sysFwSearchFlag = this->Makefile->GetDefinition(
943 cmStrCat("CMAKE_", lang, "_SYSTEM_FRAMEWORK_SEARCH_FLAG"));
944
945 bool flagUsed = false;
946 bool sysIncludeFlagUsed = false;
947 std::set<std::string> emitted;
948#ifdef __APPLE__
949 emitted.insert("/System/Library/Frameworks");
950#endif
951 for (std::string const& i : includes) {
952 if (cmNonempty(fwSearchFlag) && this->Makefile->IsOn("APPLE") &&
953 cmSystemTools::IsPathToFramework(i)) {
954 std::string const frameworkDir = cmSystemTools::GetFilenamePath(i);
955 if (emitted.insert(frameworkDir).second) {

Callers 12

CreateXCodeSourceFileMethod · 0.80
CreateBuildSettingsMethod · 0.80
WriteObjectRuleFilesMethod · 0.80
AddIncludeFlagsMethod · 0.80
AddIncludeFlagsMethod · 0.80
ComputeIncludesMethod · 0.80
ComputeIncludesMethod · 0.80
AddIncludeFlagsMethod · 0.80
DetectCompilerFlagsMethod · 0.80
FindPackageMethod · 0.80

Calls 14

MoveSystemIncludesToEndFunction · 0.85
cmNonemptyFunction · 0.85
cmTrimWhitespaceFunction · 0.85
strMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
GetDefinitionMethod · 0.45
insertMethod · 0.45
IsOnMethod · 0.45
ConvertToOutputFormatMethod · 0.45

Tested by

no test coverage detected