Commit 1d12ff45 authored by Ghislain MARY's avatar Ghislain MARY

Some more cleaning to CMakeLists.txt.

parent b742a4cf
...@@ -46,23 +46,20 @@ include(CMakePushCheckState) ...@@ -46,23 +46,20 @@ include(CMakePushCheckState)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if (ENABLE_MBEDTLS) if(ENABLE_MBEDTLS)
find_package(MbedTLS) find_package(MbedTLS)
if (MBEDTLS_FOUND) if(MBEDTLS_FOUND)
message("Use mbedTLS") message("Use mbedTLS")
endif() endif()
elseif (ENABLE_POLARSSL) endif()
find_package(PolarSSL) if(ENABLE_POLARSSL AND NOT MBEDTLS_FOUND)
if (POLARSSL_FOUND) find_package(PolarSSL REQUIRED)
if(POLARSSL_FOUND)
message("Use polarSSL") message("Use polarSSL")
else()
message(FATAL_ERROR " No polarSSL or mbedTLS found")
endif() endif()
else ()
message(FATAL_ERROR "Neither polarSSL nor mbedTLS enabled")
endif() endif()
if (HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE) if(HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE)
message("DTLS SRTP available") message("DTLS SRTP available")
set(HAVE_DTLS_SRTP 1) set(HAVE_DTLS_SRTP 1)
else() else()
...@@ -74,10 +71,11 @@ set(exec_prefix ${prefix}/bin) ...@@ -74,10 +71,11 @@ set(exec_prefix ${prefix}/bin)
set(libdir ${prefix}/lib) set(libdir ${prefix}/lib)
set(includedir ${prefix}/include) set(includedir ${prefix}/include)
if (ENABLE_MBEDTLS AND MBEDTLS_FOUND) if(MBEDTLS_FOUND)
get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARIES}" PATH) get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARIES}" PATH)
set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedlts_library_path}") set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedlts_library_path}")
elseif(ENABLE_POLARSSL AND POLARSSL_FOUND) endif()
if(POLARSSL_FOUND)
get_filename_component(polarssl_library_path "${POLARSSL_LIBRARIES}" PATH) get_filename_component(polarssl_library_path "${POLARSSL_LIBRARIES}" PATH)
set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${polarssl_library_path} -lpolarssl") set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${polarssl_library_path} -lpolarssl")
endif() endif()
...@@ -92,9 +90,10 @@ include_directories( ...@@ -92,9 +90,10 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
if (ENABLE_MBEDTLS AND MBEDTLS_FOUND) if(MBEDTLS_FOUND)
include_directories(${MBEDTLS_INCLUDE_DIRS}) include_directories(${MBEDTLS_INCLUDE_DIRS})
elseif(ENABLE_POLARSSL AND POLARSSL_FOUND) endif()
if(POLARSSL_FOUND)
include_directories(${POLARSSL_INCLUDE_DIRS}) include_directories(${POLARSSL_INCLUDE_DIRS})
endif() endif()
......
...@@ -24,16 +24,11 @@ ...@@ -24,16 +24,11 @@
set(BCTOOLBOX_SOURCE_FILES set(BCTOOLBOX_SOURCE_FILES
) )
if(MBEDTLS_FOUND)
list(APPEND BCTOOLBOX_SOURCE_FILES crypto_mbedtls.c)
endif()
if(POLARSSL_FOUND) if(POLARSSL_FOUND)
set(BCTOOLBOX_SOURCE_FILES list(APPEND BCTOOLBOX_SOURCE_FILES crypto_polarssl.c)
${BCTOOLBOX_SOURCE_FILES}
crypto_polarssl.c
)
elseif(MBEDTLS_FOUND)
set(BCTOOLBOX_SOURCE_FILES
${BCTOOLBOX_SOURCE_FILES}
crypto_mbedtls.c
)
endif() endif()
if(ENABLE_STATIC) if(ENABLE_STATIC)
...@@ -53,12 +48,13 @@ else() ...@@ -53,12 +48,13 @@ else()
endif() endif()
if(MBEDTLS_FOUND)
target_include_directories(bctoolbox PUBLIC ${MBEDTLS_INCLUDE_DIRS})
target_link_libraries(bctoolbox ${MBEDTLS_LIBRARIES})
endif()
if(POLARSSL_FOUND) if(POLARSSL_FOUND)
target_include_directories(bctoolbox PUBLIC ${POLARSSL_INCLUDE_DIRS}) target_include_directories(bctoolbox PUBLIC ${POLARSSL_INCLUDE_DIRS})
target_link_libraries(bctoolbox ${POLARSSL_LIBRARIES}) target_link_libraries(bctoolbox ${POLARSSL_LIBRARIES})
elseif(MBEDTLS_FOUND)
target_include_directories(bctoolbox PUBLIC ${MBEDTLS_INCLUDE_DIRS})
target_link_libraries(bctoolbox ${MBEDTLS_LIBRARIES})
endif() endif()
......
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