vcpkg/ports/avro-cpp/fix-cmake.patch

98 lines
3.4 KiB
Diff
Raw Normal View History

diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
2024-09-04 02:09:33 +08:00
index 19059a4..c49e9c2 100644
--- a/lang/c++/CMakeLists.txt
+++ b/lang/c++/CMakeLists.txt
2024-09-04 02:09:33 +08:00
@@ -58,17 +58,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
if (WIN32 AND NOT CYGWIN AND NOT MSYS)
add_definitions (/EHa)
2024-09-04 02:09:33 +08:00
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)
2024-09-04 02:09:33 +08:00
+ -DNOMINMAX)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
2024-09-04 02:09:33 +08:00
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wconversion -pedantic -Werror")
+ # Remove " -Werror" because of warning from boost-math (will require C++ 14 soon)
2024-09-04 02:09:33 +08:00
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wconversion -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
2024-09-04 02:09:33 +08:00
@@ -82,16 +77,7 @@ endif ()
find_package (Boost 1.38 REQUIRED
COMPONENTS filesystem iostreams program_options regex system)
-include(FetchContent)
-FetchContent_Declare(
- fmt
- GIT_REPOSITORY https://github.com/fmtlib/fmt.git
- GIT_TAG 10.2.1
- GIT_PROGRESS TRUE
- USES_TERMINAL_DOWNLOAD TRUE
-)
-FetchContent_MakeAvailable(fmt)
-
+find_package(fmt CONFIG REQUIRED)
find_package(Snappy)
if (SNAPPY_FOUND)
set(SNAPPY_PKG libsnappy)
@@ -128,7 +114,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)
2024-09-04 02:09:33 +08:00
@@ -194,6 +180,7 @@ target_include_directories(avrocpp PUBLIC
$<INSTALL_INTERFACE:include>
)
+if(BUILD_TESTING)
enable_testing()
macro (unittest name)
2024-09-04 02:09:33 +08:00
@@ -220,23 +207,26 @@ unittest (CommonsSchemasTests)
add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh)
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 cpp_reserved_words_union_typedef_hh
- union_empty_record_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 cpp_reserved_words_union_typedef_hh
+ union_empty_record_hh)
+endif()
include (InstallRequiredSystemLibraries)
2024-09-04 02:09:33 +08:00
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)
2024-09-04 02:09:33 +08:00
+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)
2024-09-04 02:09:33 +08:00
install (DIRECTORY include/avro DESTINATION include