vcpkg/ports/zookeeper/cmake.patch
Samuel Marks 8c64785e78 [zookeeper] Add new port (#7000)
* [zookeeper-mt] Add new port

* [zookeeper-mt] Upgrade from 3.5.4-beta to 3.5.5

* [zookeeper-mt] Fix upgrade

* disable warnings and add static library check

* edit cmake file

* add async feature

* add back some changes for export

* add sync feature, disable parallel configure
2019-07-06 14:52:53 -07:00

51 lines
2.2 KiB
Diff

diff --git a/zookeeper-client/zookeeper-client-c/CMakeLists.txt b/zookeeper-client/zookeeper-client-c/CMakeLists.txt
index 24a5a1b..1b0ce4a 100644
--- a/zookeeper-client/zookeeper-client-c/CMakeLists.txt
+++ b/zookeeper-client/zookeeper-client-c/CMakeLists.txt
@@ -153,7 +153,7 @@ configure_file(cmake_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
# hashtable library
set(hashtable_sources src/hashtable/hashtable_itr.c src/hashtable/hashtable.c)
add_library(hashtable STATIC ${hashtable_sources})
-target_include_directories(hashtable PUBLIC include)
+target_include_directories(hashtable PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries(hashtable PUBLIC $<$<OR:$<PLATFORM_ID:Linux>,$<PLATFORM_ID:FreeBSD>>:m>)
# zookeeper library
@@ -176,7 +176,10 @@ if(WIN32)
endif()
add_library(zookeeper STATIC ${zookeeper_sources})
-target_include_directories(zookeeper PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/include generated)
+target_include_directories(zookeeper PUBLIC
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/generated>)
+
target_link_libraries(zookeeper PUBLIC
hashtable
$<$<PLATFORM_ID:Linux>:rt> # clock_gettime
@@ -247,3 +250,23 @@ if(WANT_CPPUNIT)
"ZKROOT=${CMAKE_CURRENT_SOURCE_DIR}/../.."
"CLASSPATH=$CLASSPATH:$CLOVER_HOME/lib/clover*.jar")
endif()
+
+
+target_compile_definitions(zookeeper PRIVATE _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
+target_compile_definitions(cli PRIVATE _CRT_SECURE_NO_WARNINGS)
+
+file(GLOB ZOOKEEPER_HEADERS include/*.h)
+
+install(FILES ${ZOOKEEPER_HEADERS} generated/zookeeper.jute.h DESTINATION include/zookeeper)
+
+install(TARGETS zookeeper hashtable
+ EXPORT zookeeperConfig
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)
+install(EXPORT zookeeperConfig
+ FILE zookeeperConfig.cmake
+ NAMESPACE zookeeper::
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/zookeeper"
+)
\ No newline at end of file