CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. # rm CMakeCache.txt and cmake . if you change any of the C++ Standards.
  21. ##############
  22. # C++ Standard
  23. ##############
  24. ## set(CMAKE_CXX_STANDARD 14)
  25. set(CMAKE_CXX_STANDARD 17)
  26. set(CMAKE_CXX_EXTENSIONS ON)
  27. # Enable testing
  28. # set(BUILD_TESTING ON)
  29. # include(CTest)
  30. ### ADD gtest
  31. add_subdirectory(googletest)
  32. ### TESTS
  33. add_executable(test-lastseen test-lastseen.cpp lastseen.cpp)
  34. add_dependencies(test-lastseen gtest)
  35. target_link_libraries(test-lastseen gtest_main)
  36. enable_testing()
  37. add_test(NAME test-lastseen
  38. COMMAND test-lastseen)
  39. add_executable(test-utils test-utils.cpp utils.cpp)
  40. add_dependencies(test-utils gtest)
  41. target_link_libraries(test-utils gtest_main)
  42. add_test(NAME test-utils
  43. COMMAND test-utils)
  44. # include(FetchContent)
  45. #
  46. # FetchContent_Populate(
  47. # zf_log
  48. # GIT_REPOSITORY https://github.com/wonder-mice/zf_log.git
  49. # SOURCE_DIR zf_log
  50. # )
  51. # add_subdirectory(${zf_log_SOURCE_DIR}/src zf_log)
  52. # This works, if zf_log is pulled in.
  53. add_subdirectory(zf_log)
  54. # Example for how to define a test which uses gtest_gmock
  55. # add_executable(mytest tester.cpp)
  56. # target_link_libraries(mytest gmock_main)
  57. # Here's how to add all *.h and *.cpp files
  58. # to a project:
  59. #
  60. # file(GLOB SOURCES
  61. # header-folder/*.h
  62. # source-folder/*.cpp
  63. # )
  64. # add_executable(yourProj ${SOURCES})
  65. add_executable(hharry hharry.cpp lastseen.cpp terminal.cpp render.cpp utils.cpp images.h wordplay.cpp charman.cpp)
  66. target_link_libraries(hharry util)
  67. target_link_libraries(hharry zf_log)
  68. # target_compile_definitions(hharry PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_INFO)
  69. target_compile_definitions(hharry PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_VERBOSE)
  70. add_executable(try-re try-re.c)
  71. add_executable(ansi-color ansi-color.c)
  72. add_executable(ansi-to-src ansi-to-src.cpp utils.cpp)
  73. add_executable(images images.cpp utils.cpp images.h)
  74. target_link_libraries(images zf_log)
  75. add_custom_command(
  76. OUTPUT images.h
  77. COMMAND ./build_images.sh
  78. DEPENDS ansi-to-src ghost.ans ghead.ans wolf.ans panther.ans bat.ans skull.ans skull-blink.ans icu.ans
  79. COMMENT "Generating images.h."
  80. )