diff --git a/docs/maintainers/vcpkg_common_definitions.md b/docs/maintainers/vcpkg_common_definitions.md index a97723c1b06..44b7ea74f36 100644 --- a/docs/maintainers/vcpkg_common_definitions.md +++ b/docs/maintainers/vcpkg_common_definitions.md @@ -23,6 +23,7 @@ TARGET_TRIPLET the name of the current triplet to buil CURRENT_INSTALLED_DIR the absolute path to the installed files for the current triplet HOST_TRIPLET the name of the triplet corresponding to the host CURRENT_HOST_INSTALLED_DIR the absolute path to the installed files for the host triplet +VCPKG_CROSSCOMPILING Whether vcpkg is cross-compiling: in other words, whether TARGET_TRIPLET and HOST_TRIPLET are different ``` CMAKE_STATIC_LIBRARY_(PREFIX|SUFFIX), CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX) and CMAKE_IMPORT_LIBRARY_(PREFIX|SUFFIX) are defined for the target diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index b505f3693bb..6d2b6df5b5e 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -22,6 +22,7 @@ TARGET_TRIPLET the name of the current triplet to buil CURRENT_INSTALLED_DIR the absolute path to the installed files for the current triplet HOST_TRIPLET the name of the triplet corresponding to the host CURRENT_HOST_INSTALLED_DIR the absolute path to the installed files for the host triplet +VCPKG_CROSSCOMPILING Whether vcpkg is cross-compiling: in other words, whether TARGET_TRIPLET and HOST_TRIPLET are different ``` CMAKE_STATIC_LIBRARY_(PREFIX|SUFFIX), CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX) and CMAKE_IMPORT_LIBRARY_(PREFIX|SUFFIX) are defined for the target @@ -29,6 +30,7 @@ Furthermore the variables CMAKE_FIND_LIBRARY_(PREFIXES|SUFFIXES) are also define portfiles are able to use find_library calls to discover dependent libraries within the current triplet for ports. #]===] +string(COMPARE EQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" VCPKG_CROSSCOMPILING) #Helper variable to identify the Target system. VCPKG_TARGET_IS_ if (NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "") set(VCPKG_TARGET_IS_WINDOWS ON)