From 8c423d9747bb1c0768d2d0360245de954e7b3656 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 23 Apr 2014 16:50:04 -0700 Subject: [PATCH] Add a script to configure build environment and run CMake when building with Microsoft SDK toolchain. --- cmake/FindSetEnv.cmake | 7 +++++++ cmake/run-cmake.bat | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 cmake/FindSetEnv.cmake create mode 100644 cmake/run-cmake.bat diff --git a/cmake/FindSetEnv.cmake b/cmake/FindSetEnv.cmake new file mode 100644 index 00000000..4e2da540 --- /dev/null +++ b/cmake/FindSetEnv.cmake @@ -0,0 +1,7 @@ +# A CMake script to find SetEnv.cmd. + +find_program(WINSDK_SETENV NAMES SetEnv.cmd + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/bin") +if (WINSDK_SETENV AND PRINT_PATH) + execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${WINSDK_SETENV}") +endif () diff --git a/cmake/run-cmake.bat b/cmake/run-cmake.bat new file mode 100644 index 00000000..f18bb055 --- /dev/null +++ b/cmake/run-cmake.bat @@ -0,0 +1,11 @@ +@echo on +rem This scripts configures build environment and runs CMake. +rem Use it instead of running CMake directly when building with +rem the Microsoft SDK toolchain rather than Visual Studio. +rem It is used in the same way as cmake, for example: +rem +rem run-cmake -G "Visual Studio 10 Win64" . + +for /F "delims=" %%i IN ('cmake "-DPRINT_PATH=1" -P %~dp0/FindSetEnv.cmake') DO set setenv=%%i +if NOT "%setenv%" == "" call "%setenv%" +cmake %*