[CMake] [CTest] Access test data from c++ code
Tyler Roscoe
tyler at cryptio.net
Tue Nov 3 11:03:18 EST 2009
On Tue, Nov 03, 2009 at 04:59:22PM +0100, Thomas wrote:
> I want to write a test, that needs pregenerated test data. What is the
> correct way to access and store it?
>
> My idea is to put it into the source tree like:
>
> File structure:
> /mylib/<library files>
> /mylib/test/CMakeLists.txt
> /mylib/test/data.txt <- pregenerated test data
> /mylib/test/test.cpp
>
> In CMakeLists.txt:
> add_definitions(-DTEST_PATH=${CMAKE_CURRENT_SOURCE_DIR})
>
> In C++ (test.cpp):
> string testPath = TEST_PATH;
This looks reasonable. Did you try it to see if it works? What's your
question, exactly?
tyler
More information about the CMake
mailing list