aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_common_definitions.cmake
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2020-01-18 00:36:08 +0100
committerVictor Romero <romerosanchezv@gmail.com>2020-01-17 15:36:08 -0800
commit38b959022cec1b865489d97a697eda84b49cc4e5 (patch)
tree20fcc2f8eedbb65f7067a1d6e077d2c616111e48 /scripts/cmake/vcpkg_common_definitions.cmake
parentf56645c3fd9a1561c430e90ce00836489b372ef8 (diff)
downloadvcpkg-38b959022cec1b865489d97a697eda84b49cc4e5.tar.gz
vcpkg-38b959022cec1b865489d97a697eda84b49cc4e5.zip
Add support for building with MinGW (#9137)
* Add support for building with MinGW Tested with MSYS2 MinGW 8.3.0, gcc-mcf.lhmouse MinGW 9.2.1, and StephanTLavavej/mingw-distro! * Add MinGW toolchain From your MinGW configured shell you could just use vcpkg to configure packages. An x64-mingw triplet would look like: ``` set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_ENV_PASSTHROUGH PATH) set(VCPKG_CMAKE_SYSTEM_NAME MinGW) ``` * Add MinGW community tripplets x64 tested with https://github.com/StephanTLavavej/mingw-distro x86, arm64, arm tested with https://github.com/mstorsjo/llvm-mingw
Diffstat (limited to 'scripts/cmake/vcpkg_common_definitions.cmake')
-rw-r--r--scripts/cmake/vcpkg_common_definitions.cmake19
1 files changed, 13 insertions, 6 deletions
diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake
index 14cf460af..3a1818bf5 100644
--- a/scripts/cmake/vcpkg_common_definitions.cmake
+++ b/scripts/cmake/vcpkg_common_definitions.cmake
@@ -37,9 +37,12 @@ elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
set(VCPKG_TARGET_IS_ANDROID 1)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(VCPKG_TARGET_IS_FREEBSD 1)
+elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
+ set(VCPKG_TARGET_IS_WINDOWS 1)
+ set(VCPKG_TARGET_IS_MINGW 1)
endif()
-#Helper variable to identify the host path separator.
+#Helper variable to identify the host path separator.
if(CMAKE_HOST_WIN32)
set(VCPKG_HOST_PATH_SEPARATOR ";")
elseif(CMAKE_HOST_UNIX)
@@ -71,11 +74,15 @@ if(VCPKG_TARGET_IS_WINDOWS)
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".
- ## For CYGWIN and Windows GNU, maybe VCPKG will support that in the future?
- #set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".dll.a")
- #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_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_OSX)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")