[CMake] include directories
Tom Deblauwe
tom.deblauwe at traficon.com
Wed Dec 28 04:31:23 EST 2011
Hello,
I have the following project structure:
framework1/inc/lib1 <- public headers
framework1/inc/lib2 <- public headers
framework1/libs/lib1/ <- CMakeLists.txt
framework1/libs/lib1/src <- implementation source+headers
framework1/libs/lib2/ <- CMakeLists.txt
framework1/libs/lib2/src <- implementation source+headers
framework1/tests/lib1/ <- CMakeLists.txt
framework1/tests/lib1/src <- unittest for lib1
framework1/tests/lib2/ <- CMakeLists.txt
framework1/tests/lib2/src <- unittest for lib2
In the cmakelists.txt in "framework1/libs/lib1" I do an
"add_subdirectory(../../tests/lib1)" and also the add_test(). This works
great. But the unittest has to do an
"include_directory(../../tests/lib1/src)" so that the unittest can use
the private implementation headers. This also works great.
But the problem comes when someone want to use the lib1: it
automatically adds the unittest, which adds the include of the private
implementation src and this is not good because when someone wants to
use the lib1 he should only have the public include dir
"framework1/inc/lib1" and have the extra "framework1/tests/lib1/src" as
include directory. How can I solve this?
Best regards,
Tom,
More information about the CMake
mailing list