[CMake] Problem with CTest and adding subdirectory

Eric Noulard eric.noulard at gmail.com
Tue May 26 08:33:40 EDT 2009


2009/5/26 Robert Matusewicz <matekm at gmail.com>:
> Hi all!
> We are using Cmake and CTest in our project: OpenImageIO and have a liitle
> problem.
> We have project tree that looks like belowe:
> * project
> **** testsuit
> **** src
> ****** test1
> ****** test2
> And then, in CmakeList.txt we have something like that:
> include (CTest)
> add_subdirectory (test1)
> add_subdirectory (test2)
> add_subdirectory (testsuite)
> Because we add directory testusite - we have error "add_subdirectory source
> testsuite wchich is not an existing directory.

I guess your CmakeList.txt is in project/src and not in project/ ?

> Is there any way to add testsuite? We could bypass this problem by making
> symlink, but we don't want to do that. Any idea?

I think that if you have CMakeLists.txt in project/

 include (CTest)
add_subdirectory (src/test1)
add_subdirectory (src/test2)
add_subdirectory (testsuite)

should work.

or you may split your CMakeLists.txt and have:

project/CMakeLists.txt

include (CTest)
add_subdirectory (src)
add_subdirectory (testsuite)

project/src/CMakeLists.txt
add_subdirectory(test1)
add_subdirectory(test2)


-- 
Erk


More information about the CMake mailing list