Added documentation for static and shared linking suffixes

This commit is contained in:
Nicholaus Clark 2022-02-24 10:32:11 -06:00
parent d9b93c4133
commit a6686e021d

View File

@ -59,6 +59,19 @@ filter { "system:macosx" }
files "**.cpp"
```
You may specify the linking mechanism explicitly for each library. To set the link type of a library explicitly, add a `:static` or `:shared` suffix to the library. Note that this functionality is only available for the `gcc` and `clang` toolsets.
```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
language "C++"
project "MyExecutable"
kind "ConsoleApp"
files "**.cpp"
links { "LibraryA:static", "LibraryB:shared" }
```
You may also create links between non-library projects. In this case, Premake will generate a build dependency (the linked project will build first), but not an actual link. In this example, MyProject uses a build dependency to ensure that MyTool gets built first. It then uses MyTool as part of its build process.
```lua