mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-24 23:27:51 +08:00
4bc219e623
* [avro-cpp] Fix windows static build * update version database
100 lines
3.7 KiB
Diff
100 lines
3.7 KiB
Diff
diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
|
|
index 472684f4c..edde09e40 100644
|
|
--- a/lang/c++/CMakeLists.txt
|
|
+++ b/lang/c++/CMakeLists.txt
|
|
@@ -51,20 +51,16 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
|
|
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 (
|
|
- -DNOMINMAX
|
|
- -DBOOST_REGEX_DYN_LINK
|
|
- -DBOOST_FILESYSTEM_DYN_LINK
|
|
- -DBOOST_SYSTEM_DYN_LINK
|
|
- -DBOOST_IOSTREAMS_DYN_LINK
|
|
- -DBOOST_PROGRAM_OPTIONS_DYN_LINK
|
|
- -DBOOST_ALL_NO_LIB)
|
|
+ add_definitions (-DNOMINMAX)
|
|
endif()
|
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
|
|
+ # Remove " -Werror" because of warning from boost-math (will require C++ 14 soon)
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
|
|
if (AVRO_ADD_PROTECTOR_FLAGS)
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector-all -D_GLIBCXX_DEBUG")
|
|
# Unset _GLIBCXX_DEBUG for avrogencpp.cc because using Boost Program Options
|
|
@@ -114,7 +110,7 @@ set (AVRO_SOURCE_FILES
|
|
impl/CustomAttributes.cc
|
|
)
|
|
|
|
-add_library (avrocpp SHARED ${AVRO_SOURCE_FILES})
|
|
+add_library (avrocpp ${AVRO_SOURCE_FILES})
|
|
|
|
set_property (TARGET avrocpp
|
|
APPEND PROPERTY COMPILE_DEFINITIONS AVRO_DYN_LINK)
|
|
@@ -131,12 +127,12 @@ set_target_properties (avrocpp PROPERTIES
|
|
set_target_properties (avrocpp_s PROPERTIES
|
|
VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH})
|
|
|
|
-target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
|
+target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
|
target_include_directories(avrocpp PRIVATE ${SNAPPY_INCLUDE_DIR})
|
|
|
|
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
|
|
@@ -166,13 +162,14 @@ gen (primitivetypes pt)
|
|
gen (cpp_reserved_words cppres)
|
|
|
|
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)
|
|
|
|
+if(BUILD_TESTING)
|
|
enable_testing()
|
|
|
|
macro (unittest name)
|
|
- add_executable (${name} test/${name}.cc)
|
|
- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
|
+ add_executable (${name} test/${name}.cc impl/json/JsonIO.cc impl/json/JsonDom.cc)
|
|
+ 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)
|
|
@@ -197,6 +194,7 @@ add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_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)
|
|
|
|
@@ -204,10 +202,14 @@ set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}")
|
|
|
|
include (CPack)
|
|
|
|
-install (TARGETS avrocpp avrocpp_s
|
|
- LIBRARY DESTINATION lib
|
|
- ARCHIVE DESTINATION lib
|
|
- RUNTIME DESTINATION lib)
|
|
+install(TARGETS avrocpp EXPORT unofficial-avro-cpp)
|
|
+
|
|
+install(
|
|
+ EXPORT unofficial-avro-cpp
|
|
+ FILE unofficial-avro-cpp-config.cmake
|
|
+ DESTINATION share/unofficial-avro-cpp
|
|
+ NAMESPACE unofficial::avro-cpp::
|
|
+)
|
|
|
|
install (TARGETS avrogencpp RUNTIME DESTINATION bin)
|
|
|