From ec55495562d34a030faa4ba4eb6f1aeee12da712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Saltvik?= Date: Sun, 11 Oct 2015 16:08:30 +0200 Subject: [PATCH 1/3] support visual studio 2015 --- CMakeLists.txt | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63d7c4e..0250daf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,26 +14,39 @@ else() message(WARNING "Your compiler (${CMAKE_CXX_COMPILER_ID}) has not been tested on this project. Only Clang and GCC has been tested. Please report any problems at the project page on GitHub.") endif() -#Only tested with versions 1.55 and 1.56 -find_package(Boost 1.54.0 COMPONENTS regex system thread coroutine context filesystem REQUIRED) +OPTION(ENABLE_SSL "Use ssl" ON) + +set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_RUNTIME OFF) +#Only tested with versions 1.59.0 +find_package(Boost 1.59.0 COMPONENTS regex system thread coroutine context filesystem date_time REQUIRED) include_directories(${Boost_INCLUDE_DIR}) if(APPLE) set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") endif() -#TODO: add requirement for version 1.0.1g (can it be done in one line?) -find_package(OpenSSL REQUIRED) -include_directories(${OPENSSL_INCLUDE_DIR}) +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") +endif() + +if(ENABLE_SSL) + #TODO: add requirement for version 1.0.1g (can it be done in one line?) + find_package(OpenSSL REQUIRED) + include_directories(${OPENSSL_INCLUDE_DIR}) +endif() find_package(Threads REQUIRED) include_directories(.) -add_executable(https_examples https_examples.cpp) -target_link_libraries(https_examples ${Boost_LIBRARIES}) -target_link_libraries(https_examples ${OPENSSL_LIBRARIES}) -target_link_libraries(https_examples ${CMAKE_THREAD_LIBS_INIT}) +if(ENABLE_SSL) + add_executable(https_examples https_examples.cpp) + target_link_libraries(https_examples ${Boost_LIBRARIES}) + target_link_libraries(https_examples ${OPENSSL_LIBRARIES}) + target_link_libraries(https_examples ${CMAKE_THREAD_LIBS_INIT}) +endif() add_executable(http_examples http_examples.cpp) target_link_libraries(http_examples ${Boost_LIBRARIES}) From 796097379305cdc1ccef5486abfd3386bc307857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Saltvik?= Date: Thu, 15 Oct 2015 15:00:39 +0200 Subject: [PATCH 2/3] only build https if openssl found, test msvc14 compiler --- CMakeLists.txt | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0250daf..acaae10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,15 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) message(FATAL_ERROR "Clang version >=3.3 required.") endif() +elseif (MSVC14) else() message(WARNING "Your compiler (${CMAKE_CXX_COMPILER_ID}) has not been tested on this project. Only Clang and GCC has been tested. Please report any problems at the project page on GitHub.") endif() -OPTION(ENABLE_SSL "Use ssl" ON) + +include_directories(.) + +find_package(Threads REQUIRED) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) @@ -27,21 +31,12 @@ if(APPLE) set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") endif() -if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") -endif() +#TODO: add requirement for version 1.0.1g (can it be done in one line?) +find_package(OpenSSL QUIET) -if(ENABLE_SSL) - #TODO: add requirement for version 1.0.1g (can it be done in one line?) - find_package(OpenSSL REQUIRED) +if(OpenSSL_FOUND) include_directories(${OPENSSL_INCLUDE_DIR}) -endif() -find_package(Threads REQUIRED) - -include_directories(.) - -if(ENABLE_SSL) add_executable(https_examples https_examples.cpp) target_link_libraries(https_examples ${Boost_LIBRARIES}) target_link_libraries(https_examples ${OPENSSL_LIBRARIES}) From 79234c6c6bd08e655b253f94fdfb745353cce242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Saltvik?= Date: Thu, 15 Oct 2015 16:16:26 +0200 Subject: [PATCH 3/3] no static linking --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acaae10..ed06a78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,9 +20,6 @@ include_directories(.) find_package(Threads REQUIRED) -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME OFF) #Only tested with versions 1.59.0 find_package(Boost 1.59.0 COMPONENTS regex system thread coroutine context filesystem date_time REQUIRED) include_directories(${Boost_INCLUDE_DIR})