1 diff --git a/CMakeLists.txt b/CMakeLists.txt
2 index 55b93f1..3fe9979 100644
5 @@ -2355,48 +2355,54 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap.h DESTINATION include)
6 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-bpf.h DESTINATION include)
7 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-namedb.h DESTINATION include)
9 -# On UN*X, and on Windows when not using MSVC, generate libpcap.pc and
10 +# Generate libpcap.pc
11 +if(BUILD_SHARED_LIBS)
12 + set(PACKAGE_NAME ${LIBRARY_NAME})
14 + set(PACKAGE_NAME pcap)
16 +set(prefix ${CMAKE_INSTALL_PREFIX})
17 +set(exec_prefix "\${prefix}")
18 +set(includedir "\${prefix}/include")
19 +set(libdir "\${exec_prefix}/lib")
20 +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
21 + CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
22 + CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
23 + CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
24 + CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
25 + CMAKE_SYSTEM_NAME STREQUAL "OSF1")
27 + # Platforms where the linker is the GNU linker
28 + # or accepts command-line arguments like
29 + # those the GNU linker accepts.
31 + set(V_RPATH_OPT "-Wl,-rpath,")
32 +elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
36 + # XXX - this assumes GCC is using the Sun linker,
37 + # rather than the GNU linker.
39 + set(V_RPATH_OPT "-Wl,-R,")
42 + # No option needed to set the RPATH.
47 +foreach(LIB ${PCAP_LINK_LIBRARIES})
48 + set(LIBS "${LIBS} -l${LIB}")
50 +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
51 +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc DESTINATION lib/pkgconfig)
53 +# On UN*X, and on Windows when not using MSVC, generate
54 # pcap-config and process man pages and arrange that they be installed.
56 - set(prefix ${CMAKE_INSTALL_PREFIX})
57 - set(exec_prefix "\${prefix}")
58 - set(includedir "\${prefix}/include")
59 - set(libdir "\${exec_prefix}/lib")
60 - if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
61 - CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR
62 - CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR
63 - CMAKE_SYSTEM_NAME STREQUAL "DragonFly BSD" OR
64 - CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
65 - CMAKE_SYSTEM_NAME STREQUAL "OSF1")
67 - # Platforms where the linker is the GNU linker
68 - # or accepts command-line arguments like
69 - # those the GNU linker accepts.
71 - set(V_RPATH_OPT "-Wl,-rpath,")
72 - elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
76 - # XXX - this assumes GCC is using the Sun linker,
77 - # rather than the GNU linker.
79 - set(V_RPATH_OPT "-Wl,-R,")
82 - # No option needed to set the RPATH.
87 - foreach(LIB ${PCAP_LINK_LIBRARIES})
88 - set(LIBS "${LIBS} -l${LIB}")
90 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
91 - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
92 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
93 - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc DESTINATION lib/pkgconfig)