summaryrefslogtreecommitdiff
path: root/science/orthanc/files/patch-OrthancFramework_Resources_CMake_ProtobufConfiguration.cmake
blob: e6d9c8ff88cf498e74485dced26a10ab76f5afc6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- OrthancFramework/Resources/CMake/ProtobufConfiguration.cmake.orig	2023-12-05 11:17:50 UTC
+++ OrthancFramework/Resources/CMake/ProtobufConfiguration.cmake
@@ -64,22 +64,26 @@ else()
     message(FATAL_ERROR "Please install the libprotobuf-dev package")
   endif()
 
-  set(CMAKE_REQUIRED_LIBRARIES "protobuf")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+    find_package(Protobuf REQUIRED)
+  else()
+    set(CMAKE_REQUIRED_LIBRARIES "protobuf")
 
-  include(CheckCXXSourceCompiles) 
-  check_cxx_source_compiles(
-    "
+    include(CheckCXXSourceCompiles) 
+    check_cxx_source_compiles(
+      "
 #include <google/protobuf/descriptor.h>
 int main()
 {
   google::protobuf::FieldDescriptor::TypeName(google::protobuf::FieldDescriptor::TYPE_FLOAT);
 }
 "  HAVE_PROTOBUF_LIB)
-  if (NOT HAVE_PROTOBUF_LIB)
-    message(FATAL_ERROR "Cannot find the protobuf library")
+    if (NOT HAVE_PROTOBUF_LIB)
+      message(FATAL_ERROR "Cannot find the protobuf library")
+    endif()
+
+    unset(CMAKE_REQUIRED_LIBRARIES)
   endif()
-  
-  unset(CMAKE_REQUIRED_LIBRARIES)
 
   link_libraries(protobuf)
 endif()