Commit 23232b10 authored by Ghislain MARY's avatar Ghislain MARY

Handle libnotify support when building with CMake.

parent 1fb767e2
......@@ -41,9 +41,9 @@ option(ENABLE_DATE "Use build date in internal version number." NO)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES)
option(ENABLE_LDAP "Enable LDAP support." NO)
option(ENABLE_MSG_STORAGE "Turn on compilation of message storage." YES)
option(ENABLE_NOTIFY "Enable libnotify support." YES)
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI" NO)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_TOOLS "Turn on or off compilation of console interface" YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
option(ENABLE_TUNNEL "Turn on compilation of tunnel support." NO)
option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)
......@@ -52,13 +52,14 @@ option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/share/cmake/Modules")
include(CheckIncludeFile)
include(CheckSymbolExists)
if(MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CMAKE_PREFIX_PATH}/include/MSVC")
endif()
find_package(BelleSIP REQUIRED)
......@@ -82,7 +83,16 @@ if(ENABLE_TUNNEL)
find_package(Tunnel)
if(NOT TUNNEL_FOUND)
message(WARNING "Could not find the tunnel library!")
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support" FORCE)
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support." FORCE)
endif()
endif()
if(ENABLE_NOTIFY)
find_package(Notify)
if(NOTIFY_FOUND)
set(HAVE_NOTIFY4 1)
else()
message(WARNING "Could not find the notify library!")
set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE)
endif()
endif()
......@@ -157,7 +167,7 @@ if(ENABLE_UNIT_TESTS)
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindLinphone.cmake
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLinphone.cmake
DESTINATION share/cmake/Modules
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
############################################################################
# FindLinphone.txt
# FindLinphone.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
......@@ -33,7 +33,7 @@ find_package(MS2 REQUIRED)
find_package(XML2 REQUIRED)
find_package(BelleSIP REQUIRED)
set(_LINPHONEROOT_PATHS
set(_LINPHONE_ROOT_PATHS
${WITH_LINPHONE}
${CMAKE_INSTALL_PREFIX}
)
......
############################################################################
# FindNotify.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
#
# - Find the notify include file and library
#
# NOTIFY_FOUND - system has linphone
# NOTIFY_INCLUDE_DIRS - the linphone include directory
# NOTIFY_LIBRARIES - The libraries needed to use linphone
set(_NOTIFY_ROOT_PATHS
${WITH_NOTIFY}
${CMAKE_INSTALL_PREFIX}
)
find_path(NOTIFY_INCLUDE_DIRS
NAMES libnotify/notify.h
HINTS _NOTIFY_ROOT_PATHS
PATH_SUFFIXES include
)
if(NOTIFY_INCLUDE_DIRS)
set(HAVE_LIBNOTIFY_NOTIFY_H 1)
endif()
find_library(NOTIFY_LIBRARIES
NAMES notify
HINTS ${_NOTIFY_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Notify
DEFAULT_MSG
NOTIFY_INCLUDE_DIRS NOTIFY_LIBRARIES HAVE_LIBNOTIFY_NOTIFY_H
)
mark_as_advanced(NOTIFY_INCLUDE_DIRS NOTIFY_LIBRARIES HAVE_LIBNOTIFY_NOTIFY_H)
......@@ -36,5 +36,6 @@
#define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}"
#define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}"
#cmakedefine HAVE_NOTIFY4
#cmakedefine HAVE_CU_GET_SUITE 1
#cmakedefine HAVE_CU_CURSES 1
\ No newline at end of file
......@@ -69,6 +69,10 @@ add_executable(linphone-gtk ${SOURCE_FILES})
set_target_properties(linphone-gtk PROPERTIES OUTPUT_NAME linphone)
target_include_directories(linphone-gtk PUBLIC ${GTK2_INCLUDE_DIRS})
target_link_libraries(linphone-gtk linphone ${GTK2_LIBRARIES})
if(ENABLE_NOTIFY)
target_include_directories(linphone-gtk PUBLIC ${NOTIFY_INCLUDE_DIRS})
target_link_libraries(linphone-gtk ${NOTIFY_LIBRARIES})
endif()
install(TARGETS linphone-gtk
RUNTIME DESTINATION bin
......
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