[CMake] Pass value from CMake to source file?

motes motes mort.motes at gmail.com
Sun Oct 4 05:17:58 EDT 2009


Is it possible to send a user specified path from CMake to the final
application (make it visible)? Depending on which machine I build my
application on the path to some images may vary. I was therefore
thinking to specify this path when building with CMake like:

FIND_PATH(IMAGE_DIR REQUIRED)

and then in my application do:


#include<string>
int main(){

   std::string img0 = IMAGE_DIR + "image0.png";
   return 0;

}

But this does not work. Any ideas?


More information about the CMake mailing list