diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d91afd8e4063bd7b8d770beadfbbe555516e1e9..babea3ee9448486ff768e1b8146e060c2481feb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/FindLinphone.cmake b/cmake/FindLinphone.cmake similarity index 98% rename from FindLinphone.cmake rename to cmake/FindLinphone.cmake index 6c6871330c3543eea18bd1e105f13eff7b446fa8..065e1c8655ae65fcfb1356c89b5073843667bf3e 100644 --- a/FindLinphone.cmake +++ b/cmake/FindLinphone.cmake @@ -1,5 +1,5 @@ ############################################################################ -# 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} ) diff --git a/cmake/FindNotify.cmake b/cmake/FindNotify.cmake new file mode 100644 index 0000000000000000000000000000000000000000..26bd5bac143a9e6ddce8717bc114597060cf25b6 --- /dev/null +++ b/cmake/FindNotify.cmake @@ -0,0 +1,56 @@ +############################################################################ +# 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) diff --git a/config.h.cmake b/config.h.cmake index a7020d97af618178ebf8776c0aa73ca3dfba0200..9690bff2712eb1acc6bcb426d89d15f9a8300c06 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -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 diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index 6bc50e5e95508a199968dc8537fe2982e3bec846..e5d66561b41a20ebe03d466c4b51d5e105abc415 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -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