mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-26 00:46:59 +00:00
Fixing gflags detection if CMake was run twice
This commit is contained in:
parent
d04eec0033
commit
0865c4af7a
@ -391,11 +391,9 @@ endif(NOT VOLK_GNSSSDR_FOUND)
|
||||
################################################################################
|
||||
# gflags - http://code.google.com/p/gflags/
|
||||
################################################################################
|
||||
set(LOCAL_GFLAGS false CACHE STRING "GFlags installed on the system")
|
||||
set(GFlags_ROOT_DIR false)
|
||||
set(gflags_RELEASE 2.0 CACHE STRING "Local gflags release")
|
||||
set(LOCAL_GFLAGS false)
|
||||
set(gflags_RELEASE 2.0)
|
||||
find_package(GFlags)
|
||||
|
||||
if (NOT GFlags_FOUND)
|
||||
message (STATUS " gflags library has not been found.")
|
||||
message (STATUS " gflags will be downloaded and built automatically ")
|
||||
@ -447,7 +445,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags/gflags-${gflags_RELEASE}/configure
|
||||
set_property(TARGET gflags PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}gflags.a)
|
||||
add_dependencies(gflags gflags-${gflags_RELEASE})
|
||||
set(GFlags_LIBS gflags)
|
||||
set(GFlags_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE} CACHE PATH "GFlags root folder" FORCE)
|
||||
file(GLOB GFlags_SHARED_LIBS "${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_SHARED_LIBRARY_SUFFIX}*")
|
||||
set(GFlags_LIBRARY gflags-${gflags_RELEASE})
|
||||
set(GFlags_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}/.libs )
|
||||
|
@ -18,25 +18,15 @@
|
||||
# GFlags_LIBS
|
||||
# GFlags_LIBRARY_DIRS
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
#cmake_policy(SET CMP0011 OLD)
|
||||
|
||||
set(GFlags_ROOT_DIR)
|
||||
if (WIN32)
|
||||
FIND_PATH(GFlags_ROOT_DIR
|
||||
src/gflags.cc
|
||||
HINTS
|
||||
$ENV{GFLAGS_ROOT})
|
||||
endif (WIN32)
|
||||
if (APPLE)
|
||||
if(APPLE)
|
||||
FIND_PATH(GFlags_ROOT_DIR
|
||||
libgflags.dylib
|
||||
HINTS
|
||||
PATHS
|
||||
/opt/local/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
endif (APPLE)
|
||||
|
||||
if (UNIX)
|
||||
)
|
||||
else(APPLE)
|
||||
FIND_PATH(GFlags_ROOT_DIR
|
||||
libgflags.so
|
||||
HINTS
|
||||
@ -49,17 +39,10 @@ if (UNIX)
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
)
|
||||
endif (UNIX)
|
||||
endif(APPLE)
|
||||
|
||||
IF(GFlags_ROOT_DIR)
|
||||
# We are testing only a couple of files in the include directories
|
||||
if (WIN32)
|
||||
FIND_PATH(GFlags_INCLUDE_DIRS
|
||||
gflags/gflags.h
|
||||
HINTS
|
||||
${GFlags_ROOT_DIR}/src/windows
|
||||
)
|
||||
else (WIN32)
|
||||
FIND_PATH(GFlags_INCLUDE_DIRS
|
||||
gflags/gflags.h
|
||||
HINTS
|
||||
@ -68,28 +51,11 @@ IF(GFlags_ROOT_DIR)
|
||||
/usr/include
|
||||
${GFlags_ROOT_DIR}/src
|
||||
)
|
||||
endif (WIN32)
|
||||
|
||||
# Find the libraries
|
||||
SET(GFlags_LIBRARY_DIRS ${GFlags_ROOT_DIR})
|
||||
|
||||
# TODO: This can use some per-component linking
|
||||
if(MSVC)
|
||||
SET(_gflags_libpath_suffixes /Release /Debug)
|
||||
FIND_LIBRARY(GFlags_lib_release
|
||||
NAMES libgflags
|
||||
HINTS
|
||||
${GFlags_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES ${_gflags_libpath_suffixes})
|
||||
FIND_LIBRARY(GFlags_lib_debug
|
||||
NAMES libgflags-debug
|
||||
HINTS
|
||||
${GFlags_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES ${_gflags_libpath_suffixes})
|
||||
SET(GFlags_lib optimized ${GFlags_lib_release} debug ${GFlags_lib_debug})
|
||||
else()
|
||||
FIND_LIBRARY(GFlags_lib gflags ${GFlags_LIBRARY_DIRS})
|
||||
endif()
|
||||
FIND_LIBRARY(GFlags_lib gflags ${GFlags_LIBRARY_DIRS})
|
||||
|
||||
# set up include and link directory
|
||||
include_directories(${GFlags_INCLUDE_DIRS})
|
||||
@ -99,8 +65,6 @@ IF(GFlags_ROOT_DIR)
|
||||
SET(GFlags_FOUND true)
|
||||
MARK_AS_ADVANCED(GFlags_INCLUDE_DIRS)
|
||||
ELSE(GFlags_ROOT_DIR)
|
||||
FIND_PATH(GFlags_ROOT_DIR src)
|
||||
MARK_AS_ADVANCED(GFlags_ROOT_DIR)
|
||||
MESSAGE(STATUS "Cannot find gflags")
|
||||
SET(GFlags_FOUND false)
|
||||
ENDIF(GFlags_ROOT_DIR)
|
||||
|
Loading…
Reference in New Issue
Block a user