[CMake] [CTest] relative path in create_test_sourcelist

David Cole david.cole at kitware.com
Fri Feb 26 12:57:22 EST 2010


You could do:
get_filename_component(dir "${CMAKE_CURRENT_SOURCE_DIR}/../src" ABSOLUTE)

and then use:
${dir}/testTest.cpp

Does that work?


2010/2/26 Raphaël M. <latcho.dives at gmail.com>

> Hello,
>
> I'm starting to use CTest and having some trouble generating the test
> driver.
>
> Here is the cmake commands I'm using :
>
> create_test_sourcelist (Tests_src
>  TestSuite.cpp
> ../src/testTest.cpp
> )
>
> My directory structure is
>
> LoggerTest/
>     - build/
>         -CMakeLists.txt
>     - inc/
>     - src/
>          testTest.cpp   (which contains int testTest(int argc, char*[]
> argv) )
>
> When I run 'cmake .'  it generates a file called TestSuite.cpp which
> doesn't compile when I then run "make"
>
> The reason is that cmake generated a function prototype like this :
>
> /* Forward declare test functions. */
> int .._src_testTest(int, char*[]);
>
>
> (Obviously, I tested putting the CMakeLists.txt and the source files in one
> same directory, and it works, but I don't think that's an elegant solution)
>
> Does anyone have a clean solution to fix this issue and keep the
> CMakeLists.txt in a separate folder than the source files ?
>
> Thanks a lot,
>
> Raphaël Mor
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100226/ddd5cd13/attachment.htm>


More information about the CMake mailing list