Create macOS configuration variables for triplets (#4477)

* Create macOS configuration variables for triplets

* Add new macOS configuration variables to documentation

* [vcpkg-configure-cmake] Fix typo
This commit is contained in:
LRFLEW 2018-10-23 17:49:48 -06:00 committed by Robert Schumacher
parent c99f891b30
commit 16e7f4187b
3 changed files with 24 additions and 0 deletions

View File

@ -69,6 +69,17 @@ This option also has forms for configuration-specific and C flags:
- `VCPKG_C_FLAGS_DEBUG` - `VCPKG_C_FLAGS_DEBUG`
- `VCPKG_C_FLAGS_RELEASE` - `VCPKG_C_FLAGS_RELEASE`
## macOS Variables
### VCPKG_INSTALL_NAME_DIR
Sets the install name used when building macOS dynamic libraries. Default value is `@rpath`. See the CMake documentation for [CMAKE_INSTALL_NAME_DIR](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_NAME_DIR.html) for more information.
### VCPKG_OSX_DEPLOYMENT_TARGET
Sets the minimum macOS version for compiled binaries. This also changes what versions of the macOS platform SDK that CMake will search for. See the CMake documentation for [CMAKE_OSX_DEPLOYMENT_TARGET](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html) for more information.
### VCPKG_OSX_SYSROOT
Set the name or path of the macOS platform SDK that will be used by CMake. See the CMake documentation for [CMAKE_OSX_SYSROOT](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html) for more information.
## Per-port customization ## Per-port customization
The CMake Macro `PORT` will be set when interpreting the triplet file and can be used to change settings (such as `VCPKG_LIBRARY_LINKAGE`) on a per-port basis. The CMake Macro `PORT` will be set when interpreting the triplet file and can be used to change settings (such as `VCPKG_LIBRARY_LINKAGE`) on a per-port basis.

View File

@ -201,6 +201,17 @@ function(vcpkg_configure_cmake)
) )
endif() endif()
# Sets configuration variables for macOS builds
if(DEFINED VCPKG_INSTALL_NAME_DIR)
list(APPEND _csc_OPTIONS "-DCMAKE_INSTALL_NAME_DIR=${VCPKG_INSTALL_NAME_DIR}")
endif()
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
list(APPEND _csc_OPTIONS "-DCMAKE_OSX_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}")
endif()
if(DEFINED VCPKG_OSX_SYSROOT)
list(APPEND _csc_OPTIONS "-DCMAKE_OSX_SYSROOT=${VCPKG_OSX_SYSROOT}")
endif()
set(rel_command set(rel_command
${CMAKE_COMMAND} ${_csc_SOURCE_PATH} "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}" ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}"
-G ${GENERATOR} -G ${GENERATOR}

View File

@ -9,6 +9,8 @@ else()
endif() endif()
set(CMAKE_SYSTEM_NAME Darwin CACHE STRING "") set(CMAKE_SYSTEM_NAME Darwin CACHE STRING "")
set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if(NOT _CMAKE_IN_TRY_COMPILE) if(NOT _CMAKE_IN_TRY_COMPILE)
set(CMAKE_CXX_FLAGS "${VCPKG_CXX_FLAGS} -fPIC" CACHE STRING "") set(CMAKE_CXX_FLAGS "${VCPKG_CXX_FLAGS} -fPIC" CACHE STRING "")