From 6952b81fe89a136c0d087aa98cfbfd8bfc965818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Tue, 13 Feb 2018 10:29:31 -0500 Subject: CMake: Check if libilbc links without 'extern "C"' (ILBC_CPP) This variable was originally set manually in configure.in. --- cmake/FindIlbc.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cmake') diff --git a/cmake/FindIlbc.cmake b/cmake/FindIlbc.cmake index f66ca55..7bbffa9 100644 --- a/cmake/FindIlbc.cmake +++ b/cmake/FindIlbc.cmake @@ -1,8 +1,27 @@ +include (CMakePushCheckState) +include (CheckCXXSourceCompiles) + FIND_PATH(ILBC_INCLUDE_DIR ilbc/iLBC_decode.h) FIND_LIBRARY(ILBC_LIBRARIES NAMES ilbc) IF(ILBC_INCLUDE_DIR AND ILBC_LIBRARIES) SET(ILBC_FOUND TRUE) + + # Check if libilbc can be used without 'extern "C"' + CMAKE_PUSH_CHECK_STATE() + LIST(APPEND CMAKE_REQUIRED_INCLUDES "${ILBC_INCLUDE_DIR}") + LIST(APPEND CMAKE_REQUIRED_LIBRARIES "-lilbc") + SET(CMAKE_REQUIRED_QUIET TRUE) + CHECK_CXX_SOURCE_COMPILES(" + #include + + int main() { + iLBC_Dec_Inst_t *iLBCdec_inst; + initDecode(iLBCdec_inst, 0, 0); + return 0; + } + " ILBC_CPP) + CMAKE_POP_CHECK_STATE() ENDIF(ILBC_INCLUDE_DIR AND ILBC_LIBRARIES) IF(ILBC_FOUND) -- cgit v1.2.3