aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Traversaro <pegua1@gmail.com>2017-09-27 18:36:26 +0200
committerGitHub <noreply@github.com>2017-09-27 18:36:26 +0200
commitf1edc33522cfd5c55ad61d820419c0e9511a1491 (patch)
treef3d8442ec4b64e6bd7dd58e41837bc7e86e05681
parent2d03bf631daefa0157176697074b66f9d760e4b5 (diff)
parentb30b758efb90aaf2bc96b034c117c8f21490c54e (diff)
downloaddlfcn-win32-f1edc33522cfd5c55ad61d820419c0e9511a1491.tar.gz
dlfcn-win32-f1edc33522cfd5c55ad61d820419c0e9511a1491.tar.bz2
dlfcn-win32-f1edc33522cfd5c55ad61d820419c0e9511a1491.zip
Merge pull request #40 from dlfcn-win32/document-cmake-usage
Document how to use the library when using CMake
-rw-r--r--README.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/README.md b/README.md
index 27f36e7..6e8ec21 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,30 @@ http://www.opengroup.org/onlinepubs/009695399/functions/dlopen.html
20Using This Library 20Using This Library
21------------------ 21------------------
22 22
23### Using CMake
24Once the library has been installed, add to your project `CMakeLists.txt` :
25~~~
26...
27find_package(dlfcn-win32 REQUIRED)
28...
29target_link_libraries(<target> dlfcn-win32::dl)
30...
31~~~
32If you want to use this library in a cross-platform project, a convenient way
33to 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...
37if (WIN32)
38 find_package(dlfcn-win32 REQUIRED)
39 set(CMAKE_DL_LIBS dlfcn-win32::dl)
40endif ()
41...
42target_link_libraries(<target> ${CMAKE_DL_LIBS})
43...
44~~~
45
46### Linking caveat
23This library uses the Process Status API in Windows (`psapi.lib`). If you are 47This library uses the Process Status API in Windows (`psapi.lib`). If you are
24linking to the static `dl.lib` or `libdl.a`, then you would need to explicitly 48linking to the static `dl.lib` or `libdl.a`, then you would need to explicitly
25add `psapi.lib` or `-lpsapi` to your linking command, depending on if MinGW is 49add `psapi.lib` or `-lpsapi` to your linking command, depending on if MinGW is