Pablo Burgos
Pablo Burgos

Reputation: 1254

Using Environment Variables in command line using cmake

I'm building some code using cmake on windows 7:

mkdir build
cd build
cmake -G "Visual Studio 8 2005" -DZLIB_INCLUDE_DIR:PATH="..\..\ZLib\Include"  -DZLIB_LIBRARY:FILEPATH="..\..\ZLib\bin\vs_v8\win32\ZLibRel.lib"..

All ok....

But now I want to set the path to ZLIb using an environment variable, something like:

cmake -G "Visual Studio 8 2005" -DZLIB_INCLUDE_DIR:PATH="$Env{Base}\ZLib\Include"  -DZLIB_LIBRARY:FILEPATH="$Env{Base}\ZLib\bin\vs_v8\win32\ZLibRel.lib"..

How can I do that from the command line using cmake?

Upvotes: 0

Views: 1848

Answers (1)

Fraser
Fraser

Reputation: 78428

You need to expand the environment variable in the command line args:

cmake -G "Visual Studio 8 2005" -DZLIB_INCLUDE_DIR:PATH="%Base%\ZLib\Include" -DZLIB_LIBRARY:FILEPATH="%Base%\ZLib\bin\vs_v8\win32\ZLibRel.lib" ..

Upvotes: 2

Related Questions