aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..d5296b1
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,43 @@
1set(headers dlfcn.h)
2set(sources dlfcn.c)
3
4if (BUILD_SHARED_LIBS)
5 add_definitions(-DSHARED)
6endif (BUILD_SHARED_LIBS)
7
8add_library(dl ${sources})
9
10# Correctly export the location of installed includes in the target
11target_include_directories(dl INTERFACE $<INSTALL_INTERFACE:include>)
12
13install (TARGETS dl EXPORT dlfcn-win32-targets
14 RUNTIME DESTINATION bin
15 LIBRARY DESTINATION lib${LIB_SUFFIX}
16 ARCHIVE DESTINATION lib${LIB_SUFFIX})
17
18install (FILES ${headers} DESTINATION include)
19
20# Export the targets (build tree)
21export(EXPORT dlfcn-win32-targets
22 FILE "${CMAKE_BINARY_DIR}/dlfcn-win32-targets.cmake"
23 NAMESPACE dlfcn-win32::
24)
25
26# Write the CMake config file
27set(CMAKE_CONF_INSTALL_DIR share/dlfcn-win32)
28set(INCLUDE_INSTALL_DIR include)
29include(CMakePackageConfigHelpers)
30configure_package_config_file(../dlfcn-win32-config.cmake.in ${CMAKE_BINARY_DIR}/dlfcn-win32-config.cmake
31 INSTALL_DESTINATION ${CMAKE_CONF_INSTALL_DIR}
32 PATH_VARS INCLUDE_INSTALL_DIR
33 NO_CHECK_REQUIRED_COMPONENTS_MACRO)
34
35# Install the targets (install)
36install(EXPORT dlfcn-win32-targets
37 FILE dlfcn-win32-targets.cmake
38 NAMESPACE dlfcn-win32::
39 DESTINATION ${CMAKE_CONF_INSTALL_DIR})
40
41# Install the CMake config file
42install(FILES ${CMAKE_BINARY_DIR}/dlfcn-win32-config.cmake
43 DESTINATION ${CMAKE_CONF_INSTALL_DIR})