Add functions to find Program Files folders on the CMake side

This commit is contained in:
Alexander Karatarakis 2017-02-14 17:29:47 -08:00
parent a9a63192dd
commit da26d09716
5 changed files with 22 additions and 8 deletions

View File

@ -10,13 +10,8 @@ vcpkg_download_distfile(SDK_ARCHIVE
### Check for correct version of installed redistributable package
# We always want the ProgramFiles folder even on a 64-bit machine (not the ProgramFilesx86 folder)
# The following makes sure both 32-bit and 64-bit processes get the correct ProgramFiles
if(DEFINED ENV{ProgramW6432})
set(PROGRAM_FILES_FOLDER $ENV{ProgramW6432})
else()
set(PROGRAM_FILES_FOLDER $ENV{PROGRAMFILES})
endif()
set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_FOLDER}/Microsoft MPI/Bin/mpiexec.exe")
vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS)
set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_PLATFORM_BITNESS}/Microsoft MPI/Bin/mpiexec.exe")
set(MSMPI_EXPECTED_FULL_VERSION "8.0.12438.0")
if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH})

View File

@ -14,3 +14,5 @@ include(vcpkg_configure_qmake)
include(vcpkg_apply_patches)
include(vcpkg_copy_pdbs)
include(vcpkg_copy_tool_dependencies)
include(vcpkg_get_program_files_32_bit)
include(vcpkg_get_program_files_platform_bitness)

View File

@ -7,6 +7,9 @@ function(vcpkg_find_acquire_program VAR)
unset(SUBDIR)
unset(REQUIRED_INTERPRETER)
vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS)
vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT)
if(VAR MATCHES "PERL")
set(PROGNAME perl)
set(PATHS ${DOWNLOADS}/tools/perl/perl/bin)
@ -61,7 +64,7 @@ function(vcpkg_find_acquire_program VAR)
set(HASH 23a26dc7e29979bec5dcd3bfcabf76397b93ace64f5d46f2254d6420158bac5eff1c1a8454e3427e7a2fe2c233c5f2cffc87b376772399e12e40b51be2c065f4)
elseif(VAR MATCHES "7Z")
set(PROGNAME 7z)
set(PATHS "C:/Program Files/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip)
set(PATHS "${PROGRAM_FILES_PLATFORM_BITNESS}/7-Zip" "${PROGRAM_FILES_32_BIT}/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip)
set(URL "http://7-zip.org/a/7z1604.msi")
set(ARCHIVE "7z1604.msi")
set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d)

View File

@ -0,0 +1,7 @@
function(vcpkg_get_program_files_32_bit ret)
if(DEFINED ENV{ProgramFiles\(X86\)})
set(${ret} $ENV{ProgramFiles\(X86\)} PARENT_SCOPE)
else()
set(${ret} $ENV{PROGRAMFILES} PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,7 @@
function(vcpkg_get_program_files_platform_bitness ret)
if(DEFINED ENV{ProgramW6432})
set(${ret} $ENV{ProgramW6432} PARENT_SCOPE)
else()
set(${ret} $ENV{PROGRAMFILES} PARENT_SCOPE)
endif()
endfunction()