Re: [CMake] Splitting in multiple directories
Yes, it was add_subirectory. I tried once more after cleaning up the CMakeList.txt and now it worksI must have ad some spurious settings generating the error. Thanks, Michele Le 13/07/2016 à 22:48, Alexander Neundorf a écrit : On Tuesday 12 July 2016 09:00:43 portolan wrote: 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: --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 I guess you mean add_subdirectory() ? 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-de vel/cmake_debug:/home/michele/mast-devel/cmake_debug/Logger I tried using find_library, but I always get not-found what's the error message ? Posting relevant bits of your CMakeLists.txt (related to subdirs, creating targets and linking) would be helpful too. Alex -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Splitting in multiple directories
On Tuesday 12 July 2016 09:00:43 portolan wrote: > 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: > > --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 I guess you mean add_subdirectory() ? > 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-de > vel/cmake_debug:/home/michele/mast-devel/cmake_debug/Logger > > I tried using find_library, but I always get not-found what's the error message ? Posting relevant bits of your CMakeLists.txt (related to subdirs, creating targets and linking) would be helpful too. Alex -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Splitting in multiple directories
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: --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 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake