diff options
-rw-r--r-- | README.md | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -29,6 +29,19 @@ find_package(dlfcn-win32 REQUIRED) | |||
29 | target_link_libraries(<target> dlfcn-win32::dl) | 29 | target_link_libraries(<target> dlfcn-win32::dl) |
30 | ... | 30 | ... |
31 | ~~~ | 31 | ~~~ |
32 | If you want to use this library in a cross-platform project, a convenient way | ||
33 | to proceed is to define the CMake variable [`CMAKE_DL_LIBS`](https://cmake.org/cmake/help/latest/variable/CMAKE_DL_LIBS.html) | ||
34 | (that is normally empty on Windows) and then use it for linking: | ||
35 | ~~~ | ||
36 | ... | ||
37 | if (WIN32) | ||
38 | find_package(dlfcn-win32 REQUIRED) | ||
39 | set(CMAKE_DL_LIBS dlfcn-win32::dl) | ||
40 | endif () | ||
41 | ... | ||
42 | target_link_libraries(<target> ${CMAKE_DL_LIBS}) | ||
43 | ... | ||
44 | ~~~ | ||
32 | 45 | ||
33 | ### Linking caveat | 46 | ### Linking caveat |
34 | This library uses the Process Status API in Windows (`psapi.lib`). If you are | 47 | This library uses the Process Status API in Windows (`psapi.lib`). If you are |