Merge pull request #8698 from protocolbuffers/3.17.x
Merge 3.17.x into master
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 5c3b6e4..61a5c3d 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -193,8 +193,10 @@
endif (protobuf_BUILD_SHARED_LIBS)
if (MSVC)
- # Build with multiple processes
- add_definitions(/MP)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ # Build with multiple processes
+ add_definitions(/MP)
+ endif()
# MSVC warning suppressions
add_definitions(
/wd4018 # 'expression' : signed/unsigned mismatch
@@ -222,12 +224,14 @@
# Suppress linker warnings about files with no symbols defined.
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
- # Configure Resource Compiler
- enable_language(RC)
- # use English language (0x409) in resource compiler
- set(rc_flags "/l0x409")
- # fix rc.exe invocations because of usage of add_definitions()
- set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ # Configure Resource Compiler
+ enable_language(RC)
+ # use English language (0x409) in resource compiler
+ set(rc_flags "/l0x409")
+ # fix rc.exe invocations because of usage of add_definitions()
+ set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
+ endif()
configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
endif (MSVC)
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index a3d5979..cd74dbc 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -58,7 +58,7 @@
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
)
-if (MSVC)
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotobuf_lite_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index cf548c7..0f6b5ce 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -107,7 +107,7 @@
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
)
-if (MSVC)
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotobuf_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index b70191f..a6f7919 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -163,7 +163,7 @@
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
)
-if (MSVC)
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
diff --git a/cmake/protoc.cmake b/cmake/protoc.cmake
index f90e525..c86d662 100644
--- a/cmake/protoc.cmake
+++ b/cmake/protoc.cmake
@@ -2,7 +2,7 @@
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
)
-if (MSVC)
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(protoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)