Commit ee99cb13 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Generate the CMake script to find belle-sip dynamically.

parent 263deed9
......@@ -149,22 +149,25 @@ if(NOT MSVC)
add_definitions(-Werror -Wno-error=pragmas)
endif()
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if(APPLE)
set(LINK_FLAGS "${LINK_FLAGS} -framework CoreFoundation -framework CFNetwork")
endif()
if(WIN32)
add_definitions(-DBELLESIP_EXPORTS)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FindBelleSIP.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindBelleSIP.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindBelleSIP.cmake
DESTINATION share/cmake/Modules
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
add_subdirectory(include)
add_subdirectory(src)
if(${ENABLE_TESTS})
enable_testing()
add_subdirectory(tester)
endif()
install(FILES FindBelleSIP.cmake
DESTINATION share/cmake/Modules
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
......@@ -25,6 +25,7 @@
# BELLESIP_FOUND - system has belle-sip
# BELLESIP_INCLUDE_DIRS - the belle-sip include directory
# BELLESIP_LIBRARIES - The libraries needed to use belle-sip
# BELLESIP_LDFLAGS - The linking flags needed to use belle-sip
find_package(Antlr3 REQUIRED)
find_package(PolarSSL)
......@@ -50,6 +51,18 @@ find_library(BELLESIP_LIBRARIES
PATH_SUFFIXES bin lib
)
if(@HAVE_LIBDL@)
list(APPEND BELLESIP_LIBRARIES dl)
endif()
if(@HAVE_LIBRT@)
list(APPEND BELLESIP_LIBRARIES rt)
endif()
if(@HAVE_RESINIT@)
list(APPEND BELLESIP_LIBRARIES resolv)
endif()
if(APPLE)
set(BELLESIP_LDFLAGS "-framework CoreFoundation -framework CFNetwork")
endif()
if(ANTLR3C_FOUND)
list(APPEND BELLESIP_INCLUDE_DIRS ${ANTLR3C_INCLUDE_DIRS})
list(APPEND BELLESIP_LIBRARIES ${ANTLR3C_LIBRARIES})
......@@ -67,4 +80,4 @@ find_package_handle_standard_args(BelleSIP
BELLESIP_INCLUDE_DIRS BELLESIP_LIBRARIES
)
mark_as_advanced(BELLESIP_INCLUDE_DIRS BELLESIP_LIBRARIES)
mark_as_advanced(BELLESIP_INCLUDE_DIRS BELLESIP_LIBRARIES BELLESIP_LDFLAGS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment