mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-27 01:14:51 +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/
|
# gflags - http://code.google.com/p/gflags/
|
||||||
################################################################################
|
################################################################################
|
||||||
set(LOCAL_GFLAGS false CACHE STRING "GFlags installed on the system")
|
set(LOCAL_GFLAGS false)
|
||||||
set(GFlags_ROOT_DIR false)
|
set(gflags_RELEASE 2.0)
|
||||||
set(gflags_RELEASE 2.0 CACHE STRING "Local gflags release")
|
|
||||||
find_package(GFlags)
|
find_package(GFlags)
|
||||||
|
|
||||||
if (NOT GFlags_FOUND)
|
if (NOT GFlags_FOUND)
|
||||||
message (STATUS " gflags library has not been found.")
|
message (STATUS " gflags library has not been found.")
|
||||||
message (STATUS " gflags will be downloaded and built automatically ")
|
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)
|
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})
|
add_dependencies(gflags gflags-${gflags_RELEASE})
|
||||||
set(GFlags_LIBS gflags)
|
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}*")
|
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 gflags-${gflags_RELEASE})
|
||||||
set(GFlags_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}/.libs )
|
set(GFlags_LIBRARY_PATH ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}/.libs )
|
||||||
|
@ -18,25 +18,15 @@
|
|||||||
# GFlags_LIBS
|
# GFlags_LIBS
|
||||||
# GFlags_LIBRARY_DIRS
|
# GFlags_LIBRARY_DIRS
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
#cmake_policy(SET CMP0011 OLD)
|
|
||||||
|
|
||||||
set(GFlags_ROOT_DIR)
|
if(APPLE)
|
||||||
if (WIN32)
|
|
||||||
FIND_PATH(GFlags_ROOT_DIR
|
|
||||||
src/gflags.cc
|
|
||||||
HINTS
|
|
||||||
$ENV{GFLAGS_ROOT})
|
|
||||||
endif (WIN32)
|
|
||||||
if (APPLE)
|
|
||||||
FIND_PATH(GFlags_ROOT_DIR
|
FIND_PATH(GFlags_ROOT_DIR
|
||||||
libgflags.dylib
|
libgflags.dylib
|
||||||
HINTS
|
PATHS
|
||||||
/opt/local/lib
|
/opt/local/lib
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
)
|
)
|
||||||
endif (APPLE)
|
else(APPLE)
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
FIND_PATH(GFlags_ROOT_DIR
|
FIND_PATH(GFlags_ROOT_DIR
|
||||||
libgflags.so
|
libgflags.so
|
||||||
HINTS
|
HINTS
|
||||||
@ -49,17 +39,10 @@ if (UNIX)
|
|||||||
/usr/lib64
|
/usr/lib64
|
||||||
/usr/lib
|
/usr/lib
|
||||||
)
|
)
|
||||||
endif (UNIX)
|
endif(APPLE)
|
||||||
|
|
||||||
IF(GFlags_ROOT_DIR)
|
IF(GFlags_ROOT_DIR)
|
||||||
# We are testing only a couple of files in the include directories
|
# 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
|
FIND_PATH(GFlags_INCLUDE_DIRS
|
||||||
gflags/gflags.h
|
gflags/gflags.h
|
||||||
HINTS
|
HINTS
|
||||||
@ -68,28 +51,11 @@ IF(GFlags_ROOT_DIR)
|
|||||||
/usr/include
|
/usr/include
|
||||||
${GFlags_ROOT_DIR}/src
|
${GFlags_ROOT_DIR}/src
|
||||||
)
|
)
|
||||||
endif (WIN32)
|
|
||||||
|
|
||||||
# Find the libraries
|
# Find the libraries
|
||||||
SET(GFlags_LIBRARY_DIRS ${GFlags_ROOT_DIR})
|
SET(GFlags_LIBRARY_DIRS ${GFlags_ROOT_DIR})
|
||||||
|
|
||||||
# TODO: This can use some per-component linking
|
FIND_LIBRARY(GFlags_lib gflags ${GFlags_LIBRARY_DIRS})
|
||||||
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()
|
|
||||||
|
|
||||||
# set up include and link directory
|
# set up include and link directory
|
||||||
include_directories(${GFlags_INCLUDE_DIRS})
|
include_directories(${GFlags_INCLUDE_DIRS})
|
||||||
@ -99,8 +65,6 @@ IF(GFlags_ROOT_DIR)
|
|||||||
SET(GFlags_FOUND true)
|
SET(GFlags_FOUND true)
|
||||||
MARK_AS_ADVANCED(GFlags_INCLUDE_DIRS)
|
MARK_AS_ADVANCED(GFlags_INCLUDE_DIRS)
|
||||||
ELSE(GFlags_ROOT_DIR)
|
ELSE(GFlags_ROOT_DIR)
|
||||||
FIND_PATH(GFlags_ROOT_DIR src)
|
|
||||||
MARK_AS_ADVANCED(GFlags_ROOT_DIR)
|
|
||||||
MESSAGE(STATUS "Cannot find gflags")
|
MESSAGE(STATUS "Cannot find gflags")
|
||||||
SET(GFlags_FOUND false)
|
SET(GFlags_FOUND false)
|
||||||
ENDIF(GFlags_ROOT_DIR)
|
ENDIF(GFlags_ROOT_DIR)
|
||||||
|
Loading…
Reference in New Issue
Block a user