Wojciech Jarosz wrote:
> I am writing a confidence test which needs to read some asset files. In
> order to tell the test where these files are located I do the following
> within the test's CMakeLists.txt:
> ADD_DEFINITIONS(-DRB_DATA_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\")
> 
> Within the test code I then ensure that this define works properly like so:
> #define STRINGIZE(a) DO_STRINGIZE(a)
> #define DO_STRINGIZE(a) # a
> ...
> cout << "RB_DATA_DIR = " << STRINGIZE(RB_DATA_DIR) << endl;
> 
> This works fine on linux, however on Windows it returns:
> RB_DATA_DIR = "C,ocuments and Settings/wjarosz/My Documents/Visual
> Studio 2005/Projects/gfx/VMULTest/"
> 
> Sure enough, checking the Preprocessor Definitions line within the
> generated Project, I see:
> "RB_DATA_DIR=\"C","ocuments and Settings/wjarosz/My Documents/Visual
> Studio 2005/Projects/gfx/VMULTest/\"",
> 
> What is the proper way to pass paths using the preprocessor with CMake?

In order to reliably pass non-trivial strings this bug needs fixing:

http://www.cmake.org/Bug/bug.php?op=show&bugid=3664

However, the suggested way to pass paths is to configure them into a
header file with CONFIGURE_FILE and then #include the header in your code.

-Brad

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to