#cmake project structure

2 messages · Page 1 of 1 (latest)

heavy ibex
#

Hey there,
Hopefully this is the right place to ask a question like this.

I have the following folder structure:
root
|-thirdparty
| |-lib1
| |-lib2
|
|-Backend
| |-random classes such as window
|
|-app.h
|-app.cpp
|-other files

The problem I'm facing is that classes from the backend folder depend on (lets say) lib1, but lib1 is only linked with the root project, so i get a linking error. Currently my cmake setup is the following:
root cmake:
project(name)
add_subdirectory(thirdparty/lib1)
add_subdirectory(thirdparty/lib2)
add_subdirectory(backend)
add_executable(name files.cpp files.h)
target_link_libraries(name bacend_sources GivenLib1Name GivenLib2Name)

backend cmake:
add_library(backend sources.cpp sources.h)

thirdparty/lib1 and lib2 have their own cmake files that i havent touched.

How could I make sure that backend sees lib1/lib2?

true scarabBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.