summarylogtreecommitdiffstats
path: root/huggle-yaml.patch
blob: 1eba4ed19bf9031e693fa0bc0a28b41656704dd7 (plain)
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
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a37976e3..b7530e8f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -63,12 +63,19 @@ add_subdirectory(3rd/libirc/libirc libirc)
 add_subdirectory(3rd/libirc/libircclient libircclient)
 
 # YAML
-option(YAML_CPP_BUILD_TOOLS "Disable tests" OFF)
-option(YAML_CPP_BUILD_TESTS "Enable testing" OFF)
-option(YAML_CPP_BUILD_TOOLS "Enable parse tools" OFF)
-option(BUILD_SHARED_LIBS "Build as shared" ON)
-include_directories("3rd/yaml-cpp/include/")
-add_subdirectory(3rd/yaml-cpp)
+find_package(YAML-CPP 0.6.3 QUIET)
+if (YAML-CPP_FOUND)
+    message(STATUS "Using system yaml-cpp")
+    include_directories(YAML_CPP_INCLUDE_DIR)
+else()
+    option(YAML_CPP_BUILD_TOOLS "Disable tests" OFF)
+    option(YAML_CPP_BUILD_TESTS "Enable testing" OFF)
+    option(YAML_CPP_BUILD_TOOLS "Enable parse tools" OFF)
+    option(BUILD_SHARED_LIBS "Build as shared" ON)
+    include_directories("3rd/yaml-cpp/include/")
+    add_subdirectory(3rd/yaml-cpp)
+endif()
+
 if (HUGGLE_EXT)
     if(NOT MINGW AND WIN32)
         set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/Release/extensions)