mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 20:59:12 +08:00
101 lines
3.3 KiB
Diff
101 lines
3.3 KiB
Diff
|
diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
|
||
|
index 30a5d66..f7f2b94 100644
|
||
|
--- a/lang/c++/CMakeLists.txt
|
||
|
+++ b/lang/c++/CMakeLists.txt
|
||
|
@@ -40,6 +40,8 @@ set (AVRO_VERSION_MINOR "0")
|
||
|
project (Avro-cpp)
|
||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
|
||
|
|
||
|
+find_package(ZLIB REQUIRED)
|
||
|
+
|
||
|
if (WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||
|
add_definitions (/EHa)
|
||
|
add_definitions (
|
||
|
@@ -118,11 +120,11 @@ set_target_properties (avrocpp PROPERTIES
|
||
|
set_target_properties (avrocpp_s PROPERTIES
|
||
|
VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR})
|
||
|
|
||
|
-target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||
|
+target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||
|
|
||
|
add_executable (precompile test/precompile.cc)
|
||
|
|
||
|
-target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||
|
+target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||
|
|
||
|
macro (gen file ns)
|
||
|
add_custom_command (OUTPUT ${file}.hh
|
||
|
@@ -151,34 +153,40 @@ gen (crossref cr)
|
||
|
gen (primitivetypes pt)
|
||
|
|
||
|
add_executable (avrogencpp impl/avrogencpp.cc)
|
||
|
-target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||
|
+target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||
|
+
|
||
|
|
||
|
-enable_testing()
|
||
|
+if(BUILD_TESTING)
|
||
|
+ enable_testing()
|
||
|
+endif()
|
||
|
|
||
|
macro (unittest name)
|
||
|
add_executable (${name} test/${name}.cc)
|
||
|
- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||
|
+ target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||
|
add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name})
|
||
|
endmacro (unittest)
|
||
|
|
||
|
-unittest (buffertest)
|
||
|
-unittest (unittest)
|
||
|
-unittest (SchemaTests)
|
||
|
-unittest (LargeSchemaTests)
|
||
|
-unittest (CodecTests)
|
||
|
-unittest (StreamTests)
|
||
|
-unittest (SpecificTests)
|
||
|
-unittest (DataFileTests)
|
||
|
-unittest (JsonTests)
|
||
|
-unittest (AvrogencppTests)
|
||
|
-unittest (CompilerTests)
|
||
|
-
|
||
|
-add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh
|
||
|
- tweet_hh
|
||
|
- union_array_union_hh union_map_union_hh union_conflict_hh
|
||
|
- recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh
|
||
|
- primitivetypes_hh empty_record_hh)
|
||
|
+if(BUILD_TESTING)
|
||
|
+ unittest (buffertest)
|
||
|
+ unittest (unittest)
|
||
|
+ unittest (SchemaTests)
|
||
|
+ unittest (LargeSchemaTests)
|
||
|
+ unittest (CodecTests)
|
||
|
+ unittest (StreamTests)
|
||
|
+ unittest (SpecificTests)
|
||
|
+ unittest (DataFileTests)
|
||
|
+ unittest (JsonTests)
|
||
|
+ unittest (AvrogencppTests)
|
||
|
+ unittest (CompilerTests)
|
||
|
+
|
||
|
+ add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh
|
||
|
+ tweet_hh
|
||
|
+ union_array_union_hh union_map_union_hh union_conflict_hh
|
||
|
+ recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh
|
||
|
+ primitivetypes_hh empty_record_hh)
|
||
|
+
|
||
|
+endif()
|
||
|
|
||
|
include (InstallRequiredSystemLibraries)
|
||
|
|
||
|
@@ -189,9 +197,9 @@ include (CPack)
|
||
|
install (TARGETS avrocpp avrocpp_s
|
||
|
LIBRARY DESTINATION lib
|
||
|
ARCHIVE DESTINATION lib
|
||
|
- RUNTIME DESTINATION lib)
|
||
|
+ RUNTIME DESTINATION bin)
|
||
|
|
||
|
-install (TARGETS avrogencpp RUNTIME DESTINATION bin)
|
||
|
+install (TARGETS avrogencpp RUNTIME DESTINATION tools/bin)
|
||
|
|
||
|
install (DIRECTORY api/ DESTINATION include/avro
|
||
|
FILES_MATCHING PATTERN *.hh)
|