Closed andersc closed 5 months ago
Hello, thanks for this suggestion!
However, I'm not sure if this is really needed. Because what you are trying to do:
add_library(tstlib STATIC)
target_sources(tstlib PRIVATE librarytest.cpp)
add_library(tstlib2 STATIC)
target_sources(tstlib2 PRIVATE librarytest2.cpp)
SET(HELLO_IMGUI_LINK_LIBRARIES tstlib tstlib2)
hello_imgui_add_app(hello_world main.cpp)
Could be rewritten as:
add_library(tstlib STATIC)
target_sources(tstlib PRIVATE librarytest.cpp)
add_library(tstlib2 STATIC)
target_sources(tstlib2 PRIVATE librarytest2.cpp)
hello_imgui_add_app(hello_world main.cpp)
# Added this
target_link_libraries(hello_world PRIVATE tstlib tstlib2)
Would that be enough for you?
Or, if you have many many executable to generate and you are looking for a way to avoid having add the link manually for all of the executables? If so you could write a function with the same signature as hello_imgui_add_app, which would call hello_imgui_add_app and then add the link for the additional libraries.
Am I missing something? Is there another reason why this might be needed?
Hi.
Works for me and is more 'clean'.
/A
Unsure if this is an OK way to include libraries to be linked or if there is another preferred way. Did not update the documentation as I felt it was showing the minimal needed cmake config.
Did test like this ->
Where main.cpp calls some public methods in tstlib and tstlib2