CMAKE_LINK_FLAGS
时间: 2023-08-30 10:11:02 浏览: 233
CMAKE_LINK_FLAGS is a CMake variable that specifies the linker flags for the project. These flags are used during the linking phase of the build process to specify options for the linker. Examples of linker flags include:
- `-L<path>`: Specifies a directory to search for libraries.
- `-l<library>`: Specifies a library to link against.
- `-static`: Forces the linker to link against static libraries instead of shared libraries.
- `-Wl,<option>`: Specifies an option to be passed to the linker. This is useful for passing platform-specific options.
To set linker flags using CMake, you can use the `set` command to assign a value to the `CMAKE_LINK_FLAGS` variable. For example:
```
set(CMAKE_LINK_FLAGS "-L/path/to/lib -lmylib")
```
This would set the linker flags to search for libraries in the "/path/to/lib" directory and link against the "mylib" library.
阅读全文