Skip to content

Commit

Permalink
system header, mac os cross compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Nov 21, 2023
1 parent e5c9722 commit 6b0db39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf PRIVATE log)
endif()
target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src)
target_include_directories(libprotobuf SYSTEM PUBLIC ${protobuf_SOURCE_DIR}/src)
target_link_libraries(libprotobuf PUBLIC ${protobuf_ABSL_USED_TARGETS})
protobuf_configure_target(libprotobuf)
if(protobuf_BUILD_SHARED_LIBS)
Expand Down
12 changes: 12 additions & 0 deletions cmake/protoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,17 @@ target_link_libraries(protoc
)
add_executable(protobuf::protoc ALIAS protoc)

if (CMAKE_OSX_ARCHITECTURES)
set_target_properties(protoc PROPERTIES OSX_ARCHITECTURES "x86_64;arm64")
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(protoc atomic)
endif()
target_link_libraries(protoc ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(protoc PRIVATE src ${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_USE_PTHREADS_INIT)
target_compile_definitions(protoc PUBLIC HAVE_PTHREAD)
endif (CMAKE_USE_PTHREADS_INIT)

set_target_properties(protoc PROPERTIES
VERSION ${protobuf_VERSION})

0 comments on commit 6b0db39

Please sign in to comment.