summaryrefslogtreecommitdiffstats
path: root/cmake/FindIlbc.cmake
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2018-02-13 10:29:31 -0500
committerFrédéric Brière <fbriere@fbriere.net>2019-12-29 02:39:51 -0500
commit6952b81fe89a136c0d087aa98cfbfd8bfc965818 (patch)
tree27c95e8e3cf97fae341d7a042ce9d192d17e1155 /cmake/FindIlbc.cmake
parent5635f7c2483c4ceac5c0e1cf5e522f7be32fd2f1 (diff)
downloadtwinkle-6952b81fe89a136c0d087aa98cfbfd8bfc965818.tar
twinkle-6952b81fe89a136c0d087aa98cfbfd8bfc965818.tar.gz
twinkle-6952b81fe89a136c0d087aa98cfbfd8bfc965818.tar.lz
twinkle-6952b81fe89a136c0d087aa98cfbfd8bfc965818.tar.xz
twinkle-6952b81fe89a136c0d087aa98cfbfd8bfc965818.zip
CMake: Check if libilbc links without 'extern "C"' (ILBC_CPP)
This variable was originally set manually in configure.in.
Diffstat (limited to 'cmake/FindIlbc.cmake')
-rw-r--r--cmake/FindIlbc.cmake19
1 files changed, 19 insertions, 0 deletions
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 <ilbc/iLBC_decode.h>
+
+ 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)