Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why variables are not accessed inside script in CMake?

Tags:

I have a script called "install_copy_dlls.cmake", which is called to execute from top level cmake file as shown below.

INSTALL(SCRIPT "install_copy_dlls.cmake")

And, I have a variable named "USE_OSG_STATIC" which is set to ON if I use Statically compiled OpenSceneGraph and set of OFF if I use Dynamically compiled OpenSceneGraph.

I need to use this variable inside install_copy_dlls.cmake script.

so, here is how install_copy_dlls.cmake file should look like.

copy other required dlls...

if(NOT USE_OSG_STATIC) //if dynamic OSG

copy osg dlls

here, I try to use "message" to print USE_OSG_STATIC variable and it doesn't print anything.

Can anyone explain me why I can not use variables in Script file?