changeset 5190:c0f6c6fe1c47 db-protobuf

fix windows builds
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 27 Mar 2023 07:44:50 +0200
parents 50c4a18caa85
children fb96f1ffd020
files OrthancFramework/Resources/CMake/ProtobufConfiguration.cmake
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/ProtobufConfiguration.cmake	Sun Mar 26 21:19:58 2023 +0200
+++ b/OrthancFramework/Resources/CMake/ProtobufConfiguration.cmake	Mon Mar 27 07:44:50 2023 +0200
@@ -32,7 +32,16 @@
       -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}
       INSTALL_COMMAND ""
       )
-    set(PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/ProtobufCompiler-build/protoc)
+
+    # The "protoc" compiler is built using "externalproject_add",
+    # which builds for the host platform, not for the target platform
+    if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+      set(Suffix ".exe")
+    else()
+      set(Suffix "")
+    endif()
+    
+    set(PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/ProtobufCompiler-build/protoc${Suffix})
   endif()
 
   include(${CMAKE_CURRENT_LIST_DIR}/../ProtocolBuffers/ProtobufLibrary.cmake)