modify CMakeLists.txt

This commit is contained in:
an-tao 2018-06-15 00:07:43 +08:00
parent cc35b08580
commit 0ac3f59276
2 changed files with 12 additions and 3 deletions

View File

@ -30,7 +30,10 @@ include_directories(${JSONCPP_INCLUDE_DIRS})
link_directories(${JSONCPP_LIBRARY_DIRS}) link_directories(${JSONCPP_LIBRARY_DIRS})
find_package (UUID REQUIRED) find_package (UUID REQUIRED)
find_package (OpenSSL REQUIRED) find_package (OpenSSL)
if(OpenSSL_FOUND)
add_definitions(-DUSE_OPENSSL)
endif()
message(STATUS "openssl inc path:" ${OPENSSL_INCLUDE_DIR}) message(STATUS "openssl inc path:" ${OPENSSL_INCLUDE_DIR})
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
link_directories(${OPENSSL_SSL_LIBRARY}) link_directories(${OPENSSL_SSL_LIBRARY})
@ -79,7 +82,7 @@ add_dependencies(drogon makeVersion)
get_directory_property(DEFS COMPILE_DEFINITIONS) get_directory_property(DEFS COMPILE_DEFINITIONS)
foreach(loop_var ${DEFS}) foreach(loop_var ${DEFS})
message(STATUS "definitions " ${loop_var}) #message(STATUS "definitions " ${loop_var})
file(APPEND "./config.h" "-D" ${loop_var} " ") file(APPEND "./config.h" "-D" ${loop_var} " ")
endforeach(loop_var) endforeach(loop_var)
file(APPEND "./config.h" "\";") file(APPEND "./config.h" "\";")

View File

@ -1,6 +1,12 @@
#include "Utilities.h" #include "Utilities.h"
#include <drogon/FileUpload.h> #include <drogon/FileUpload.h>
#ifdef USE_OPENSSL
#include <openssl/md5.h> #include <openssl/md5.h>
#else
namespace drogon{
//Implement MD5 function here if OpenSSL lib not found
}
#endif
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using namespace drogon; using namespace drogon;