| 896 | } |
| 897 | |
| 898 | std::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) { |
no test coverage detected