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:

  1. would useful in lot of cases.
  2. would lead dryer cmakelists.
  3. 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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -