freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master da97b4c 3/6: [cmake] Add better control of library de


From: Werner LEMBERG
Subject: [freetype2] master da97b4c 3/6: [cmake] Add better control of library dependencies.
Date: Fri, 27 Nov 2015 22:17:00 +0000

branch: master
commit da97b4c43e34b1c83769d5137165e5201fd1fde2
Author: Tamas Kenez <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [cmake] Add better control of library dependencies.
    
    * CMakeLists.txt: Add `WITH_*' variables to force/auto/omit
    ZLIB/BZip2/PNG/HarfBuzz.
---
 CMakeLists.txt |   26 ++++++++++++++++++++++----
 ChangeLog      |    7 +++++++
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf6b5d7..c0a5678 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,13 @@
 #
 # . If you want to disable the automatic generation of the distribution
 #   targets, add the `-D FREETYPE_NO_DIST=true' command line argument.
+#
+# . Set the `WITH_ZLIB', `WITH_BZip2', `WITH_PNG', and `WITH_HarfBuzz'
+#   CMake variables to `ON' or `OFF' to force or skip using a dependency.
+#   Leave a variable undefined (which is the default) to use the dependency
+#   only if it is available.  Example:
+#
+#     cmake ... -DWITH_ZLIB=ON -DWITH_HarfBuzz=OFF ...
 
 
 cmake_minimum_required(VERSION 2.6)
@@ -153,10 +160,21 @@ add_definitions(-DFT2_BUILD_LIBRARY)
 
 
 # Find dependencies
-find_package(ZLIB)
-find_package(BZip2)
-find_package(PNG)
-find_package(HarfBuzz)
+foreach (d ZLIB BZip2 PNG HarfBuzz)
+  string(TOUPPER "${d}" D)
+
+  if (DEFINED WITH_${d} OR DEFINED WITH_${D})
+    if (WITH_${d} OR WITH_${D})
+      find_package(${d} QUIET REQUIRED)
+    endif ()
+  else ()
+    find_package(${d} QUIET)
+  endif ()
+
+  if (${d}_FOUND OR ${D}_FOUND)
+    message(STATUS "Building with ${d}")
+  endif()
+endforeach ()
 
 
 message(STATUS
diff --git a/ChangeLog b/ChangeLog
index f55c1f8..fd44913 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-11-27  Tamas Kenez  <address@hidden>
 
+       [cmake] Add better control of library dependencies.
+
+       * CMakeLists.txt: Add `WITH_*' variables to force/auto/omit
+       ZLIB/BZip2/PNG/HarfBuzz.
+
+2015-11-27  Tamas Kenez  <address@hidden>
+
        [cmake] Make `FindHarfbuzz' observe the REQUIRED option.
 
        * builds/cmake/FindHarfBuzz.cmake: Implement it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]