link library to all targets in cmake project -
let me describe think sufficiently common use case, should supported. consider project consists of library , set of executable use library. straightforward approach add_library, followed sequence of add_executable() target_link_lib() pairs.
this lot of boilerplate coding. nice able set(project_link_libs, lib1 ...), , have cmake remove boilerplate.
thinking on more, realize link_libraries function behaves include_directories. argue this:
- would useful in lot of cases.
- would lead dryer cmakelists.
- would encourage better code organizations -- there natural incentive organize folders, code, , executables in such way executables have same dependancies -- clean practice.
is there this?
it appears cmake_standard_libraries
variable exists, can append libraries according need. however, variable seemingly expect full path libraries.
see here.
Comments
Post a Comment