| 2798 | } |
| 2799 | |
| 2800 | void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( |
| 2801 | Elem& e2, cmSourceFile const* source) |
| 2802 | { |
| 2803 | cmSourceFile const& sf = *source; |
| 2804 | |
| 2805 | std::string objectName; |
| 2806 | if (this->GeneratorTarget->HasExplicitObjectName(&sf)) { |
| 2807 | objectName = this->GeneratorTarget->GetObjectName(&sf); |
| 2808 | } |
| 2809 | std::string flags; |
| 2810 | bool configDependentFlags = false; |
| 2811 | std::string options; |
| 2812 | bool configDependentOptions = false; |
| 2813 | std::string defines; |
| 2814 | bool configDependentDefines = false; |
| 2815 | std::string includes; |
| 2816 | bool configDependentIncludes = false; |
| 2817 | if (cmValue cflags = sf.GetProperty("COMPILE_FLAGS")) { |
| 2818 | configDependentFlags = |
| 2819 | cmGeneratorExpression::Find(*cflags) != std::string::npos; |
| 2820 | flags += *cflags; |
| 2821 | } |
| 2822 | if (cmValue coptions = sf.GetProperty("COMPILE_OPTIONS")) { |
| 2823 | configDependentOptions = |
| 2824 | cmGeneratorExpression::Find(*coptions) != std::string::npos; |
| 2825 | options += *coptions; |
| 2826 | } |
| 2827 | if (cmValue cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) { |
| 2828 | configDependentDefines = |
| 2829 | cmGeneratorExpression::Find(*cdefs) != std::string::npos; |
| 2830 | defines += *cdefs; |
| 2831 | } |
| 2832 | if (cmValue cincludes = sf.GetProperty("INCLUDE_DIRECTORIES")) { |
| 2833 | configDependentIncludes = |
| 2834 | cmGeneratorExpression::Find(*cincludes) != std::string::npos; |
| 2835 | includes += *cincludes; |
| 2836 | } |
| 2837 | |
| 2838 | // Force language if the file extension does not match. |
| 2839 | // Note that MSVC treats the upper-case '.C' extension as C and not C++. |
| 2840 | std::string const ext = sf.GetExtension(); |
| 2841 | cm::string_view const extLang = ext == "C"_s |
| 2842 | ? "C"_s |
| 2843 | : this->GlobalGenerator->GetLanguageFromExtension(ext); |
| 2844 | std::string lang = this->LocalGenerator->GetSourceFileLanguage(sf); |
| 2845 | char const* compileAs = nullptr; |
| 2846 | if (lang != extLang) { |
| 2847 | if (lang == "CXX"_s) { |
| 2848 | // force a C++ file type |
| 2849 | compileAs = "CompileAsCpp"; |
| 2850 | } else if (lang == "C"_s) { |
| 2851 | // force to c |
| 2852 | compileAs = "CompileAsC"; |
| 2853 | } |
| 2854 | } |
| 2855 | |
| 2856 | bool noWinRT = this->TargetCompileAsWinRT && lang == "C"_s; |
| 2857 |
no test coverage detected