Contact Form

Name

Email *

Message *

Cari Blog Ini

Target_link_libraries Full Path

CMake: Full Paths to Library Files

Intermediate Imported Library

To create an intermediate imported library, use IMPORTED_LOCATION (see CMake documentation for details). This allows you to specify a full path to a library file.

Generated Link Line

The generated link line typically preserves the full path to the file. It will include the full path to the linkable library file associated with the target.

Quoted and Escaped Paths

The full path to the target's artifact is automatically quoted and escaped for the shell.

find_library Command

The find_library command provides the full path, which can generally be used directly in calls to link against the library. The path can also include flags for the linker, such as -l for dynamic libraries.

Example

 find_library(MY_LIBRARY NAMES my_library PATHS /path/to/libraries) target_link_libraries(my_target ${MY_LIBRARY}) 


Comments