2013-09-03 03:07:47 +02:00
|
|
|
# Locate polarssl library
|
|
|
|
# This module defines
|
|
|
|
# POLARSSL_FOUND
|
|
|
|
# POLARSSL_LIBRARY
|
|
|
|
# POLARSSL_INCLUDE_DIR
|
|
|
|
# POLARSSL_WORKS, this is true if polarssl is found and contains the methods
|
|
|
|
# needed by dolphin-emu
|
|
|
|
|
2014-02-24 19:07:24 +01:00
|
|
|
# validate cached values (but use them as hints)
|
|
|
|
set(POLARSSL_INCLUDE_DIR_HINT POLARSSL_INCLUDE_DIR)
|
|
|
|
set(POLARSSL_LIBRARY_HINT POLARSSL_LIBRARY)
|
|
|
|
unset(POLARSSL_INCLUDE_DIR CACHE)
|
|
|
|
unset(POLARSSL_LIBRARY CACHE)
|
|
|
|
find_path(POLARSSL_INCLUDE_DIR polarssl/ssl.h HINTS ${POLARSSL_INCLUDE_DIR_HINT})
|
|
|
|
find_library(POLARSSL_LIBRARY polarssl HINTS ${POLARSSL_LIBRARY_HINT})
|
|
|
|
|
|
|
|
if(POLARSSL_INCLUDE_DIR STREQUAL POLARSSL_INCLUDE_DIR_HINT AND
|
|
|
|
POLARSSL_LIBRARY STREQUAL POLARSSL_LIBRARY_HINT)
|
|
|
|
# using cached values, be silent
|
2013-09-03 03:07:47 +02:00
|
|
|
set(POLARSSL_FIND_QUIETLY TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (POLARSSL_INCLUDE_DIR AND POLARSSL_LIBRARY)
|
|
|
|
set (POLARSSL_FOUND TRUE)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (POLARSSL_FOUND)
|
|
|
|
if (NOT POLARSSL_FIND_QUIETLY)
|
|
|
|
message (STATUS "Found the polarssl libraries at ${POLARSSL_LIBRARY}")
|
|
|
|
message (STATUS "Found the polarssl headers at ${POLARSSL_INCLUDE_DIR}")
|
|
|
|
endif (NOT POLARSSL_FIND_QUIETLY)
|
|
|
|
|
|
|
|
message(STATUS "Checking to see if system version contains necessary methods")
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${POLARSSL_INCLUDE_DIR})
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${POLARSSL_LIBRARY})
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <polarssl/net.h>
|
|
|
|
#include <polarssl/ssl.h>
|
2014-02-24 16:08:43 +01:00
|
|
|
#include <polarssl/entropy.h>
|
2013-09-03 03:07:47 +02:00
|
|
|
int main()
|
|
|
|
{
|
2014-02-24 16:08:43 +01:00
|
|
|
ssl_context ctx;
|
|
|
|
ssl_session session;
|
|
|
|
entropy_context entropy;
|
2013-09-03 03:07:47 +02:00
|
|
|
|
2014-02-24 16:08:43 +01:00
|
|
|
ssl_init(&ctx);
|
|
|
|
entropy_init(&entropy);
|
|
|
|
ssl_set_rng(&ctx, entropy_func, &entropy);
|
|
|
|
ssl_set_session(&ctx, &session);
|
2013-09-03 03:07:47 +02:00
|
|
|
|
2014-02-24 16:08:43 +01:00
|
|
|
ssl_close_notify(&ctx);
|
|
|
|
ssl_session_free(&session);
|
|
|
|
ssl_free(&ctx);
|
2013-09-03 03:07:47 +02:00
|
|
|
|
2014-02-24 16:08:43 +01:00
|
|
|
return 0;
|
2013-09-03 03:07:47 +02:00
|
|
|
}"
|
|
|
|
POLARSSL_WORKS)
|
|
|
|
|
|
|
|
else ()
|
|
|
|
message (STATUS "Could not find polarssl")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED(POLARSSL_INCLUDE_DIR POLARSSL_LIBRARY)
|
|
|
|
|