mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 19:17:53 +08:00
63 lines
2.3 KiB
Diff
63 lines
2.3 KiB
Diff
|
diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt
|
||
|
index bc1728f..7c6a04d 100644
|
||
|
--- a/build-cmake/CMakeLists.txt
|
||
|
+++ b/build-cmake/CMakeLists.txt
|
||
|
@@ -61,11 +61,15 @@ if (MSVC AND MSVC_STATIC_BUILD)
|
||
|
endif(${flag_var} MATCHES "/MD")
|
||
|
endforeach(flag_var)
|
||
|
endif (MSVC AND MSVC_STATIC_BUILD)
|
||
|
+
|
||
|
+IF(WITH_TOOLS)
|
||
|
FILE(GLOB PROTOC_GEN_C_SRC ${MAIN_DIR}/protoc-c/*.h ${MAIN_DIR}/protoc-c/*.cc )
|
||
|
ADD_EXECUTABLE(protoc-gen-c ${PROTOC_GEN_C_SRC})
|
||
|
|
||
|
TARGET_LINK_LIBRARIES(protoc-gen-c ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY})
|
||
|
+ENDIF()
|
||
|
|
||
|
+IF(WITH_TEST AND WITH_TOOLS)
|
||
|
IF(CMAKE_HOST_UNIX)
|
||
|
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
|
||
|
COMMAND ln -sf protoc-gen-c protoc-c
|
||
|
@@ -79,8 +83,6 @@ FUNCTION(GENERATE_TEST_SOURCES PROTO_FILE SRC HDR)
|
||
|
DEPENDS protoc-gen-c)
|
||
|
ENDFUNCTION()
|
||
|
|
||
|
-
|
||
|
-IF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||
|
ENABLE_TESTING()
|
||
|
|
||
|
GENERATE_TEST_SOURCES(${TEST_DIR}/test.proto t/test.pb-c.c t/test.pb-c.h)
|
||
|
@@ -126,17 +128,17 @@ GENERATE_TEST_SOURCES(${TEST_DIR}/test-proto3.proto t/test-proto3.pb-c.c t/test-
|
||
|
ADD_EXECUTABLE(test-generated-code3 ${TEST_DIR}/generated-code/test-generated-code.c t/test-proto3.pb-c.c t/test-proto3.pb-c.h)
|
||
|
TARGET_COMPILE_DEFINITIONS(test-generated-code3 PUBLIC -DPROTO3)
|
||
|
TARGET_LINK_LIBRARIES(test-generated-code3 protobuf-c)
|
||
|
-
|
||
|
ENDIF()
|
||
|
|
||
|
-INSTALL(TARGETS protoc-gen-c protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||
|
-INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c)
|
||
|
-INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include)
|
||
|
+IF (WITH_TOOLS)
|
||
|
+INSTALL(TARGETS protoc-gen-c RUNTIME DESTINATION tools LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||
|
+ENDIF()
|
||
|
|
||
|
IF(CMAKE_HOST_UNIX)
|
||
|
INSTALL(CODE "EXECUTE_PROCESS (COMMAND ln -sf protoc-gen-c protoc-c WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)")
|
||
|
ENDIF()
|
||
|
|
||
|
+IF (WITH_TEST)
|
||
|
INCLUDE(Dart)
|
||
|
|
||
|
SET(DART_TESTING_TIMEOUT 5)
|
||
|
@@ -147,5 +149,10 @@ ADD_TEST(test-issue220 test-issue220)
|
||
|
ADD_TEST(test-issue251 test-issue251)
|
||
|
ADD_TEST(test-version test-version)
|
||
|
|
||
|
+ENDIF()
|
||
|
+
|
||
|
+INSTALL(TARGETS protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
|
||
|
+INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c)
|
||
|
+INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include)
|
||
|
|
||
|
INCLUDE(CPack)
|