microsoft / vcpkg

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

VCPKG_OSX_DEPLOYMENT_TARGET does not affect non-CMake-based ports #10038

Open mjl5007 opened 4 years ago

mjl5007 commented 4 years ago

Is your feature request related to a problem? Please describe. When building non-CMake-based ports on macOS (e.g. openssl-unix which is built with make), setting VCPKG_OSX_DEPLOYMENT_TARGET in a triplet file has no effect on the build. That is, the port is built without the -mmacosx-version-min compiler flag, which results in targeting the macOS version of the building machine rather than the version specified by VCPKG_OSX_DEPLOYMENT_TARGET.

Proposed solution Setting VCPKG_OSX_DEPLOYMENT_TARGET in a triplet file should set the deployment target (-mmacosx-version-min compiler flag) for builds of non-CMake-based ports the same way it does for CMake-based ports.

Describe alternatives you've considered At the very least, update the triplet.md documentation to call out that VCPKG_OSX_DEPLOYMENT_TARGET is ineffective for non-CMake-based ports.

Alternatively, provide and/or document a different or additional way to specify the deployment target in a triplet file that works for non-CMake-based ports. For example, I was able to build openssl-unix on macOS 10.15 with a deployment target of 10.14 by adding the following to a triplet file:

set(VCPKG_C_FLAGS -mmacosx-version-min=10.14)
set(VCPKG_CXX_FLAGS -mmacosx-version-min=10.14)
christophe-calmejane commented 4 years ago

I'm having the exact same issue with openssl on macOS. My application is crashing on previous macOS version (I built using 10.15) because I'm unable to use VCPKG_OSX_DEPLOYMENT_TARGET to force openssl to build targetting a previous version of macOS. I'll try @mjl5007 solution though, as I already have setup a custom triplet file.

Like it's said in the Triplets documentation, a triplet is used to specify all the required cross-compilation options. Targetting an older version of the OS is part of those cross-compilation options. Please give us a clean way to set the deployment target, thanks a lot.

Edit: Proposed solution is working, thanks

strega-nil commented 4 years ago

Unfortunately, this isn't a priority for the team. However, if you would like to make these changes, I'll be more than willing to review them and help out :)

hmoffatt commented 2 years ago

Could you please add a note to the documentation at least, as proposed in the original report?

Neumann-A commented 2 years ago

Is this still an issue? Most ports should forward now.

JackBoosY commented 2 years ago

cc @LilyWangLL

lemourin commented 1 year ago

Doesn't work with zlib.

dpogue commented 1 year ago

Is this still an issue? Most ports should forward now.

This appears to still affect (at minimum) the following ports:

kevin-- commented 1 year ago

Yes still and issue -- struggling with openssl. The OP suggested solution does not appear to be working as this port uses configure/make/perl to build itself. Any suggestion on how to get these flags to be respected by vcpkg_configure_make?