mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-11-06 02:37:32 +01:00
install pkg-config file when building with cmake
This commit is contained in:
parent
2ed8375f39
commit
5371f206f3
@ -92,3 +92,39 @@ add_custom_target(uninstall
|
||||
########################################################################
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(src)
|
||||
|
||||
########################################################################
|
||||
# Create Pkg Config File
|
||||
########################################################################
|
||||
FOREACH(inc ${LIBUSB_INCLUDE_DIR})
|
||||
LIST(APPEND RTLSDR_PC_CFLAGS "-I${inc}")
|
||||
ENDFOREACH(inc)
|
||||
|
||||
FOREACH(lib ${LIBUSB_LIBRARY_DIRS})
|
||||
LIST(APPEND RTLSDR_PC_LIBS "-L${lib}")
|
||||
ENDFOREACH(lib)
|
||||
|
||||
# use space-separation format for the pc file
|
||||
STRING(REPLACE ";" " " RTLSDR_PC_CFLAGS "${RTLSDR_PC_CFLAGS}")
|
||||
STRING(REPLACE ";" " " RTLSDR_PC_LIBS "${RTLSDR_PC_LIBS}")
|
||||
|
||||
# unset these vars to avoid hard-coded paths to cross environment
|
||||
IF(CMAKE_CROSSCOMPILING)
|
||||
UNSET(RTLSDR_PC_CFLAGS)
|
||||
UNSET(RTLSDR_PC_LIBS)
|
||||
ENDIF(CMAKE_CROSSCOMPILING)
|
||||
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(exec_prefix \${prefix})
|
||||
set(libdir \${exec_prefix}/lib)
|
||||
set(includedir \${prefix}/include)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/librtlsdr.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/librtlsdr.pc
|
||||
@ONLY)
|
||||
|
||||
INSTALL(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/librtlsdr.pc
|
||||
DESTINATION lib/pkgconfig
|
||||
)
|
||||
|
@ -6,5 +6,6 @@ includedir=@includedir@
|
||||
Name: RTL-SDR Library
|
||||
Description: C Utility Library
|
||||
Version: @VERSION@
|
||||
Cflags: -I${includedir}/ @RTLSDR_PC_CFLAGS@
|
||||
Libs: -L${libdir} -lrtlsdr -lusb-1.0
|
||||
Cflags: -I${includedir}/
|
||||
Libs.private: @RTLSDR_PC_LIBS@
|
||||
|
Loading…
Reference in New Issue
Block a user