Visual Studio Pre build events and batch set
Posted
by
helloworld922
on Stack Overflow
See other posts from Stack Overflow
or by helloworld922
Published on 2010-12-30T17:56:32Z
Indexed on
2010/12/31
17:53 UTC
Read the original article
Hit count: 313
Hi, I'm trying to create call a batch file which sets a bunch of environment variables prior to building.
The batch file looks something like this (it's automatically generated before-hand to detect ATI Stream SDK or NVidia CUDA toolkit):
set OCL_LIBS_X86="%ATISTREAMSDKROOT%libs\x86"
set OCL_LIBS_X64="%ATISTREAMSDKROOT%libs\x86_64"
set OCL_INCLUDE="%ATISTREAMSDKROOT%include"
However, the rest of the build doesn't seem to have access to these variables, so when I try to reference $(OCL_INCLUDE) in the C/C++>General>Additional include directories, it will first give me warning that environment variable $(OCL_INCLUDE) was not found, and when I try to include CL/cl.hpp the compile will fail with:
fatal error C1083: Cannot open include file: 'CL/cl.hpp': No such file or directory
I know that I could put these variables into the registry if I wanted to access them from the visual studio GUI, but I would really prefer not to do this. Is there a way to to get these environment variables to stick after the pre-build events? I can't reference $(ATISTREAMSDKROOT) directly because the project must be able to build for both ATI Stream and NVidia Cuda.
© Stack Overflow or respective owner