2021-04-07 21:51:40 +02:00
|
|
|
string(COMPARE NOTEQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" VCPKG_CROSSCOMPILING)
|
2019-08-23 00:57:24 +02:00
|
|
|
#Helper variable to identify the Target system. VCPKG_TARGET_IS_<targetname>
|
2021-02-28 13:17:19 -08:00
|
|
|
if (NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "")
|
|
|
|
set(VCPKG_TARGET_IS_WINDOWS ON)
|
2023-06-08 11:17:29 -07:00
|
|
|
|
|
|
|
if(DEFINED VCPKG_XBOX_CONSOLE_TARGET AND NOT "${VCPKG_XBOX_CONSOLE_TARGET}" STREQUAL "")
|
|
|
|
set(VCPKG_TARGET_IS_XBOX ON)
|
|
|
|
endif()
|
2021-02-28 13:17:19 -08:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
set(VCPKG_TARGET_IS_WINDOWS ON)
|
|
|
|
set(VCPKG_TARGET_IS_UWP ON)
|
2019-08-23 00:57:24 +02:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_OSX ON)
|
2020-08-05 16:04:35 -04:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_IOS ON)
|
2019-08-23 00:57:24 +02:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_LINUX ON)
|
2019-08-23 00:57:24 +02:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_ANDROID ON)
|
2019-08-23 00:57:24 +02:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_FREEBSD ON)
|
2020-11-23 18:43:23 +01:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_OPENBSD ON)
|
2020-01-18 00:36:08 +01:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_TARGET_IS_WINDOWS ON)
|
|
|
|
set(VCPKG_TARGET_IS_MINGW ON)
|
2022-09-08 17:01:20 -04:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
|
|
|
set(VCPKG_TARGET_IS_EMSCRIPTEN ON)
|
2019-08-23 00:57:24 +02:00
|
|
|
endif()
|
|
|
|
|
2020-10-17 02:10:48 -07:00
|
|
|
#Helper variables to identify the host system name
|
|
|
|
if (CMAKE_HOST_WIN32)
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_HOST_IS_WINDOWS ON)
|
2020-10-17 02:10:48 -07:00
|
|
|
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_HOST_IS_OSX ON)
|
2020-10-17 02:10:48 -07:00
|
|
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_HOST_IS_LINUX ON)
|
2020-10-17 02:10:48 -07:00
|
|
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_HOST_IS_FREEBSD ON)
|
2020-11-23 18:43:23 +01:00
|
|
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
|
2021-02-28 13:17:19 -08:00
|
|
|
set(VCPKG_HOST_IS_OPENBSD ON)
|
2020-10-17 02:10:48 -07:00
|
|
|
endif()
|
|
|
|
|
2020-01-18 00:36:08 +01:00
|
|
|
#Helper variable to identify the host path separator.
|
2019-08-21 12:00:35 +02:00
|
|
|
if(CMAKE_HOST_WIN32)
|
2019-09-20 12:52:14 +02:00
|
|
|
set(VCPKG_HOST_PATH_SEPARATOR ";")
|
2019-08-21 12:00:35 +02:00
|
|
|
elseif(CMAKE_HOST_UNIX)
|
|
|
|
set(VCPKG_HOST_PATH_SEPARATOR ":")
|
2019-09-20 12:24:23 +02:00
|
|
|
endif()
|
2019-08-23 08:54:20 +02:00
|
|
|
|
2019-08-23 00:57:24 +02:00
|
|
|
#Helper variables to identify executables on host/target
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(VCPKG_HOST_EXECUTABLE_SUFFIX ".exe")
|
|
|
|
else()
|
|
|
|
set(VCPKG_HOST_EXECUTABLE_SUFFIX "")
|
|
|
|
endif()
|
|
|
|
#set(CMAKE_EXECUTABLE_SUFFIX ${VCPKG_HOST_EXECUTABLE_SUFFIX}) not required by find_program
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(VCPKG_TARGET_EXECUTABLE_SUFFIX ".exe")
|
|
|
|
else()
|
|
|
|
set(VCPKG_TARGET_EXECUTABLE_SUFFIX "")
|
|
|
|
endif()
|
|
|
|
|
2021-10-04 22:40:14 +03:00
|
|
|
#Helper variables to identify bundles on host/target
|
|
|
|
if(VCPKG_HOST_IS_OSX)
|
|
|
|
set(VCPKG_HOST_BUNDLE_SUFFIX ".app")
|
|
|
|
else()
|
|
|
|
set(VCPKG_HOST_BUNDLE_SUFFIX "")
|
|
|
|
endif()
|
|
|
|
|
2022-09-01 11:25:11 -05:00
|
|
|
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
|
2021-10-04 22:40:14 +03:00
|
|
|
set(VCPKG_TARGET_BUNDLE_SUFFIX ".app")
|
|
|
|
else()
|
|
|
|
set(VCPKG_TARGET_BUNDLE_SUFFIX "")
|
|
|
|
endif()
|
|
|
|
|
2019-09-16 18:06:06 +02:00
|
|
|
#Helper variables for libraries
|
2020-01-23 21:17:40 +01:00
|
|
|
if(VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
|
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".dll.a")
|
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
|
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
|
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
|
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "lib")
|
|
|
|
set(VCPKG_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
|
|
|
|
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
|
|
|
|
elseif(VCPKG_TARGET_IS_WINDOWS)
|
2019-08-23 00:57:24 +02:00
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib")
|
2019-10-07 19:35:13 +02:00
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
|
2019-08-23 00:57:24 +02:00
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
|
2019-09-16 18:06:06 +02:00
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
|
2019-08-23 00:57:24 +02:00
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "")
|
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "")
|
2019-09-16 18:06:06 +02:00
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "")
|
|
|
|
set(VCPKG_FIND_LIBRARY_SUFFIXES ".lib" ".dll") #This is a slight modification to CMakes value which does not include ".dll".
|
|
|
|
set(VCPKG_FIND_LIBRARY_PREFIXES "" "lib") #This is a slight modification to CMakes value which does not include "lib".
|
|
|
|
elseif(VCPKG_TARGET_IS_OSX)
|
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
|
2019-10-07 19:35:13 +02:00
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")
|
2019-09-16 18:06:06 +02:00
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib")
|
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
|
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
|
|
|
|
set(VCPKG_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
|
|
|
|
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
|
2019-08-23 00:57:24 +02:00
|
|
|
else()
|
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
|
2019-10-07 19:35:13 +02:00
|
|
|
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")
|
2019-08-23 00:57:24 +02:00
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so")
|
|
|
|
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
|
|
|
|
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
|
2019-09-16 18:06:06 +02:00
|
|
|
set(VCPKG_FIND_LIBRARY_SUFFIXES ".so" ".a")
|
|
|
|
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
|
2019-08-23 00:57:24 +02:00
|
|
|
endif()
|
|
|
|
#Setting these variables allows find_library to work in script mode and thus in portfiles!
|
|
|
|
#This allows us scale down on hardcoded target dependent paths in portfiles
|
2019-09-16 18:06:06 +02:00
|
|
|
set(CMAKE_STATIC_LIBRARY_SUFFIX "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
set(CMAKE_SHARED_LIBRARY_SUFFIX "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
|
2020-12-02 05:13:58 +07:00
|
|
|
set(CMAKE_IMPORT_LIBRARY_SUFFIX "${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}")
|
2019-09-16 18:06:06 +02:00
|
|
|
set(CMAKE_STATIC_LIBRARY_PREFIX "${VCPKG_TARGET_STATIC_LIBRARY_PREFIX}")
|
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}")
|
2020-12-02 05:13:58 +07:00
|
|
|
set(CMAKE_IMPORT_LIBRARY_PREFIX "${VCPKG_TARGET_IMPORT_LIBRARY_PREFIX}")
|
2019-08-23 00:57:24 +02:00
|
|
|
|
2019-09-16 18:06:06 +02:00
|
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES "${VCPKG_FIND_LIBRARY_SUFFIXES}" CACHE INTERNAL "") # Required by find_library
|
|
|
|
set(CMAKE_FIND_LIBRARY_PREFIXES "${VCPKG_FIND_LIBRARY_PREFIXES}" CACHE INTERNAL "") # Required by find_library
|
2020-06-24 23:59:32 +02:00
|
|
|
|
|
|
|
# Append platform libraries to VCPKG_SYSTEM_LIBRARIES
|
|
|
|
# The variable are just appended to permit to custom triplets define the variable
|
|
|
|
|
|
|
|
# Platforms with libdl
|
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES dl)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platforms with libm
|
2020-11-23 18:43:23 +01:00
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_MINGW)
|
2020-06-24 23:59:32 +02:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES m)
|
|
|
|
endif()
|
|
|
|
|
2020-08-19 05:58:14 +10:00
|
|
|
# Platforms with pthread
|
2020-11-23 18:43:23 +01:00
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
|
2020-08-19 05:58:14 +10:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES pthread)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platforms with libstdc++
|
2020-11-23 18:43:23 +01:00
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
|
2021-02-28 13:17:19 -08:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES [[stdc\+\+]])
|
2020-08-19 05:58:14 +10:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platforms with libc++
|
|
|
|
if(VCPKG_TARGET_IS_OSX)
|
2021-02-28 13:17:19 -08:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES [[c\+\+]])
|
2020-08-19 05:58:14 +10:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platforms with librt
|
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_MINGW)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES rt)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platforms with GCC libs
|
2020-11-23 18:43:23 +01:00
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
|
2020-08-19 05:58:14 +10:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc_s)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platforms with system iconv
|
|
|
|
if(VCPKG_TARGET_IS_OSX)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES iconv)
|
|
|
|
endif()
|
|
|
|
|
2020-06-24 23:59:32 +02:00
|
|
|
# Windows system libs
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
2020-08-19 05:58:14 +10:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES advapi32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES bcrypt)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES dinput8)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES gdi32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES imm32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES oleaut32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES ole32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES psapi)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES secur32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES setupapi)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES shell32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES shlwapi)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES strmiids)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES user32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES uuid)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES version)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES vfw32)
|
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES winmm)
|
2020-06-24 23:59:32 +02:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES wsock32)
|
2020-07-24 20:39:21 +02:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES Ws2_32)
|
2020-11-20 21:18:17 +01:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES wldap32)
|
2021-02-28 13:17:19 -08:00
|
|
|
list(APPEND VCPKG_SYSTEM_LIBRARIES crypt32)
|
2020-06-24 23:59:32 +02:00
|
|
|
endif()
|