windowsvisual-c++visual-studio-2008build-script

VS2008 build solution script with VC++ include and library folder


I am trying to create build script with VS2008

call "%VS90COMNTOOLS%vsvars32.bat" > NUL
echo working on my_solution.sln...
devenv "my_solution.sln" /build "%Release|win32" /out "make.log"

The thing is that I want to add VC++ include file folder and library folder in script, not in solution config because in other PCs, these folders may be located in different place.

Anyone has any idea?


Solution

  • Short answer: use environment variables.

    Before invoking devenv, extend the INCLUDE and LIB environment variables:

    call "%VS90COMNTOOLS%vsvars32.bat" > NUL
    echo working on my_solution.sln...
    
    SET INCLUDE=%INCLUDE%;d:\your\path\to\your\include\folder
    SET LIB=%LIB%;d:\your\path\to\your\lib\folder
    
    devenv "my_solution.sln" /build "%Release|win32" /out "make.log"
    

    Alternately you could also do this:

    Update the solution to reference %MY_PRIVATE_INCLUDE% and %MY_PRIVATE_LIB% as additional directories in the solution's Include and Link settings. Then just assign these values at build time.

    call "%VS90COMNTOOLS%vsvars32.bat" > NUL
    echo working on my_solution.sln...
    
    SET MY_PRIVATE_INCLUDE=d:\your\path\to\your\include\folder
    SET MY_PRIVATE_LIB=%LIB%;d:\your\path\to\your\lib\folder
    
    devenv "my_solution.sln" /build "%Release|win32" /out "make.log"