I'll describe how my CMake project is currently arranged. It's early, so suggestions for a better arrangement are welcome.
App depends on Lib1 Lib1 depends on Lib2 Lib2 uses Qt
folder structure:
- top-level
- Lib1
- Lib2
- App
- Lib1
I have CMakeLists.txt at each level.
In Lib1 I add_library (STATIC), then target_link_library with Lib2 which is also STATIC.
Lib2's CMakeLists.txt does the find_package calls for Qt5Widgets, Qt5Core, and Qt5Gui.
Finally, App's CMakeLists.txt does the add_executable followed by target_link_libraries for Lib1.
Everything compiles and links until I actually make a call in the App code to use a function in Lib2. Then I get a bunch of unresolved symbol linker errors pointing to functions from Lib2. It doesn't seem to matter if I make Lib2 an OBJECT library and change the linking in Lib1 accordingly. I've also tried linking App against both Lib1 and Lib2 with the same results.
What am I doing wrong here?