cmake_minimum_required(VERSION 3.10) project(MyProject) ########### # Debug or Release ########### if (NOT CMAKE_BUILD_TYPE) ## set default to Debug set(CMAKE_BUILD_TYPE Debug) # override with -DCMAKE_BUILD_TYPE=Release message("==> CMAKE_BUILD_TYPE empty. Changing it to Debug.") else() message("==> CMAKE_BUILD_TYPE == ${CMAKE_BUILD_TYPE}.") endif() ## https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html ## During Debug, use debug version of libstdc++ (asserts on access to invalid iterators, etc!) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") ########### # Suppress certain warnings ########### # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") # rm CMakeCache.txt and cmake . if you change any of the C++ Standards. ############## # C++ Standard ############## ## set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS ON) # Enable testing # set(BUILD_TESTING ON) # include(CTest) ### ADD gtest add_subdirectory(googletest) ### TESTS add_executable(test-lastseen test-lastseen.cpp lastseen.cpp) add_dependencies(test-lastseen gtest) target_link_libraries(test-lastseen gtest_main) enable_testing() add_test(NAME test-lastseen COMMAND test-lastseen) add_executable(test-utils test-utils.cpp utils.cpp) add_dependencies(test-utils gtest) target_link_libraries(test-utils gtest_main) add_test(NAME test-utils COMMAND test-utils) # include(FetchContent) # # FetchContent_Populate( # zf_log # GIT_REPOSITORY https://github.com/wonder-mice/zf_log.git # SOURCE_DIR zf_log # ) # add_subdirectory(${zf_log_SOURCE_DIR}/src zf_log) # This works, if zf_log is pulled in. add_subdirectory(zf_log) # Example for how to define a test which uses gtest_gmock # add_executable(mytest tester.cpp) # target_link_libraries(mytest gmock_main) # Here's how to add all *.h and *.cpp files # to a project: # # file(GLOB SOURCES # header-folder/*.h # source-folder/*.cpp # ) # add_executable(yourProj ${SOURCES}) add_executable(hharry hharry.cpp lastseen.cpp terminal.cpp render.cpp utils.cpp images.h wordplay.cpp charman.cpp) target_link_libraries(hharry util) target_link_libraries(hharry zf_log) # target_compile_definitions(hharry PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_INFO) target_compile_definitions(hharry PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_VERBOSE) add_executable(try-re try-re.c) add_executable(ansi-color ansi-color.c) add_executable(ansi-to-src ansi-to-src.cpp utils.cpp) add_executable(images images.cpp utils.cpp images.h) target_link_libraries(images zf_log) add_custom_command( OUTPUT images.h COMMAND ./build_images.sh DEPENDS ansi-to-src ghost.ans ghead.ans wolf.ans panther.ans bat.ans skull.ans skull-blink.ans icu.ans COMMENT "Generating images.h." )