CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. cmake_minimum_required(VERSION 3.0)
  2. project(ircdoor
  3. VERSION 0.1
  4. LANGUAGES CXX C)
  5. cmake_policy(SET CMP0057 NEW)
  6. ###########
  7. # Debug or Release
  8. ###########
  9. if (NOT CMAKE_BUILD_TYPE)
  10. ## set default to Debug
  11. set(CMAKE_BUILD_TYPE RelWithDebInfo) # override with -DCMAKE_BUILD_TYPE=Release
  12. message("==> CMAKE_BUILD_TYPE empty. Changing it to Debug.")
  13. else()
  14. message("==> CMAKE_BUILD_TYPE == ${CMAKE_BUILD_TYPE}.")
  15. endif()
  16. ## https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
  17. ## During Debug, use debug version of libstdc++ (asserts on access to invalid iterators, etc!)
  18. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
  19. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
  20. ##############
  21. # C++ Standard
  22. ##############
  23. set(CMAKE_CXX_STANDARD 14)
  24. # set(CMAKE_CXX_STANDARD 17)
  25. set(CMAKE_CXX_EXTENSIONS ON)
  26. set(THREADS_PREFER_PTHEAD_FLAG ON)
  27. set(BOOST_THREAD_DYN_LINK ON) # I don't think this is seen
  28. set(Boost_USE_STATIC_LIBS OFF)
  29. set(Boost_USE_MULTITHREADED ON)
  30. set(Boost_USE_STATIC_RUNTIME OFF)
  31. find_package(Boost COMPONENTS system thread REQUIRED)
  32. find_package(Threads REQUIRED)
  33. find_package(OpenSSL REQUIRED)
  34. set(LINK_LIBS ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES})
  35. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/door++)
  36. message("***")
  37. message("*** ERROR/MISSING *** please run: git clone https://github.com/stevet11/door.git door++")
  38. message("*** (Or whatever git clone you need for door++)")
  39. message("***")
  40. endif()
  41. add_subdirectory(door++)
  42. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp)
  43. message("***")
  44. message("*** ERROR/MISSING *** please run: git clone https://github.com/jbeder/yaml-cpp.git --depth 1")
  45. message("***")
  46. endif()
  47. add_subdirectory(yaml-cpp)
  48. add_executable(irc-door main.cpp irc.h irc.cpp render.h render.cpp input.h input.cpp)
  49. target_link_libraries(irc-door door++ pthread ${LINK_LIBS} dl yaml-cpp)