From a694e339d122744549a9b76b9ee14b0ad296ff27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 30 Mar 2018 23:01:50 +0300 Subject: [PATCH] Make the gflags library optional in the CMake build When detected, add the necessary defines to actually use it. Change-Id: I540c3e11e480be8aaab154ad91ee08cdc52319de Reviewed-on: https://chromium-review.googlesource.com/988432 Commit-Queue: Frank Barchard Reviewed-by: Frank Barchard --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef6af435f..ed4948f06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,11 @@ if(TEST) target_link_libraries(libyuv_unittest glibc-compat) endif() - target_link_libraries(libyuv_unittest gflags) + find_library(GFLAGS_LIBRARY gflags) + if(NOT GFLAGS_LIBRARY STREQUAL "GFLAGS_LIBRARY-NOTFOUND") + target_link_libraries(libyuv_unittest gflags) + add_definitions(-DLIBYUV_USE_GFLAGS) + endif() endif()