void MSBuildQbsProductProject::addConfiguration(const GeneratableProject &project, const Project &buildTask, const ProductData &productData, const QStringList &buildConfigurationCommandLine) { const auto targetDir = Internal::PathUtils::toNativeSeparators( productTargetPath(productData), Internal::HostOsInfo::HostOsWindows); auto configurationDir = Internal::PathUtils::toNativeSeparators( project.baseBuildDirectory().absolutePath() + QLatin1Char('\\') + MSBuildUtils::configurationName(buildTask), Internal::HostOsInfo::HostOsWindows); auto relativeTargetDir = targetDir; if (targetDir.startsWith(configurationDir)) relativeTargetDir = QStringLiteral("$(SolutionDir)$(Configuration)") + relativeTargetDir.mid(configurationDir.size()); const auto properties = productData.moduleProperties(); const bool debugBuild = properties.getModuleProperty(QStringLiteral("qbs"), QStringLiteral("debugInformation")) .toBool(); const auto includePaths = QStringList() << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("includePaths")) << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("systemIncludePaths")); const auto cppDefines = properties .getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("defines")); const auto sep = Internal::HostOsInfo::pathListSeparator(Internal::HostOsInfo::HostOsWindows); auto propertyGroup1 = new MSBuildPropertyGroup(this); propertyGroup1->setCondition(MSBuildUtils::buildTaskCondition(buildTask)); propertyGroup1->setLabel(QStringLiteral("Configuration")); propertyGroup1->appendProperty(QStringLiteral("UseDebugLibraries"), debugBuild ? QStringLiteral("true") : QStringLiteral("false")); // General - General // We need a trailing backslash for $(OutDir); See also the VS documentation: // https://docs.microsoft.com/en-us/cpp/ide/common-macros-for-build-commands-and-properties propertyGroup1->appendProperty(QStringLiteral("OutDir"), relativeTargetDir + QLatin1Char('\\')); propertyGroup1->appendProperty(QStringLiteral("TargetName"), productData.targetName()); propertyGroup1->appendProperty(QStringLiteral("PlatformToolset"), versionInfo().platformToolsetVersion()); propertyGroup1->appendProperty(QStringLiteral("ConfigurationType"), QStringLiteral("Makefile")); // VS possible values: Unicode|MultiByte|NotSet propertyGroup1->appendProperty(QStringLiteral("CharacterSet"), properties.getModuleProperty(QStringLiteral("cpp"), QStringLiteral("windowsApiCharacterSet")) == QStringLiteral("unicode") ? QStringLiteral("MultiByte") : QStringLiteral("NotSet")); // Debugging propertyGroup1->appendProperty(QStringLiteral("DebuggerFlavor"), QStringLiteral("WindowsLocalDebugger")); propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerCommand"), QStringLiteral("$(OutDir)$(TargetName)$(TargetExt)")); propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerWorkingDirectory"), QStringLiteral("$(OutDir)")); // NMake - General // Skip configuration name, that's handled in qbs-shared.props const auto params = Internal::shellQuote(buildConfigurationCommandLine.mid(1), Internal::HostOsInfo::HostOsWindows); propertyGroup1->appendProperty(QStringLiteral("NMakeBuildCommandLine"), QStringLiteral("$(QbsBuildCommandLine) ") + params); propertyGroup1->appendProperty(QStringLiteral("NMakeReBuildCommandLine"), QStringLiteral("$(QbsReBuildCommandLine) ") + params); propertyGroup1->appendProperty(QStringLiteral("NMakeCleanCommandLine"), QStringLiteral("$(QbsCleanCommandLine) ") + params); propertyGroup1->appendProperty(QStringLiteral("NMakeOutput"), QStringLiteral("$(OutDir)$(TargetName)$(TargetExt)")); // NMake - IntelliSense propertyGroup1->appendProperty(QStringLiteral("NMakePreprocessorDefinitions"), cppDefines.join(sep)); propertyGroup1->appendProperty(QStringLiteral("NMakeIncludeSearchPath"), includePaths.join(sep)); }