aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2020-08-25 23:34:19 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2020-09-14 12:26:07 +0200
commitf0ac8495872ee078f18bd349e3db6883ed4106e2 (patch)
tree0f9b609aa80b924f6b391e1c4b687c0f73eaa7b9 /src/CMakeLists.txt
parent5ead6f2d2c515d3d85c31fffebea55168c1bc1b4 (diff)
downloaddlfcn-win32-f0ac8495872ee078f18bd349e3db6883ed4106e2.tar.gz
dlfcn-win32-f0ac8495872ee078f18bd349e3db6883ed4106e2.tar.bz2
dlfcn-win32-f0ac8495872ee078f18bd349e3db6883ed4106e2.zip
Move cmake targets into sub directories
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})