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,
--

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

Reply via email to