Hello folks,<br>since I am very new to cmake, it is sometimes difficult for me to understand how things work here.<br>e.g. I have difficulties to access already created libraries in a subdirectory.<br>Here is the structure of my project:<br>
<br>root<br> src<br> core<br> tests<br> core<br><br>Every directory contains a CMakeLists.txt.<br><br>Here some excerpts:<br><br><b><u>root:</u></b><br>add_subdirectory(src)<br><br><u><b>root/src:</b></u><br>add_subdirectory(core)<br>
<br><u><b>root/src/core:</b></u><br>FILE(GLOB srcs_cpp ./*.cpp)<br>ADD_LIBRARY(corelib ${srcs_cpp})<br><br><u><b>rot/tests/core:</b></u><br>FILE(GLOB srcs_cpp ./*.cpp)<br>ADD_EXECUTABLE(core_test_suite ${srcs_cpp})<br>ADD_DEPENDENCIES(core_test_suite corelib)<br>
<br>The bad result is that the linker throws an "<i>undefined reference" </i>error while trying to link to a class found in library <b>core</b>.<br><i>undefined reference to `viseval::core::CMatlabVector::CMatlabVector</i><br>
<br>I ran some tests on variables and found out that:<br>if in <b>root/src/core</b> I use <br>SET(VAR1 "somevalue")<br>then I cannot access it in root or any other structures using<br>MESSAGE(STATUS "VAR1=${VAR})<br>
<br>How can i solve the problem? is this a bug or didnt I understand something?<br><br>thanks a lot to all ideas and hints!<br><br>Regards<br>Eugen<br><br><br>