Skip to content

Commit 08a4b49

Browse files
committed
fix proto .cc build
1 parent 961e084 commit 08a4b49

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cmake/cpp.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,7 @@ function(generate_proto_library)
377377
else()
378378
set_target_properties(${PROTO_NAME}_proto PROPERTIES CXX_STANDARD 17)
379379
endif()
380-
if(MSVC AND BUILD_SHARED_LIBS)
381-
target_compile_definitions(${PROTO_NAME}_proto INTERFACE "OR_PROTO_DLL=__declspec(dllimport)")
382-
target_compile_definitions(${PROTO_NAME}_proto PRIVATE "OR_PROTO_DLL=__declspec(dllexport)")
383-
else()
384-
target_compile_definitions(${PROTO_NAME}_proto PUBLIC "OR_PROTO_DLL=")
385-
endif()
386-
set_target_properties(${PROTO_NAME}_proto PROPERTIES
380+
set_target_properties(${PROTO_NAME}_proto PROPERTIES
387381
CXX_STANDARD_REQUIRED ON
388382
CXX_EXTENSIONS OFF
389383
POSITION_INDEPENDENT_CODE ON)
@@ -393,6 +387,12 @@ endif()
393387
#$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
394388
)
395389
target_compile_definitions(${PROTO_NAME}_proto PUBLIC ${OR_TOOLS_COMPILE_DEFINITIONS})
390+
if(MSVC AND BUILD_SHARED_LIBS)
391+
target_compile_definitions(${PROTO_NAME}_proto INTERFACE "OR_PROTO_DLL=__declspec(dllimport)")
392+
target_compile_definitions(${PROTO_NAME}_proto PRIVATE "OR_PROTO_DLL=__declspec(dllexport)")
393+
else()
394+
target_compile_definitions(${PROTO_NAME}_proto PUBLIC "OR_PROTO_DLL=")
395+
endif()
396396
target_compile_options(${PROTO_NAME}_proto PUBLIC ${OR_TOOLS_COMPILE_OPTIONS})
397397
target_link_libraries(${PROTO_NAME}_proto PUBLIC protobuf::libprotobuf ${PROTO_LINK_LIBRARIES})
398398
add_library(${PROJECT_NAMESPACE}::${PROTO_NAME}_proto ALIAS ${PROTO_NAME}_proto)

0 commit comments

Comments
 (0)