Commit f4f8f1af authored by Ghislain MARY's avatar Ghislain MARY

Use local CMake find modules.

parent c53b0501
......@@ -48,8 +48,7 @@ include(CheckCSourceCompiles)
if(MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # TODO: remove when FindTunnel has been put in tunnel repository
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
check_include_file("dlfcn.h" HAVE_DLFCN_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
......@@ -80,6 +79,13 @@ endif()
find_package(Threads)
find_package(Antlr3 REQUIRED)
if(ANTLR3C_FOUND)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${ANTLR3C_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ANTLR3C_LIBRARIES})
check_symbol_exists("antlr3StringStreamNew" "antlr3.h" HAVE_ANTLR_STRING_STREAM_NEW)
cmake_pop_check_state()
endif()
if(ENABLE_TLS)
find_package(PolarSSL REQUIRED)
......@@ -185,9 +191,9 @@ export(EXPORT BelleSIPTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/BelleSIPTargets.cmake"
NAMESPACE BelledonneCommunications::
)
configure_file(BelleSIPConfig.cmake
configure_file(cmake/BelleSIPConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/BelleSIPConfig.cmake"
COPYONLY
@ONLY
)
set(ConfigPackageLocation lib/cmake/BelleSIP)
......@@ -197,7 +203,7 @@ install(EXPORT BelleSIPTargets
DESTINATION ${ConfigPackageLocation}
)
install(FILES
BelleSIPConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/BelleSIPConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/BelleSIPConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
)
......@@ -26,10 +26,12 @@
# 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
include("${CMAKE_CURRENT_LIST_DIR}/BelleSIPTargets.cmake")
get_filename_component(BELLESIP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(BELLESIP_INCLUDE_DIRS "${BELLESIP_CMAKE_DIR}/../../../include")
set(BELLESIP_LIBRARIES BelledonneCommunications::bellesip)
set(BELLESIP_LDFLAGS @LINK_FLAGS@)
set(BELLESIP_FOUND 1)
############################################################################
# FindAntlr3.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 antlr3c include file and library and antlr.jar
#
# ANTLR3C_FOUND - system has antlr3c
# ANTLR3C_INCLUDE_DIR - the antlr3c include directory
# ANTLR3C_LIBRARIES - The libraries needed to use antlr3c
# ANTLR3_COMMAND - The command to run the antlr jar
find_package(Java COMPONENTS Runtime REQUIRED)
set(_ANTLR3C_ROOT_PATHS
${CMAKE_INSTALL_PREFIX}
)
set(_ANTLR3_JAR_ROOT_PATHS
${CMAKE_INSTALL_PREFIX}
/usr/local
/usr
/opt/local
)
find_path(ANTLR3C_INCLUDE_DIRS
NAMES antlr3.h
HINTS _ANTLR3C_ROOT_PATHS
PATH_SUFFIXES include
)
if(ANTLR3C_INCLUDE_DIRS)
set(HAVE_ANTLR3_H 1)
endif()
find_library(ANTLR3C_LIBRARIES
NAMES antlr3c
HINTS _ANTLR3C_ROOT_PATHS
PATH_SUFFIXES bin lib
)
find_file(ANTLR3_COMMAND
NAMES antlr3
HINTS ${_ANTLR3_JAR_ROOT_PATHS}
PATH_SUFFIXES bin
)
if(NOT ANTLR3_COMMAND)
# antlr3 command not found, search for the jar file
find_file(ANTLR3_JAR_PATH
NAMES antlr3.jar antlr.jar
HINTS _ANTLR3_JAR_ROOT_PATHS
PATH_SUFFIXES share/java
)
if(ANTLR3_JAR_PATH)
set(ANTLR3_COMMAND ${Java_JAVA_EXECUTABLE} -Xmx256m -jar ${ANTLR3_JAR_PATH})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Antlr3
DEFAULT_MSG
ANTLR3C_INCLUDE_DIRS ANTLR3C_LIBRARIES ANTLR3_COMMAND
)
mark_as_advanced(ANTLR3C_INCLUDE_DIRS ANTLR3C_LIBRARIES ANTLR3_COMMAND)
############################################################################
# FindCUnit.txt
# Copyright (C) 2015 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 CUnit include file and library
#
# CUNIT_FOUND - system has CUnit
# CUNIT_INCLUDE_DIRS - the CUnit include directory
# CUNIT_LIBRARIES - The libraries needed to use CUnit
include(CheckIncludeFile)
include(CheckLibraryExists)
set(_CUNIT_ROOT_PATHS
${CMAKE_INSTALL_PREFIX}
)
find_path(CUNIT_INCLUDE_DIRS
NAMES CUnit/CUnit.h
HINTS _CUNIT_ROOT_PATHS
PATH_SUFFIXES include
)
if(CUNIT_INCLUDE_DIRS)
set(HAVE_CUNIT_CUNIT_H 1)
endif()
find_library(CUNIT_LIBRARIES
NAMES cunit
HINTS ${_CUNIT_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUnit
DEFAULT_MSG
CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES
)
mark_as_advanced(CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES)
############################################################################
# FindPolarSSL.txt
# Copyright (C) 2015 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 polarssl include file and library
#
# POLARSSL_FOUND - system has polarssl
# POLARSSL_INCLUDE_DIRS - the polarssl include directory
# POLARSSL_LIBRARIES - The libraries needed to use polarssl
include(CMakePushCheckState)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
set(_POLARSSL_ROOT_PATHS
${CMAKE_INSTALL_PREFIX}
)
find_path(POLARSSL_INCLUDE_DIRS
NAMES polarssl/ssl.h
HINTS _POLARSSL_ROOT_PATHS
PATH_SUFFIXES include
)
if(POLARSSL_INCLUDE_DIRS)
set(HAVE_POLARSSL_SSL_H 1)
endif()
find_library(POLARSSL_LIBRARIES
NAMES polarssl
HINTS _POLARSSL_ROOT_PATHS
PATH_SUFFIXES bin lib
)
if(POLARSSL_LIBRARIES)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${POLARSSL_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${POLARSSL_LIBRARIES})
check_c_source_compiles("#include <polarssl/version.h>
#include <polarssl/x509.h>
#if POLARSSL_VERSION_NUMBER >= 0x01030000
#include <polarssl/compat-1.2.h>
#endif
int main(int argc, char *argv[]) {
x509parse_crtpath(0,0);
return 0;
}"
X509PARSE_CRTPATH_OK)
cmake_pop_check_state()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PolarSSL
DEFAULT_MSG
POLARSSL_INCLUDE_DIRS POLARSSL_LIBRARIES
)
mark_as_advanced(POLARSSL_INCLUDE_DIRS POLARSSL_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