vcpkg/ports/libjuice/fix-for-vcpkg.patch

69 lines
2.5 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be72a2a..8a631e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,9 @@ set(LIBJUICE_SOURCES
set(LIBJUICE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/juice/juice.h
)
+set(LIBJUICE_PRIVATE_HEADERS
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/socket.h
+)
set(TESTS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/test/main.c
@@ -54,10 +57,10 @@ set(TESTS_SOURCES
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
-add_library(juice SHARED ${LIBJUICE_SOURCES})
+add_library(juice ${LIBJUICE_SOURCES})
set_target_properties(juice PROPERTIES VERSION ${PROJECT_VERSION})
-target_include_directories(juice PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
+target_include_directories(juice PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
target_include_directories(juice PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/juice)
target_include_directories(juice PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(juice PUBLIC Threads::Threads)
@@ -77,10 +80,14 @@ endif()
if (USE_NETTLE)
find_package(Nettle REQUIRED)
+ find_path(NETTLE_INCLUDE_PATH "nettle/hmac.h" REQUIRED)
+ target_include_directories(juice PRIVATE ${NETTLE_INCLUDE_PATH})
+ target_include_directories(juice-static PRIVATE ${NETTLE_INCLUDE_PATH})
+
target_compile_definitions(juice PRIVATE USE_NETTLE=1)
- target_link_libraries(juice PRIVATE Nettle::Nettle)
+ target_link_libraries(juice PRIVATE nettle)
target_compile_definitions(juice-static PRIVATE USE_NETTLE=1)
- target_link_libraries(juice-static PRIVATE Nettle::Nettle)
+ target_link_libraries(juice-static PRIVATE nettle)
else()
target_compile_definitions(juice PRIVATE USE_NETTLE=0)
target_compile_definitions(juice-static PRIVATE USE_NETTLE=0)
@@ -100,8 +107,13 @@ endif()
add_library(LibJuice::LibJuice ALIAS juice)
add_library(LibJuice::LibJuiceStatic ALIAS juice-static)
-install(TARGETS juice LIBRARY DESTINATION lib)
+install(TARGETS juice EXPORT libjuice-config
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
install(FILES ${LIBJUICE_HEADERS} DESTINATION include/juice)
+install(FILES ${LIBJUICE_PRIVATE_HEADERS} DESTINATION include/juice/src)
if(NOT MSVC)
target_compile_options(juice PRIVATE -Wall -Wextra)
@@ -128,3 +140,8 @@ if(NOT NO_TESTS)
target_link_libraries(juice-tests juice)
endif()
+install(
+ EXPORT libjuice-config
+ NAMESPACE LibJuice::
+ DESTINATION share/cmake/libjuice
+)