FindGFLAGS.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set(_gflags_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  16. find_path(GFLAGS_INCLUDE_PATH gflags/gflags.h)
  17. if (GFLAGS_STATIC)
  18. if (WIN32)
  19. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
  20. else (WIN32)
  21. set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  22. endif (WIN32)
  23. endif (GFLAGS_STATIC)
  24. find_library(GFLAGS_LIBRARY NAMES gflags libgflags)
  25. if(GFLAGS_INCLUDE_PATH AND GFLAGS_LIBRARY)
  26. set(GFLAGS_FOUND TRUE)
  27. endif(GFLAGS_INCLUDE_PATH AND GFLAGS_LIBRARY)
  28. if(GFLAGS_FOUND)
  29. if(NOT GFLAGS_FIND_QUIETLY)
  30. message(STATUS "Found gflags: ${GFLAGS_LIBRARY}")
  31. endif(NOT GFLAGS_FIND_QUIETLY)
  32. else(GFLAGS_FOUND)
  33. if(GFLAGS_FIND_REQUIRED)
  34. message(FATAL_ERROR "Could not find gflags library.")
  35. endif(GFLAGS_FIND_REQUIRED)
  36. endif(GFLAGS_FOUND)
  37. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_gflags_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})