From beb1250fe486cfdd11ee003cb9a2d7faeb4bf9da Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 24 Feb 2017 15:02:10 -0800 Subject: [PATCH] Improve functions that detect ProgramFiles in CMake --- scripts/cmake/vcpkg_get_program_files_32_bit.cmake | 11 +++++++---- .../vcpkg_get_program_files_platform_bitness.cmake | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/cmake/vcpkg_get_program_files_32_bit.cmake b/scripts/cmake/vcpkg_get_program_files_32_bit.cmake index 386e59c7599..6f434547399 100644 --- a/scripts/cmake/vcpkg_get_program_files_32_bit.cmake +++ b/scripts/cmake/vcpkg_get_program_files_32_bit.cmake @@ -1,7 +1,10 @@ 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) + + set(ret_temp $ENV{ProgramFiles\(X86\)}) + if (NOT DEFINED ret_temp) + set(ret_temp $ENV{PROGRAMFILES}) endif() + + set(${ret} ${ret_temp} PARENT_SCOPE) + endfunction() \ No newline at end of file diff --git a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake index 44fba4d6280..ed51b74010a 100644 --- a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake +++ b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake @@ -1,7 +1,10 @@ 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) + + set(ret_temp $ENV{ProgramW6432}) + if (NOT DEFINED ret_temp) + set(ret_temp $ENV{PROGRAMFILES}) endif() + + set(${ret} ${ret_temp} PARENT_SCOPE) + endfunction() \ No newline at end of file