2017-05-24 23:33:16 -07:00
|
|
|
## # vcpkg_find_acquire_program
|
|
|
|
##
|
|
|
|
## Download or find a well-known tool.
|
|
|
|
##
|
|
|
|
## ## Usage
|
|
|
|
## ```cmake
|
|
|
|
## vcpkg_find_acquire_program(<VAR>)
|
|
|
|
## ```
|
|
|
|
## ## Parameters
|
|
|
|
## ### VAR
|
|
|
|
## This variable specifies both the program to be acquired as well as the out parameter that will be set to the path of the program executable.
|
|
|
|
##
|
|
|
|
## ## Notes
|
|
|
|
## The current list of programs includes:
|
|
|
|
##
|
|
|
|
## - 7Z
|
|
|
|
## - BISON
|
|
|
|
## - FLEX
|
2017-06-17 11:30:03 -07:00
|
|
|
## - GASPREPROCESSOR
|
2017-05-24 23:33:16 -07:00
|
|
|
## - PERL
|
|
|
|
## - PYTHON2
|
|
|
|
## - PYTHON3
|
|
|
|
## - JOM
|
|
|
|
## - MESON
|
|
|
|
## - NASM
|
|
|
|
## - NINJA
|
2019-03-14 00:10:11 -07:00
|
|
|
## - NUGET
|
2017-05-24 23:33:16 -07:00
|
|
|
## - YASM
|
2018-03-07 17:57:16 +08:00
|
|
|
## - ARIA2 (Downloader)
|
2017-05-24 23:33:16 -07:00
|
|
|
##
|
|
|
|
## Note that msys2 has a dedicated helper function: [`vcpkg_acquire_msys`](vcpkg_acquire_msys.md).
|
|
|
|
##
|
|
|
|
## ## Examples
|
|
|
|
##
|
|
|
|
## * [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake)
|
|
|
|
## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake)
|
|
|
|
## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake)
|
2016-09-18 20:50:08 -07:00
|
|
|
function(vcpkg_find_acquire_program VAR)
|
2017-10-12 08:22:50 -07:00
|
|
|
set(EXPANDED_VAR ${${VAR}})
|
|
|
|
if(EXPANDED_VAR)
|
2016-09-18 20:50:08 -07:00
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(NOEXTRACT)
|
2018-03-26 17:21:46 -07:00
|
|
|
unset(_vfa_RENAME)
|
2017-02-03 17:16:13 +01:00
|
|
|
unset(SUBDIR)
|
2017-02-09 18:13:52 +01:00
|
|
|
unset(REQUIRED_INTERPRETER)
|
2019-07-02 22:47:50 +02:00
|
|
|
unset(POST_INSTALL_COMMAND)
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-02-14 17:29:47 -08:00
|
|
|
vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS)
|
|
|
|
vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT)
|
|
|
|
|
2016-09-18 20:50:08 -07:00
|
|
|
if(VAR MATCHES "PERL")
|
2017-08-02 14:36:02 -07:00
|
|
|
set(PROGNAME perl)
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/perl/perl/bin)
|
2018-03-13 11:35:19 -07:00
|
|
|
set(BREW_PACKAGE_NAME "perl")
|
|
|
|
set(APT_PACKAGE_NAME "perl")
|
2019-07-01 15:31:17 -05:00
|
|
|
set(URL "http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit.zip")
|
|
|
|
set(ARCHIVE "strawberry-perl-5.30.0.1-32bit.zip")
|
|
|
|
set(HASH d353d3dc743ebdc6d1e9f6f2b7a6db3c387c1ce6c890bae8adc8ae5deae8404f4c5e3cf249d1e151e7256d4c5ee9cd317e6c41f3b6f244340de18a24b938e0c4)
|
2016-09-18 20:50:08 -07:00
|
|
|
elseif(VAR MATCHES "NASM")
|
|
|
|
set(PROGNAME nasm)
|
2019-02-22 01:05:19 +00:00
|
|
|
set(PATHS ${DOWNLOADS}/tools/nasm/nasm-2.14)
|
2018-03-13 11:35:19 -07:00
|
|
|
set(BREW_PACKAGE_NAME "nasm")
|
|
|
|
set(APT_PACKAGE_NAME "nasm")
|
2019-02-22 01:05:19 +00:00
|
|
|
set(URL "http://www.nasm.us/pub/nasm/releasebuilds/2.14/win32/nasm-2.14-win32.zip")
|
|
|
|
set(ARCHIVE "nasm-2.14-win32.zip")
|
|
|
|
set(HASH 64481b0346b83de8c9568f04a54f68e0f4c71724afa0b414f12e4080951d8c49e489bfc32117f9a489e3e49477b1cadc583c672311316d27c543af304c4b7f2a)
|
2016-09-18 20:50:08 -07:00
|
|
|
elseif(VAR MATCHES "YASM")
|
|
|
|
set(PROGNAME yasm)
|
2018-03-26 17:21:46 -07:00
|
|
|
set(SUBDIR 1.3.0.6)
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/yasm/${SUBDIR})
|
|
|
|
set(URL "https://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe")
|
|
|
|
set(ARCHIVE "yasm-1.3.0.6.g1962.exe")
|
|
|
|
set(_vfa_RENAME "yasm.exe")
|
2016-09-18 20:50:08 -07:00
|
|
|
set(NOEXTRACT ON)
|
2018-03-26 17:21:46 -07:00
|
|
|
set(HASH c1945669d983b632a10c5ff31e86d6ecbff143c3d8b2c433c0d3d18f84356d2b351f71ac05fd44e5403651b00c31db0d14615d7f9a6ecce5750438d37105c55b)
|
2016-11-01 19:19:05 -04:00
|
|
|
elseif(VAR MATCHES "PYTHON3")
|
2018-11-27 01:52:11 +01:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(PROGNAME python)
|
2019-07-02 22:47:50 +02:00
|
|
|
set(SUBDIR "python-3.7.3")
|
2018-11-27 01:52:11 +01:00
|
|
|
set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
|
2019-06-19 10:47:09 -07:00
|
|
|
set(URL "https://www.python.org/ftp/python/3.7.3/python-3.7.3-embed-win32.zip")
|
|
|
|
set(ARCHIVE "python-3.7.3-embed-win32.zip")
|
|
|
|
set(HASH 2c1b1f0a29d40a91771ae21a5f733eedc10984cd182cb10c2793bbd24191a89f20612a3f23c34047f37fb06369016bfd4a52915ed1b4a56f8bd2b4ca6994eb31)
|
2019-07-02 22:47:50 +02:00
|
|
|
set(POST_INSTALL_COMMAND ${CMAKE_COMMAND} -E remove python37._pth)
|
2018-11-27 01:52:11 +01:00
|
|
|
else()
|
|
|
|
set(PROGNAME python3)
|
|
|
|
set(BREW_PACKAGE_NAME "python")
|
|
|
|
set(APT_PACKAGE_NAME "python3")
|
|
|
|
endif()
|
2016-11-28 17:17:28 -08:00
|
|
|
elseif(VAR MATCHES "PYTHON2")
|
2019-05-02 22:57:43 -07:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(PROGNAME python)
|
|
|
|
set(SUBDIR "python2")
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
|
2019-07-01 15:31:17 -05:00
|
|
|
set(URL "https://www.python.org/ftp/python/2.7.16/python-2.7.16.msi")
|
2019-05-02 22:57:43 -07:00
|
|
|
set(ARCHIVE "python2.msi")
|
2019-07-01 15:31:17 -05:00
|
|
|
set(HASH c34a6fa2438682104dccb53650a2bdb79eac7996deff075201a0f71bb835d60d3ed866652a1931f15a29510fe8e1009ac04e423b285122d2e5747fefc4c10254)
|
2019-05-02 22:57:43 -07:00
|
|
|
else()
|
|
|
|
set(PROGNAME python2)
|
|
|
|
set(BREW_PACKAGE_NAME "python2")
|
|
|
|
set(APT_PACKAGE_NAME "python")
|
|
|
|
endif()
|
2017-05-29 09:05:52 +02:00
|
|
|
elseif(VAR MATCHES "RUBY")
|
|
|
|
set(PROGNAME "ruby")
|
2019-07-01 15:31:17 -05:00
|
|
|
set(PATHS ${DOWNLOADS}/tools/ruby/rubyinstaller-2.6.3-1-x86/bin)
|
|
|
|
set(URL https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x86.7z)
|
|
|
|
set(ARCHIVE rubyinstaller-2.6.3-1-x86.7z)
|
|
|
|
set(HASH 4322317dd02ce13527bf09d6e6a7787ca3814ea04337107d28af1ac360bd272504b32e20ed3ea84eb5b21dae7b23bfe5eb0e529b6b0aa21a1a2bbb0a542d7aec)
|
2016-10-25 20:56:02 +11:00
|
|
|
elseif(VAR MATCHES "JOM")
|
2016-10-25 12:39:50 +11:00
|
|
|
set(PROGNAME jom)
|
2019-04-26 02:56:36 +08:00
|
|
|
set(SUBDIR "jom-1.1.3")
|
2017-02-23 03:29:25 -08:00
|
|
|
set(PATHS ${DOWNLOADS}/tools/jom/${SUBDIR})
|
2019-04-26 02:56:36 +08:00
|
|
|
set(URL "http://download.qt.io/official_releases/jom/jom_1_1_3.zip")
|
|
|
|
set(ARCHIVE "jom_1_1_3.zip")
|
|
|
|
set(HASH 5b158ead86be4eb3a6780928d9163f8562372f30bde051d8c281d81027b766119a6e9241166b91de0aa6146836cea77e5121290e62e31b7a959407840fc57b33)
|
2017-01-11 11:37:19 +01:00
|
|
|
elseif(VAR MATCHES "7Z")
|
|
|
|
set(PROGNAME 7z)
|
2018-03-30 16:59:59 -07:00
|
|
|
set(PATHS "${PROGRAM_FILES_PLATFORM_BITNESS}/7-Zip" "${PROGRAM_FILES_32_BIT}/7-Zip" "${DOWNLOADS}/tools/7z/Files/7-Zip")
|
2019-07-01 15:31:17 -05:00
|
|
|
set(URL "https://7-zip.org/a/7z1900.msi")
|
|
|
|
set(ARCHIVE "7z1900.msi")
|
|
|
|
set(HASH f73b04e2d9f29d4393fde572dcf3c3f0f6fa27e747e5df292294ab7536ae24c239bf917689d71eb10cc49f6b9a4ace26d7c122ee887d93cc935f268c404e9067)
|
2017-02-03 17:16:13 +01:00
|
|
|
elseif(VAR MATCHES "NINJA")
|
|
|
|
set(PROGNAME ninja)
|
2019-07-02 15:12:47 -07:00
|
|
|
set(SUBDIR "ninja-1.8.2")
|
2018-03-30 16:59:59 -07:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(PATHS "${DOWNLOADS}/tools/ninja/${SUBDIR}")
|
2018-04-24 16:04:14 -07:00
|
|
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
set(PATHS "${DOWNLOADS}/tools/${SUBDIR}-osx")
|
2019-01-08 08:03:35 +08:00
|
|
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
|
|
set(PATHS "${DOWNLOADS}/tools/${SUBDIR}-freebsd")
|
2018-03-30 16:59:59 -07:00
|
|
|
else()
|
2018-04-04 20:58:50 -07:00
|
|
|
set(PATHS "${DOWNLOADS}/tools/${SUBDIR}-linux")
|
2018-03-30 16:59:59 -07:00
|
|
|
endif()
|
2018-03-06 10:07:39 -08:00
|
|
|
set(BREW_PACKAGE_NAME "ninja")
|
|
|
|
set(APT_PACKAGE_NAME "ninja-build")
|
2019-07-02 15:12:47 -07:00
|
|
|
set(URL "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip")
|
|
|
|
set(ARCHIVE "ninja-1.8.2-win.zip")
|
|
|
|
set(HASH 9b9ce248240665fcd6404b989f3b3c27ed9682838225e6dc9b67b551774f251e4ff8a207504f941e7c811e7a8be1945e7bcb94472a335ef15e23a0200a32e6d5)
|
2019-03-14 00:10:11 -07:00
|
|
|
elseif(VAR MATCHES "NUGET")
|
|
|
|
set(PROGNAME nuget)
|
|
|
|
set(PATHS "${DOWNLOADS}/tools/nuget")
|
|
|
|
set(BREW_PACKAGE_NAME "nuget")
|
|
|
|
set(URL "https://dist.nuget.org/win-x86-commandline/v4.8.1/nuget.exe")
|
2019-04-02 15:49:03 -05:00
|
|
|
set(ARCHIVE "nuget.exe")
|
|
|
|
set(NOEXTRACT ON)
|
|
|
|
set(HASH 42cb744338af8decc033a75bce5b4c4df28e102bafc45f9a8ba86d7bc010f5b43ebacae80d7b28c4f85ac900eefc2a349620ae65f27f6ca1c21c53b63b92924b)
|
2017-02-09 18:13:52 +01:00
|
|
|
elseif(VAR MATCHES "MESON")
|
|
|
|
set(PROGNAME meson)
|
|
|
|
set(REQUIRED_INTERPRETER PYTHON3)
|
2018-08-30 05:34:25 +01:00
|
|
|
set(BREW_PACKAGE_NAME "meson")
|
|
|
|
set(APT_PACKAGE_NAME "meson")
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(SCRIPTNAME meson.py)
|
|
|
|
else()
|
|
|
|
set(SCRIPTNAME meson)
|
|
|
|
endif()
|
2019-06-19 22:32:39 +02:00
|
|
|
set(PATHS ${DOWNLOADS}/tools/meson/meson-0.51.0)
|
|
|
|
set(URL "https://github.com/mesonbuild/meson/archive/0.51.0.zip")
|
|
|
|
set(ARCHIVE "meson-0.51.0.zip")
|
|
|
|
set(HASH bf1df65cde7e0e0a44e4b4be7d68de9897a77c4ea4c694f1d77fe82cd3c7e7818dc034a3313ce885ba6883b4ba6d282b7a589f665fa499d9eb79fc7a23e415cc)
|
2017-05-29 09:05:52 +02:00
|
|
|
elseif(VAR MATCHES "FLEX")
|
2018-11-06 17:03:59 -08:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(PROGNAME win_flex)
|
|
|
|
set(SUBDIR win_flex-2.5.16)
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/win_flex/${SUBDIR})
|
|
|
|
set(URL "https://sourceforge.net/projects/winflexbison/files/winflexbison-2.5.16.zip/download")
|
|
|
|
set(ARCHIVE "win_flex_bison-2.5.16.zip")
|
|
|
|
set(HASH 0a14154bff5d998feb23903c46961528f8ccb4464375d5384db8c4a7d230c0c599da9b68e7a32f3217a0a0735742242eaf3769cb4f03e00931af8640250e9123)
|
2019-01-28 15:37:23 -08:00
|
|
|
if(NOT EXISTS "${PATHS}/data/m4sugar/m4sugar.m4")
|
2018-12-17 16:26:56 -08:00
|
|
|
file(REMOVE_RECURSE "${PATHS}")
|
|
|
|
endif()
|
2018-08-22 23:04:20 +02:00
|
|
|
else()
|
|
|
|
set(PROGNAME flex)
|
|
|
|
set(APT_PACKAGE_NAME flex)
|
|
|
|
set(BREW_PACKAGE_NAME flex)
|
|
|
|
endif()
|
2017-05-25 18:04:02 -07:00
|
|
|
elseif(VAR MATCHES "BISON")
|
2018-08-22 23:04:20 +02:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(PROGNAME win_bison)
|
2018-11-06 17:03:59 -08:00
|
|
|
set(SUBDIR win_bison-2.5.16)
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/win_bison/${SUBDIR})
|
|
|
|
set(URL "https://sourceforge.net/projects/winflexbison/files/winflexbison-2.5.16.zip/download")
|
|
|
|
set(ARCHIVE "win_flex_bison-2.5.16.zip")
|
|
|
|
set(HASH 0a14154bff5d998feb23903c46961528f8ccb4464375d5384db8c4a7d230c0c599da9b68e7a32f3217a0a0735742242eaf3769cb4f03e00931af8640250e9123)
|
2019-01-28 15:37:23 -08:00
|
|
|
if(NOT EXISTS "${PATHS}/data/m4sugar/m4sugar.m4")
|
|
|
|
file(REMOVE_RECURSE "${PATHS}")
|
|
|
|
endif()
|
2018-08-22 23:04:20 +02:00
|
|
|
else()
|
|
|
|
set(PROGNAME bison)
|
|
|
|
set(APT_PACKAGE_NAME bison)
|
|
|
|
set(BREW_PACKAGE_NAME bison)
|
|
|
|
endif()
|
2017-05-29 09:05:52 +02:00
|
|
|
elseif(VAR MATCHES "GPERF")
|
|
|
|
set(PROGNAME gperf)
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/gperf/bin)
|
|
|
|
set(URL "https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/gperf-3.0.1-bin.zip/download")
|
|
|
|
set(ARCHIVE "gperf-3.0.1-bin.zip")
|
|
|
|
set(HASH 3f2d3418304390ecd729b85f65240a9e4d204b218345f82ea466ca3d7467789f43d0d2129fcffc18eaad3513f49963e79775b10cc223979540fa2e502fe7d4d9)
|
2017-06-17 11:30:03 -07:00
|
|
|
elseif(VAR MATCHES "GASPREPROCESSOR")
|
|
|
|
set(NOEXTRACT true)
|
|
|
|
set(PROGNAME gas-preprocessor)
|
|
|
|
set(REQUIRED_INTERPRETER PERL)
|
|
|
|
set(SCRIPTNAME "gas-preprocessor.pl")
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/gas-preprocessor)
|
2019-06-07 07:04:28 +08:00
|
|
|
set(URL "https://raw.githubusercontent.com/FFmpeg/gas-preprocessor/cbe88474ec196370161032a3863ec65050f70ba4/gas-preprocessor.pl")
|
2017-06-17 11:30:03 -07:00
|
|
|
set(ARCHIVE "gas-preprocessor.pl")
|
2019-06-07 07:04:28 +08:00
|
|
|
set(HASH f6965875608bf2a3ee337e00c3f16e06cd9b5d10013da600d2a70887e47a7b4668af87b3524acf73dd122475712af831495a613a2128c1adb5fe0b4a11d96cd3)
|
2017-10-03 00:55:54 +09:00
|
|
|
elseif(VAR MATCHES "DARK")
|
|
|
|
set(PROGNAME dark)
|
|
|
|
set(SUBDIR "wix311-binaries")
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/dark/${SUBDIR})
|
|
|
|
set(URL "https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip")
|
|
|
|
set(ARCHIVE "wix311-binaries.zip")
|
|
|
|
set(HASH 74f0fa29b5991ca655e34a9d1000d47d4272e071113fada86727ee943d913177ae96dc3d435eaf494d2158f37560cd4c2c5274176946ebdb17bf2354ced1c516)
|
2017-11-19 11:42:52 +00:00
|
|
|
elseif(VAR MATCHES "SCONS")
|
|
|
|
set(PROGNAME scons)
|
|
|
|
set(REQUIRED_INTERPRETER PYTHON2)
|
|
|
|
set(SCRIPTNAME "scons.py")
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/scons)
|
|
|
|
set(URL "https://sourceforge.net/projects/scons/files/scons-local-3.0.1.zip/download")
|
|
|
|
set(ARCHIVE "scons-local-3.0.1.zip")
|
|
|
|
set(HASH fe121b67b979a4e9580c7f62cfdbe0c243eba62a05b560d6d513ac7f35816d439b26d92fc2d7b7d7241c9ce2a49ea7949455a17587ef53c04a5f5125ac635727)
|
2018-02-24 16:00:51 +08:00
|
|
|
elseif(VAR MATCHES "DOXYGEN")
|
|
|
|
set(PROGNAME doxygen)
|
|
|
|
set(PATHS ${DOWNLOADS}/tools/doxygen)
|
2019-06-01 14:19:32 +08:00
|
|
|
set(URL "http://doxygen.nl/files/doxygen-1.8.15.windows.bin.zip")
|
|
|
|
set(ARCHIVE "doxygen-1.8.15.windows.bin.zip")
|
|
|
|
set(HASH 89482dcb1863d381d47812c985593e736d703931d49994e09c7c03ef67e064115d0222b8de1563a7930404c9bc2d3be323f3d13a01ef18861be584db3d5a953c)
|
2018-03-07 17:57:16 +08:00
|
|
|
# Download Tools
|
|
|
|
elseif(VAR MATCHES "ARIA2")
|
|
|
|
set(PROGNAME aria2c)
|
2019-07-01 15:31:17 -05:00
|
|
|
set(PATHS ${DOWNLOADS}/tools/aria2c/aria2-1.34.0-win-32bit-build1)
|
|
|
|
set(URL "https://github.com/aria2/aria2/releases/download/release-1.34.0/aria2-1.34.0-win-32bit-build1.zip")
|
|
|
|
set(ARCHIVE "aria2-1.34.0-win-32bit-build1.zip")
|
|
|
|
set(HASH 2a5480d503ac6e8203040c7e516a3395028520da05d0ebf3a2d56d5d24ba5d17630e8f318dd4e3cc2094cc4668b90108fb58e8b986b1ffebd429995058063c27)
|
2016-09-18 20:50:08 -07:00
|
|
|
else()
|
|
|
|
message(FATAL "unknown tool ${VAR} -- unable to acquire.")
|
|
|
|
endif()
|
|
|
|
|
2017-02-09 18:13:52 +01:00
|
|
|
macro(do_find)
|
|
|
|
if(NOT DEFINED REQUIRED_INTERPRETER)
|
2017-10-12 11:54:47 -07:00
|
|
|
find_program(${VAR} ${PROGNAME} PATHS ${PATHS})
|
2017-02-09 18:13:52 +01:00
|
|
|
else()
|
|
|
|
vcpkg_find_acquire_program(${REQUIRED_INTERPRETER})
|
2017-06-17 11:30:03 -07:00
|
|
|
find_file(SCRIPT ${SCRIPTNAME} PATHS ${PATHS})
|
|
|
|
set(${VAR} ${${REQUIRED_INTERPRETER}} ${SCRIPT})
|
2017-02-09 18:13:52 +01:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
do_find()
|
2017-10-12 11:54:47 -07:00
|
|
|
if("${${VAR}}" MATCHES "-NOTFOUND")
|
2018-03-06 10:07:39 -08:00
|
|
|
if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
|
|
|
set(EXAMPLE ".")
|
|
|
|
if(DEFINED BREW_PACKAGE_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
set(EXAMPLE ":\n brew install ${BREW_PACKAGE_NAME}")
|
|
|
|
elseif(DEFINED APT_PACKAGE_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set(EXAMPLE ":\n sudo apt-get install ${APT_PACKAGE_NAME}")
|
|
|
|
endif()
|
|
|
|
message(FATAL_ERROR "Could not find ${PROGNAME}. Please install it via your package manager${EXAMPLE}")
|
|
|
|
endif()
|
|
|
|
|
2017-11-02 18:54:34 -07:00
|
|
|
vcpkg_download_distfile(ARCHIVE_PATH
|
|
|
|
URLS ${URL}
|
|
|
|
SHA512 ${HASH}
|
|
|
|
FILENAME ${ARCHIVE}
|
2016-09-18 20:50:08 -07:00
|
|
|
)
|
2017-11-02 18:54:34 -07:00
|
|
|
|
2018-04-04 20:56:55 -07:00
|
|
|
set(PROG_PATH_SUBDIR "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}")
|
|
|
|
file(MAKE_DIRECTORY ${PROG_PATH_SUBDIR})
|
2016-09-18 20:50:08 -07:00
|
|
|
if(DEFINED NOEXTRACT)
|
2018-03-26 17:21:46 -07:00
|
|
|
if(DEFINED _vfa_RENAME)
|
2018-04-04 20:56:55 -07:00
|
|
|
file(INSTALL ${ARCHIVE_PATH} DESTINATION ${PROG_PATH_SUBDIR} RENAME ${_vfa_RENAME})
|
2018-03-26 17:21:46 -07:00
|
|
|
else()
|
2018-04-04 20:56:55 -07:00
|
|
|
file(COPY ${ARCHIVE_PATH} DESTINATION ${PROG_PATH_SUBDIR})
|
2018-03-26 17:21:46 -07:00
|
|
|
endif()
|
2016-09-18 20:50:08 -07:00
|
|
|
else()
|
2017-01-11 11:37:19 +01:00
|
|
|
get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT)
|
|
|
|
string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION)
|
2017-10-12 08:22:50 -07:00
|
|
|
if(ARCHIVE_EXTENSION STREQUAL ".msi")
|
2017-11-02 18:54:34 -07:00
|
|
|
file(TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH)
|
2018-04-04 20:56:55 -07:00
|
|
|
file(TO_NATIVE_PATH "${PROG_PATH_SUBDIR}" DESTINATION_NATIVE_PATH)
|
2017-01-11 11:37:19 +01:00
|
|
|
execute_process(
|
|
|
|
COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH}
|
|
|
|
WORKING_DIRECTORY ${DOWNLOADS}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
execute_process(
|
2017-11-02 18:54:34 -07:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH}
|
2018-04-04 20:56:55 -07:00
|
|
|
WORKING_DIRECTORY ${PROG_PATH_SUBDIR}
|
2017-01-11 11:37:19 +01:00
|
|
|
)
|
|
|
|
endif()
|
2016-09-18 20:50:08 -07:00
|
|
|
endif()
|
|
|
|
|
2019-07-02 22:47:50 +02:00
|
|
|
if(DEFINED POST_INSTALL_COMMAND)
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${POST_INSTALL_COMMAND}
|
|
|
|
WORKING_DIRECTORY ${PROG_PATH_SUBDIR}
|
|
|
|
LOGNAME ${VAR}-tool-post-install
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2017-02-09 18:13:52 +01:00
|
|
|
do_find()
|
2016-09-18 20:50:08 -07:00
|
|
|
endif()
|
|
|
|
|
2017-10-12 11:54:47 -07:00
|
|
|
set(${VAR} "${${VAR}}" PARENT_SCOPE)
|
2016-09-18 20:50:08 -07:00
|
|
|
endfunction()
|