target_link_libraries
时间: 2023-10-09 09:16:09 浏览: 87
target_link_libraries is a CMake function used to specify the libraries that a target (such as an executable or a library) depends on. The function takes two arguments: the target name and the list of libraries to link against.
For example, to link against the standard math library, the function call would look like this:
```
target_link_libraries(my_target_name m)
```
Here, "my_target_name" is the name of the target to link against and "m" is the name of the math library.
The function can also be used to specify multiple libraries, as shown below:
```
target_link_libraries(my_target_name lib1 lib2 lib3)
```
Here, "lib1", "lib2", and "lib3" are the names of the libraries that the target depends on.
The target_link_libraries function is typically used in the CMakeLists.txt file of a project to specify the libraries that need to be linked against when building the project.
阅读全文