cmake-gui shows that the library was found (the expected absolute filename).
So I added that variable to target_link_libraries, but it results in a
linker error:
make[2]: *** No rule exists to create the target ".../linuxcnc",
required by "myTarget".
Well, the real name of that library is “liblinuxcnc.a” - which cmake-gui shows
as content of LIB_LC. Don’t know, why the linker tries to link the wrong name.
Hello !
I think I’m facing the same issue : have you checked the command line generated by CMake ?
If you run it manually, does it works ?
If you change …/linuxcnc by -L… -llinuxcnc, does it works ?
I’m new to cmake, so naturally I’m doing stupid things. But I’m working on
that item.
I have several shared libs and whatever I tried, I got the same error. It took
me a while, then I knew that the errors where not related to the error
messages.
I removed anything that was related to that name form that subproject, deleted
the cache but the error message stayed the same.
So I thought, may be, some other subprojects create cache definitions, that
break the plugin I was working on.
So I removed every definition related to that external project from every
subproject and started writing new rules for each of them.
Now the subprojects link successfully using the variable name from find_library
statement.
I had written the right code to add the library to plugins target libs. Only
because I mistakenly duplicated the library search in every cmake-file, I got
an error message that led me astray.
There’s too much of cmake I don’t understand.
Meanwhile I reduced duplicate code, so that the find_ statements are in
toplevel CMakeLists.txt only.