Empty Vcpkg project property sheet, missing '-static' suffix and some clean-up #13753
Labels
category:vcpkg-bug
The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
I applied two bug fixes and some improvements to the files in
vcpkg/scripts/buildsystems/msbuild
and submitted a PR with my changes and reference to this issue.[Edit] Updated this description according to my additional findings and fixes.
vcpkg-general.xml
Bug Fixes
Problem: The
Vcpkg
project sheet does not display any values.Cause: Empty XML groups have been removed from the project file. Visual Studio however expects that a project file contains at least an empty
<PropertyGroup />
below the last import of properties (e. g.:vcpkg.props
). Otherwise, all entries of the vcpkg project sheet will remain empty, but only if the project sheetvcpkg-general.xml
also specifiesLabel="Vcpkg"
.Proof: Remove lines 72-87 from
scripts\testing\integrate-install\VcpkgTriplet.vcxproj
and open it in Visual Studio.We have moved almost every project property definition to shared
.props
and.targets
files. So most of our project files contain only<ItemDefinitionGroup>
s,<ItemGroup>
s, and<import>
s below the import statement forMicrosoft.Cpp.props
.IMHO, it's a design flaw to exhibit undefined behavior if an empty and thus obsolete XML object is removed from a file.
Workaround Options:
Label="Vcpkg"
from the property groups and Vcpkg project sheet, as I did initially. This is a breaking change for projects that have specified a property using this label (likeVcpkgTriplet.vcxproj
).<PropertyGroup />
to their project files if they encounter this problem.Label="Vcpkg"
from their copy ofvcpkg-general.xml
if they encounter this problem.Improvements
Conditional
that contains only those properties that haveHasConfigurationCondition="true"
. It doesn't make sense to me that some properties, like$(VcpkgEnabled)
, may have different values depending on theDebug
/Release
configuration.Switch
andDisplayName
properties from theVcpkgConfiguration
EnumProperty because that led to a redundant and incorrect display "Debug (Debug)", becauseDebug
andRelease
are - strictly speaking - not switches (like '/O3').VcpkgTriplet
on how it depends on the value ofVcpkgUseStatic
.VcpkgCurrentInstalledDir
, because it is silly. You could write this remark to basically every setting.vcpkg.props
Improvements
VcpkgHasProps
toVcpkgPropsImported
, because that is a better fit.VcpkgOSTarget
andVcpkgPlatformTarget
by swapping the order in which their two conditions are tested.vcpkg.targets
here that do not depend on other properties.VcpkgManifestRoot
).VcpkgRoot
to rely on the location ofvcpkg.props
instead of the tag file.vcpkg-root
, because that suits our projects better.vcpkg.targets
Bug Fixes
VcpkgTriplet
is updated if$(VcpkgUseStatic)
istrue
but propertyVcpkgCurrentInstalledDir
is not updated. Introduced helper propertyVcpkgLinkage
instead.Improvements
TreatAsLocalProperty
list with properties used only in this file.vcpkg.props
(see above).vcpkg.props
depending on the value ofVcpkgPropsImported
.VcpkgPageSchema
only if it exists. So it can be disabled by specifying an invalid string.VcpkgPageSchema
to deliberately disable the project property sheet for Vcpkg.[System.IO.Path]::Combine()
to combine paths because it is robust against missing trailing paths. This is relevant if properties are specified on the command line and MSBuild refuses to alter them.Target
properties to improve readability.The text was updated successfully, but these errors were encountered: