Add shared library install target supporting pkgconfig

This commit is contained in:
Billy Laws 2023-06-30 18:04:00 +01:00
parent f4ce3c9618
commit a5dfbe8b4f
3 changed files with 27 additions and 0 deletions

View file

@ -6,6 +6,8 @@ endif()
project(adrenotools LANGUAGES CXX C) project(adrenotools LANGUAGES CXX C)
set(GEN_INSTALL_TARGET OFF CACHE BOOL "")
add_subdirectory(lib/linkernsbypass) add_subdirectory(lib/linkernsbypass)
set(LIB_SOURCES src/bcenabler.cpp set(LIB_SOURCES src/bcenabler.cpp
@ -22,3 +24,14 @@ target_compile_options(adrenotools PRIVATE -Wall -Wextra)
target_link_libraries(adrenotools android linkernsbypass) target_link_libraries(adrenotools android linkernsbypass)
add_subdirectory(src/hook) add_subdirectory(src/hook)
if (${BUILD_SHARED_LIBS})
target_link_options(adrenotools PRIVATE "-Wl,-s,--exclude-libs,liblinkernsbypass.a")
endif()
if (${GEN_INSTALL_TARGET})
configure_file(adrenotools.pc.in adrenotools.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/adrenotools.pc DESTINATION lib/pkgconfig)
install(TARGETS adrenotools main_hook file_redirect_hook gsl_alloc_hook hook_impl)
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h*")
endif()

13
adrenotools.pc.in Normal file
View file

@ -0,0 +1,13 @@
prefix="@CMAKE_INSTALL_PREFIX@"
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: adrenotools
Description:
URL:
Version: 1.0.0
Libs: -L${libdir} -ladrenotools
Libs.private:
Requires.private:
Cflags: -I${includedir}

View file

@ -7,6 +7,7 @@
extern "C" { extern "C" {
#endif #endif
#include <stdbool.h>
#include "priv.h" #include "priv.h"
/** /**