Skip to content

Commit

Permalink
fix proto .cc build
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jan 27, 2025
1 parent 961e084 commit 08a4b49
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,7 @@ function(generate_proto_library)
else()
set_target_properties(${PROTO_NAME}_proto PROPERTIES CXX_STANDARD 17)
endif()
if(MSVC AND BUILD_SHARED_LIBS)
target_compile_definitions(${PROTO_NAME}_proto INTERFACE "OR_PROTO_DLL=__declspec(dllimport)")
target_compile_definitions(${PROTO_NAME}_proto PRIVATE "OR_PROTO_DLL=__declspec(dllexport)")
else()
target_compile_definitions(${PROTO_NAME}_proto PUBLIC "OR_PROTO_DLL=")
endif()
set_target_properties(${PROTO_NAME}_proto PROPERTIES
set_target_properties(${PROTO_NAME}_proto PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON)
Expand All @@ -393,6 +387,12 @@ endif()
#$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(${PROTO_NAME}_proto PUBLIC ${OR_TOOLS_COMPILE_DEFINITIONS})
if(MSVC AND BUILD_SHARED_LIBS)
target_compile_definitions(${PROTO_NAME}_proto INTERFACE "OR_PROTO_DLL=__declspec(dllimport)")
target_compile_definitions(${PROTO_NAME}_proto PRIVATE "OR_PROTO_DLL=__declspec(dllexport)")
else()
target_compile_definitions(${PROTO_NAME}_proto PUBLIC "OR_PROTO_DLL=")
endif()
target_compile_options(${PROTO_NAME}_proto PUBLIC ${OR_TOOLS_COMPILE_OPTIONS})
target_link_libraries(${PROTO_NAME}_proto PUBLIC protobuf::libprotobuf ${PROTO_LINK_LIBRARIES})
add_library(${PROJECT_NAMESPACE}::${PROTO_NAME}_proto ALIAS ${PROTO_NAME}_proto)
Expand Down

0 comments on commit 08a4b49

Please sign in to comment.