1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- include(FindPackageHandleStandardArgs)
- set(GFLAGS_ROOT_DIR "" CACHE PATH "Folder contains Gflags")
- if(WIN32)
- find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
- PATHS ${GFLAGS_ROOT_DIR}/src/windows)
- else()
- find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
- PATHS ${GFLAGS_ROOT_DIR})
- endif()
- if(MSVC)
- find_library(GFLAGS_LIBRARY_RELEASE
- NAMES libgflags
- PATHS ${GFLAGS_ROOT_DIR}
- PATH_SUFFIXES Release)
- find_library(GFLAGS_LIBRARY_DEBUG
- NAMES libgflags-debug
- PATHS ${GFLAGS_ROOT_DIR}
- PATH_SUFFIXES Debug)
- set(GFLAGS_LIBRARY optimized ${GFLAGS_LIBRARY_RELEASE} debug ${GFLAGS_LIBRARY_DEBUG})
- else()
- find_library(GFLAGS_LIBRARY gflags)
- endif()
- find_package_handle_standard_args(GFlags DEFAULT_MSG GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
- if(GFLAGS_FOUND)
- set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
- set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY})
- message(STATUS "Found gflags (include: ${GFLAGS_INCLUDE_DIR}, library: ${GFLAGS_LIBRARY})")
- mark_as_advanced(GFLAGS_LIBRARY_DEBUG GFLAGS_LIBRARY_RELEASE
- GFLAGS_LIBRARY GFLAGS_INCLUDE_DIR GFLAGS_ROOT_DIR)
- else()
- message(FATAL_ERROR "gflags not found!")
- endif()
|