diff options
author | bd <bdunahu@operationnull.com> | 2025-04-12 00:44:29 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-12 00:44:29 -0400 |
commit | 28a2788e2c59357d9269e558b0bd45db3241c42d (patch) | |
tree | 5e001355106684d514dcb96afcec2ad102513a33 /CMakeLists.txt | |
parent | 1fb7a9bd5eb41e87871bcbb3423caaabdd8ce1d9 (diff) |
Rewrite utils functions as macros
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f8ec7be..661e45c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.5) -set(CMAKE_CXX_COMPILER "g++") project(ram) +option(RAM_TESTS "Enable creation of a memory-subsystem test binary." ON) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_compile_options(-Wall -lstdc++ -g -O0) @@ -11,28 +12,26 @@ add_compile_options(-Wextra -Wpedantic) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# header files -include_directories( - ${PROJECT_SOURCE_DIR}/inc -) - # gather source files file(GLOB_RECURSE SRCS "src/*.cc") # binary executable add_library(${PROJECT_NAME}_lib ${SRCS}) -target_link_libraries(${PROJECT_NAME}_lib) +target_include_directories(${PROJECT_NAME}_lib PUBLIC ${PROJECT_SOURCE_DIR}/inc) -find_package(Catch2 REQUIRED) +if(RAM_TESTS) + find_package(Catch2 REQUIRED) -#gather test files -file(GLOB_RECURSE TESTS "tests/*.cc") + #gather test files + file(GLOB_RECURSE TESTS "tests/*.cc") -# test executable -add_executable(tests ${SRCS} ${TESTS}) -target_link_libraries(tests PRIVATE Catch2::Catch2WithMain PRIVATE) + # test executable + add_executable(tests ${SRCS} ${TESTS}) + target_include_directories(tests PUBLIC ${PROJECT_SOURCE_DIR}/inc) + target_link_libraries(tests PRIVATE Catch2::Catch2WithMain PRIVATE) -# test discovery -include(CTest) -include(Catch) -catch_discover_tests(tests) + # test discovery + include(CTest) + include(Catch) + catch_discover_tests(tests) +endif() |