[CMake] Splitting in multiple directories

portolan michele.portolan at imag.fr
Tue Jul 12 03:00:43 EDT 2016


Hello,

I am new to Cmake and I have a pretty strange behaviour: I set my c+++ 
project to work with a single CMakefile.txt, and now I am trying to have 
a more proper version with a .txt for each subdirectory

Pretty normal stuff, my source tree is:

<root> --Lib                (my sources)

              --Logger   (as the name says, a logger)

             --Lib_UT  (Unitary tests for CxxTest)

             --Lib_UT_Runner      (the Cxx-generated test runner)


I have a Lib_UT/CMakefile.txt and Lib_UT_Runner/CMakefile.txt, I call 
them using include_directory(Lib_UT) and 
include_directory(Lib_UT_Runner) and everything is fine (apart from the 
runner executable being in a different directory)

BUT is I do the same for the logger, Lib_UT_Runner has a linking error 
where it cannot link to LibLogger.so. But the shared library is 
correctly generated and it is on the command line :

/usr/bin/c++      -lpthread CMakeFiles/Lib_UT_Runner.dir/Runner.cpp.o  
-o Lib_UT_Runner ../Lib_UT/libLib_UT.so ../libLib.so ../libLogger.so 
-lpthread 
-Wl,-rpath,/home/michele/mast-devel/cmake_debug/Lib_UT:/home/michele/mast-devel/cmake_debug:/home/michele/mast-devel/cmake_debug/Logger

I tried using find_library, but I always get not-found

What am I missing?

Regards,

Michele


More information about the CMake mailing list