Use gflags ALIAS instead of ${gflags_XXX} vars
authorBrian Orr <brian.orr@gmail.com>
Thu, 22 Jun 2017 07:25:13 +0000 (00:25 -0700)
committerBrian Orr <brian.orr@gmail.com>
Thu, 22 Jun 2017 07:25:13 +0000 (00:25 -0700)
The gflags project updated their CMake config last year with a
`gflags` ALIAS target. This can be used instead of the legacy
`${gflags_LIBRARIES}` and `${gflags_INCLUDE_DIRS}` variables. It also
looks cleaner.

Fixes #198

CMakeLists.txt

index 7415eab..9852df1 100644 (file)
@@ -397,8 +397,7 @@ if (WIN32 AND HAVE_SNPRINTF)
 endif (WIN32 AND HAVE_SNPRINTF)
 
 if (gflags_FOUND)
-  target_include_directories (glog PUBLIC $<BUILD_INTERFACE:${gflags_INCLUDE_DIR}>)
-  target_link_libraries (glog PUBLIC ${gflags_LIBRARIES})
+  target_link_libraries (glog PUBLIC gflags)
 
   if (NOT BUILD_SHARED_LIBS)
     # Don't use __declspec(dllexport|dllimport) if this is a static build