diff options
author | eidheim <eidheim@gmail.com> | 2014-11-28 16:28:21 +0300 |
---|---|---|
committer | eidheim <eidheim@gmail.com> | 2014-11-28 16:28:21 +0300 |
commit | 55bd95266244337ff6f9c8e2feda8e143134400f (patch) | |
tree | 198bdd008e63682d24d26ae3e357d06f058796f6 /CMakeLists.txt | |
parent | 6da00d29f64d134b55c5db2fcf3211d5424e6f99 (diff) |
Added CMakeLists.txt. I'm not a cmake-expert, feedback would be much appriciated.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e613308 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required (VERSION 2.8) +project (Simple-WebSocket-Server) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + message(FATAL_ERROR "GCC version >=4.9 required.") + endif() +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + message(FATAL_ERROR "Clang version >=3.4 required.") + endif() +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.41.0 COMPONENTS system REQUIRED) +message("Boost include dir: ${Boost_INCLUDE_DIR}") +message("Boost libraries: ${Boost_LIBRARIES}") +include_directories(${Boost_INCLUDE_DIR}) + +#TODO: add requirement for version 1.0.1g (can it be done in one line?) +find_package(OpenSSL REQUIRED) +message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") +message("OpenSSL crypto libraries: ${OPENSSL_CRYPTO_LIBRARIES}") +message("OpenSSL SSL libraries: ${OPENSSL_SSL_LIBRARIES}") +include_directories(${OPENSSL_INCLUDE_DIR}) + +find_package(Threads REQUIRED) +message("Threads libraries/flag: ${CMAKE_THREAD_LIBS_INIT}") + +add_executable(wss_examples wss_examples.cpp) +target_link_libraries(wss_examples ${Boost_LIBRARIES}) +target_link_libraries(wss_examples ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(wss_examples ${OPENSSL_SSL_LIBRARIES}) +target_link_libraries(wss_examples ${CMAKE_THREAD_LIBS_INIT}) + +add_executable(ws_examples ws_examples.cpp) +target_link_libraries(ws_examples ${Boost_LIBRARIES}) +target_link_libraries(ws_examples ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(ws_examples ${CMAKE_THREAD_LIBS_INIT}) |