Skip to content

Commit

Permalink
Add find_setenv function to find SetEnv.cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Aug 26, 2014
1 parent b6d9b19 commit 03b2932
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions support/cmake/init.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# CMake initialization code that should be run before the project command.

if (ARGS)
# Run CMake in a Microsoft SDK build environment.
function (find_setenv var)
set(winsdk_key
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows")
find_program(WINSDK_SETENV NAMES SetEnv.cmd
find_program(setenv NAMES SetEnv.cmd
PATHS "[${winsdk_key};CurrentInstallFolder]/bin")
set(${var} ${setenv} PARENT_SCOPE)
endfunction ()

if (ARGS)
# Run CMake in a Microsoft SDK build environment.
find_setenv(WINSDK_SETENV)
if (WINSDK_SETENV)
if (NOT ARGS MATCHES Win64)
set(setenv_arg "/x86")
Expand Down

0 comments on commit 03b2932

Please sign in to comment.