microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.36k stars 6.45k forks source link

vcpkg should set VCPKG_OSX_DEPLOYMENT_TARGET from CMAKE_OSX_DEPLOYMENT_TARGET in manifest mode #39981

Open MarkCallow opened 4 months ago

MarkCallow commented 4 months ago

Describe the bug On Apple OS's, If one's iOS app's deployment target is older than the deployment target of the dependencies built by vcpkg ld puts out hundreds of warnings. In manifest mode where vcpkg is automatically selecting the triplet, it selects a triplet without VCPKG_OSX_DEPLOYMENT_TARGET and builds the dependencies with the latest version of iOS as the deployment target. If your app has an earlier deployment target - not unusual - you will be subjected to the aforesaid hundreds of warnings.

Environment

To Reproduce Steps to reproduce the behavior:

  1. Set up manifest mode to provide dependencies for your iOS app that uses CMake for building.
  2. Set CMAKE_OSX_DEPLOYMENT_TARGET to something other than the latest version of iOS.
  3. Configure and generate a build for Xcode or other tool that uses Apple clang.
  4. Build your app.
  5. Observe the warnings (332 in my case).

Expected behavior vcpkg should use the value of CMAKE_OSX_DEPLOYMENT_TARGET when setting up the triplet for the build.

Failure logs Here is a sample warning message:

Object file (<project dir>/build/ios/vcpkg_installed/arm64-ios/lib/libassimp.a[4](Compression.cpp.o)) was built for newer 'iOS' version (17.5) than being linked (12.0)

Additional context I am aware thanks to https://github.com/microsoft/vcpkg/discussions/39966 that this can be worked around using VCPKG_OVERLAY_TRIPLETS. To do so, I have to copy a minimum of 4 triplet files for iOS and OSX, edit each of them to add VCPKG_OSX_DEPLOYMENT_TARGET set to a target matching the CMAKE_OSX_DEPLOYMENT_TARGET in my CMakeLists.txt. If I need to change the deployment target in future I have to change it in multiple files with the concomitant risk of error all the while potentially missing updates to the source triplet files. I find it extremely user unfriendly to have to go to such lengths to avoid a barrage of warnings.

dg0yt commented 4 months ago

FTR this aren't just build-time warnings. The libs from the ports are likely to make the final app fail on the desired deployment target.

MarkCallow commented 4 months ago

What's the question?

github-actions[bot] commented 3 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

MarkCallow commented 3 months ago

This is waiting for somebody to implement it. There is nothing further to discuss. I don't appreciate having to keep posting comments to keep an issue alive.

I would still like to know why this has been labelled "category:question" @FrankXie05.