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

Some more cleaning to CMakeLists.txt.

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