link_libraries — CMake 3.24.4 Documentation (original) (raw)

Link libraries to all targets added later.

link_libraries([item1 [item2 [...]]] [[debug|optimized|general] ] ...)

Specify libraries or flags to use when linking any targets created later in the current directory or below by commands such as add_executable()or add_library(). See the target_link_libraries() command for meaning of arguments.

Note

The target_link_libraries() command should be preferred whenever possible. Library dependencies are chained automatically, so directory-wide specification of link libraries is rarely needed.