Commit ea8257c0 authored by Ghislain MARY's avatar Ghislain MARY

Improve CMakeLists.txt and add CMake script to find the srtp library.

parent 6c59f37d
......@@ -24,12 +24,12 @@ cmake_minimum_required(VERSION 2.8)
project(BZRTP C)
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." OFF)
option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." NO)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
if(${ENABLE_TESTS})
if(ENABLE_TESTS)
find_package(CUnit)
if(CUNIT_FOUND)
check_library_exists(${CUNIT_LIBRARIES} "CU_add_suite" "" HAVE_CU_ADD_SUITE)
......@@ -65,7 +65,12 @@ set(LIBS ${CUNIT_LIBRARIES} ${POLARSSL_LIBRARIES} ${XML2_LIBRARIES})
add_subdirectory(include)
add_subdirectory(src)
if(${ENABLE_TESTS})
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(test)
endif()
install(FILES FindBZRTP.cmake
DESTINATION share/cmake/Modules
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
############################################################################
# FindBZRTP.txt
# 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 bzrtp include file and library
#
# BZRTP_FOUND - system has bzrtp
# BZRTP_INCLUDE_DIRS - the bzrtp include directory
# BZRTP_LIBRARIES - The libraries needed to use bzrtp
set(_BZRTP_ROOT_PATHS
${WITH_BZRTP}
${CMAKE_INSTALL_PREFIX}
)
find_path(BZRTP_INCLUDE_DIRS
NAMES bzrtp/bzrtp.h
HINTS _BZRTP_ROOT_PATHS
PATH_SUFFIXES include
)
if(BZRTP_INCLUDE_DIRS)
set(HAVE_BZRTP_BZRTP_H 1)
endif()
find_library(BZRTP_LIBRARIES
NAMES bzrtp
HINTS ${_BZRTP_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BZRTP
DEFAULT_MSG
BZRTP_INCLUDE_DIRS BZRTP_LIBRARIES
)
mark_as_advanced(BZRTP_INCLUDE_DIRS BZRTP_LIBRARIES)
......@@ -29,10 +29,10 @@ set(SOURCE_FILES
zidCache.c
)
if(${ENABLE_STATIC})
if(ENABLE_STATIC)
add_library(bzrtp STATIC ${SOURCE_FILES})
target_link_libraries(bzrtp ${LIBS})
else(${ENABLE_STATIC})
else()
add_library(bzrtp SHARED ${SOURCE_FILES})
set_target_properties(bzrtp PROPERTIES VERSION 0.1 SOVERSION 0)
target_link_libraries(bzrtp ${LIBS})
......@@ -42,9 +42,9 @@ else(${ENABLE_STATIC})
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif(MSVC)
endif(${ENABLE_STATIC})
endif()
endif()
endif()
install(TARGETS bzrtp
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