Skip to content

Commit

Permalink
Add tests directory for building tests if BUILD_TESTING is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardodebenedictis committed Feb 1, 2024
1 parent f4d2d60 commit d2d1cfc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ add_library(RiDDLe src/scope.cpp src/env.cpp src/core.cpp src/type.cpp src/const
target_link_libraries(RiDDLe PUBLIC utils)
target_include_directories(RiDDLe PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_executable(riddle_lib_tests test_riddle.cpp)
target_link_libraries(riddle_lib_tests PRIVATE RiDDLe)

add_test(NAME RIDDLE_LibTest COMMAND riddle_lib_tests WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
6 changes: 6 additions & 0 deletions tests/test_riddle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <cassert>

int main(int argc, char const *argv[])
{
return 0;
}

0 comments on commit d2d1cfc

Please sign in to comment.