Commit eee5149d authored by Ghislain MARY's avatar Ghislain MARY

Correct check for tunnel library when building with CMake.

parent cf1005a0
......@@ -81,13 +81,22 @@ find_package(Threads)
find_package(Antlr3 REQUIRED)
if(${ENABLE_TLS})
if(ENABLE_TLS)
find_package(PolarSSL REQUIRED)
if(POLARSSL_FOUND)
set(HAVE_POLARSSL 1)
endif()
endif()
if(${ENABLE_TESTS})
if(ENABLE_TUNNEL)
find_package(Tunnel)
if(TUNNEL_FOUND)
set(HAVE_TUNNEL 1)
else()
message(WARNING "Could not find the tunnel library!")
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support" FORCE)
endif()
endif()
if(ENABLE_TESTS)
find_package(CUnit)
if(CUNIT_FOUND)
check_library_exists(${CUNIT_LIBRARIES} "CU_add_suite" "" HAVE_CU_ADD_SUITE)
......@@ -98,10 +107,6 @@ if(${ENABLE_TESTS})
set(ENABLE_TESTS OFF CACHE BOOL "Enable compilation of tests" FORCE)
endif()
endif()
find_package(Tunnel)
if(TUNNEL_FOUND)
set(HAVE_TUNNEL 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
......@@ -167,7 +172,7 @@ add_subdirectory(include)
add_subdirectory(src)
if(${ENABLE_TESTS})
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(tester)
endif()
############################################################################
# FindTunnel.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 tunnel include file and library
#
# TUNNEL_FOUND - system has tunnel
# TUNNEL_INCLUDE_DIRS - the tunnel include directory
# TUNNEL_LIBRARIES - The libraries needed to use tunnel
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(_TUNNEL QUIET tunnel)
endif(UNIX)
if(WIN32)
set(_TUNNEL_ROOT_PATHS "${CMAKE_INSTALL_PREFIX}")
endif(WIN32)
find_path(TUNNEL_INCLUDE_DIR
NAMES tunnel/common.hh
HINTS _TUNNEL_ROOT_PATHS
PATH_SUFFIXES include
)
if(WIN32)
find_library(TUNNEL_LIBRARIES
NAMES tunnel
HINTS ${_TUNNEL_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
else(WIN32)
find_library(TUNNEL_LIBRARIES
NAMES tunnel
HINTS ${_TUNNEL_LIBDIR}
PATH_SUFFIXES lib
)
endif(WIN32)
if(TUNNEL_INCLUDE_DIR AND TUNNEL_LIBRARIES)
include(CheckIncludeFile)
check_include_file("tunnel/common.hh" HAVE_TUNNEL_COMMON_HH)
endif(TUNNEL_INCLUDE_DIR AND TUNNEL_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(tunnel
REQUIRED_VARS
TUNNEL_LIBRARIES
TUNNEL_INCLUDE_DIR
FAIL_MESSAGE
"Could NOT find tunnel"
)
mark_as_advanced(TUNNEL_INCLUDE_DIR TUNNEL_LIBRARIES)
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