vcpkg/ports/libjuice/fix-for-vcpkg.patch
Nemirtingas 5b93dabe79
[libjuice] Add new port (#13703)
* libjuice port

* Various fix from pr.

* Remove unused code

* Update to v0.5.2

* Add the private include file for datachannel

* Smaller patch for vcpkg

* Update ports/libjuice/CONTROL

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update scripts/ci.baseline.txt

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update libjuice to support uwp ?

* Add nettle include path

* Fix the nettle library name

Co-authored-by: Nemirtingas <nanaki89@hotmail.fr>
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
2020-10-23 00:32:18 -07:00

69 lines
2.5 KiB
Diff

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
+)