1
0
Fork 0

Fix for CMake/system libSGM issue: consistent path

Our copy of libGSM, and a system-wide version have different include
suffixes, so adjust the FindGsm.cmake so that the returned include-path
is consistent with our internal version.

See discussion in:https://sourceforge.net/p/flightgear/codetickets/2368/
This commit is contained in:
James Turner 2020-09-03 18:01:31 +01:00 committed by James Turner
parent 1f6b43c38f
commit 22bad9db33
2 changed files with 7 additions and 9 deletions

View file

@ -55,7 +55,7 @@ if (SYSTEM_GSM)
find_package(Gsm)
endif(SYSTEM_GSM)
if (GSM_FOUND)
if (SYSTEM_GSM AND GSM_FOUND)
message(STATUS "Using GSM includes at: ${GSM_INCLUDE_DIR}")
message(STATUS "Using GSM libraries: ${GSM_LIBRARIES}")
target_include_directories(iaxclient_lib PRIVATE ${GSM_INCLUDE_DIR})

View file

@ -19,19 +19,15 @@ if (GSM_LIBRARIES AND GSM_INCLUDE_DIRS)
# in cache already
set(GSM_FOUND TRUE)
else (GSM_LIBRARIES AND GSM_INCLUDE_DIRS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
#include(UsePkgConfig)
#FIXME pkgconfig does not work: return a carriage return that makes compilation failed
#pkgconfig(speex _GsmIncDir _GsmLinkDir _GsmLinkFlags _GsmCflags)
#set(GSM_DEFINITIONS ${_GsmCflags})
set(GSM_DEFINITIONS "")
# gsm.h might be at $prefix/include/gsm/gsm.h, but our internal
# version is at inc/gsm.h, so we need to include that as a PATH_SUFFIX
# otherwise we get into a mess.
# see: https://sourceforge.net/p/flightgear/codetickets/2368/
find_path(GSM_INCLUDE_DIR
NAMES
gsm/gsm.h
gsm.h
PATHS
${_GsmIncDir}
@ -39,6 +35,8 @@ else (GSM_LIBRARIES AND GSM_INCLUDE_DIRS)
/usr/local/include
/opt/local/include
/sw/include
PATH_SUFFIXES
gsm
)
find_library(GSM_LIBRARY