CMake: Correct inter-module dependencies and library visibility

Modules didn't correctly define their dependencies before, which relied
on the frontends implicitly including every module for linking to
succeed.

Also changed every target_link_libraries call to specify visibility of
dependencies to avoid leaking definitions to dependents when not
necessary.
This commit is contained in:
Yuri Kunde Schlesner 2017-05-27 18:26:55 -07:00
parent c201307b74
commit b78ce2bce5
8 changed files with 27 additions and 23 deletions

View file

@ -19,9 +19,9 @@ endif()
create_directory_groups(${SRCS} ${HEADERS})
add_library(input_common STATIC ${SRCS} ${HEADERS})
target_link_libraries(input_common common core)
target_link_libraries(input_common PUBLIC core PRIVATE common)
if(SDL2_FOUND)
target_link_libraries(input_common ${SDL2_LIBRARY})
set_property(TARGET input_common APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2)
target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY})
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
endif()