CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. cmake_minimum_required(VERSION 3.10)
  2. project(MyProject)
  3. ###########
  4. # Debug or Release
  5. ###########
  6. if (NOT CMAKE_BUILD_TYPE)
  7. ## set default to Debug
  8. set(CMAKE_BUILD_TYPE Debug) # override with -DCMAKE_BUILD_TYPE=Release
  9. message("==> CMAKE_BUILD_TYPE empty. Changing it to Debug.")
  10. else()
  11. message("==> CMAKE_BUILD_TYPE == ${CMAKE_BUILD_TYPE}.")
  12. endif()
  13. ## https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
  14. ## During Debug, use debug version of libstdc++ (asserts on access to invalid iterators, etc!)
  15. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
  16. ###########
  17. # Suppress certain warnings
  18. ###########
  19. # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
  20. ##############
  21. # C++ Standard
  22. ##############
  23. set(CMAKE_CXX_STANDARD 14)
  24. set(CMAKE_CXX_EXTENSIONS OFF)
  25. # Enable testing
  26. # set(BUILD_TESTING ON)
  27. # include(CTest)
  28. ### ADD gtest
  29. add_subdirectory(googletest)
  30. add_executable(test_lastseen test_lastseen.cpp lastseen.cpp)
  31. add_dependencies(test_lastseen gtest)
  32. target_link_libraries(test_lastseen gtest_main)
  33. enable_testing()
  34. add_test(NAME test_lastseen
  35. COMMAND test_lastseen)
  36. # include(FetchContent)
  37. #
  38. # FetchContent_Populate(
  39. # zf_log
  40. # GIT_REPOSITORY https://github.com/wonder-mice/zf_log.git
  41. # SOURCE_DIR zf_log
  42. # )
  43. # add_subdirectory(${zf_log_SOURCE_DIR}/src zf_log)
  44. # This works, if zf_log is pulled in.
  45. add_subdirectory(zf_log)
  46. # Example for how to define a test which uses gtest_gmock
  47. # add_executable(mytest tester.cpp)
  48. # target_link_libraries(mytest gmock_main)
  49. # Here's how to add all *.h and *.cpp files
  50. # to a project:
  51. #
  52. # file(GLOB SOURCES
  53. # header-folder/*.h
  54. # source-folder/*.cpp
  55. # )
  56. # add_executable(yourProj ${SOURCES})
  57. add_executable(mystic mystic.cpp lastseen.cpp terminal.cpp render.cpp utils.cpp)
  58. target_link_libraries(mystic util)
  59. target_link_libraries(mystic zf_log)
  60. target_link_libraries(mystic efence)
  61. target_compile_definitions(mystic PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_VERBOSE)
  62. add_executable(try-re try-re.c)
  63. add_executable(ansi-color ansi-color.c)
  64. add_executable(ansi-to-src ansi-to-src.cpp utils.cpp)
  65. add_executable(images images.cpp utils.cpp)
  66. target_link_libraries(images zf_log)