| 1071 | }; |
| 1072 | |
| 1073 | cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( |
| 1074 | cmLocalGenerator* lg, cmSourceFile* sf, cmGeneratorTarget* gtgt) |
| 1075 | { |
| 1076 | std::string lang = this->CurrentLocalGenerator->GetSourceFileLanguage(*sf); |
| 1077 | |
| 1078 | XCodeGeneratorExpressionInterpreter genexInterpreter(sf, lg, gtgt, lang); |
| 1079 | |
| 1080 | // Add flags from target and source file properties. |
| 1081 | std::string flags; |
| 1082 | std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); |
| 1083 | switch (cmOutputConverter::GetFortranFormat(srcfmt)) { |
| 1084 | case cmOutputConverter::FortranFormatFixed: |
| 1085 | flags = cmStrCat("-fixed ", flags); |
| 1086 | break; |
| 1087 | case cmOutputConverter::FortranFormatFree: |
| 1088 | flags = cmStrCat("-free ", flags); |
| 1089 | break; |
| 1090 | default: |
| 1091 | break; |
| 1092 | } |
| 1093 | |
| 1094 | // Explicitly add the explicit language flag before any other flag |
| 1095 | // so user flags can override it. |
| 1096 | gtgt->AddExplicitLanguageFlags(flags, *sf); |
| 1097 | |
| 1098 | std::string const COMPILE_FLAGS("COMPILE_FLAGS"); |
| 1099 | if (cmValue cflags = sf->GetProperty(COMPILE_FLAGS)) { |
| 1100 | lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS)); |
| 1101 | } |
| 1102 | std::string const COMPILE_OPTIONS("COMPILE_OPTIONS"); |
| 1103 | if (cmValue coptions = sf->GetProperty(COMPILE_OPTIONS)) { |
| 1104 | lg->AppendCompileOptions( |
| 1105 | flags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS)); |
| 1106 | } |
| 1107 | |
| 1108 | // Add per-source definitions. |
| 1109 | BuildObjectListOrString flagsBuild(this, false); |
| 1110 | std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); |
| 1111 | if (cmValue compile_defs = sf->GetProperty(COMPILE_DEFINITIONS)) { |
| 1112 | this->AppendDefines( |
| 1113 | flagsBuild, |
| 1114 | genexInterpreter.Evaluate(*compile_defs, COMPILE_DEFINITIONS).c_str(), |
| 1115 | true); |
| 1116 | } |
| 1117 | |
| 1118 | if (sf->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) { |
| 1119 | this->AppendDefines(flagsBuild, "CMAKE_SKIP_PRECOMPILE_HEADERS", true); |
| 1120 | } |
| 1121 | |
| 1122 | if (!flagsBuild.IsEmpty()) { |
| 1123 | if (!flags.empty()) { |
| 1124 | flags += ' '; |
| 1125 | } |
| 1126 | flags += flagsBuild.GetString(); |
| 1127 | } |
| 1128 | |
| 1129 | // Add per-source include directories. |
| 1130 | std::vector<std::string> includes; |
no test coverage detected