|
|
|
@ -129,7 +129,11 @@ endmacro(GFLAGS_REPORT_NOT_FOUND) |
|
|
|
|
macro(GFLAGS_CHECK_VARS_DEFINED) |
|
|
|
|
foreach(CHECK_VAR ${ARGN}) |
|
|
|
|
if (NOT DEFINED ${CHECK_VAR}) |
|
|
|
|
message(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.") |
|
|
|
|
if(NOT Gflags_FIND_REQUIRED) |
|
|
|
|
gflags_report_not_found("Ceres Bug: ${CHECK_VAR} is not defined.") |
|
|
|
|
else() |
|
|
|
|
message(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
endforeach() |
|
|
|
|
endmacro(GFLAGS_CHECK_VARS_DEFINED) |
|
|
|
@ -283,7 +287,8 @@ if (NOT DEFINED GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION |
|
|
|
|
set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
# Wrap into function because gflags_report_not_found() uses "return" statement |
|
|
|
|
function(__find_exported_gflags) |
|
|
|
|
# Try to find an exported CMake configuration for gflags, as generated by |
|
|
|
|
# gflags versions >= 2.1. |
|
|
|
|
# |
|
|
|
@ -384,9 +389,19 @@ if (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
|
|
|
|
|
if (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
message(STATUS "Detected gflags version: ${gflags_VERSION}") |
|
|
|
|
#set(GFLAGS_FOUND ${gflags_FOUND}) |
|
|
|
|
#set(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR}) |
|
|
|
|
#set(GFLAGS_LIBRARY ${gflags_LIBRARIES}) |
|
|
|
|
if(NOT DEFINED GFLAGS_FOUND AND DEFINED gflags_FOUND) |
|
|
|
|
set(GFLAGS_FOUND ${gflags_FOUND}) |
|
|
|
|
endif() |
|
|
|
|
if(NOT DEFINED GFLAGS_INCLUDE_DIR AND DEFINED gflags_INCLUDE_DIR) |
|
|
|
|
set(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR}) |
|
|
|
|
endif() |
|
|
|
|
if(NOT DEFINED GFLAGS_LIBRARY AND DEFINED gflags_LIBRARIES) |
|
|
|
|
set(GFLAGS_LIBRARY ${gflags_LIBRARIES}) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if(NOT DEFINED GFLAGS_INCLUDE_DIR) |
|
|
|
|
gflags_report_not_found("GFLAGS_INCLUDE_DIR is missing") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# gflags does not export the namespace in their CMake configuration, so |
|
|
|
|
# use our function to determine what it should be, as it can be either |
|
|
|
@ -406,6 +421,15 @@ if (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
message(STATUS "Failed to find an installed/exported CMake configuration " |
|
|
|
|
"for gflags, will perform search for installed gflags components.") |
|
|
|
|
endif (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
|
|
|
|
|
set(GFLAGS_FOUND "${GFLAGS_FOUND}" PARENT_SCOPE) |
|
|
|
|
set(GFLAGS_INCLUDE_DIR "${GFLAGS_INCLUDE_DIR}" PARENT_SCOPE) |
|
|
|
|
set(GFLAGS_LIBRARY "${GFLAGS_LIBRARY}" PARENT_SCOPE) |
|
|
|
|
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE) |
|
|
|
|
endfunction() |
|
|
|
|
|
|
|
|
|
if (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
__find_exported_gflags() |
|
|
|
|
endif(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION) |
|
|
|
|
|
|
|
|
|
if (NOT GFLAGS_FOUND) |
|
|
|
|