Skip to content

Commit

Permalink
Added GTest. Though a bit dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
lukkio88 committed Mar 3, 2024
1 parent a3a10a6 commit c9265ef
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion OpenCL-CLHPP-Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,19 @@ endfunction()

foreach(EXAMPLE ${EXAMPLES-OPENCL-CPP})
add_subdirectory(./${EXAMPLE})
endforeach()
endforeach()

include(FetchContent)
FetchContent_Declare(
googletest
# Specify the commit you depend on and update it regularly.
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

# Now simply link against gtest or gtest_main as needed. Eg
add_executable(unit-test ${CMAKE_SOURCE_DIR}/unit-test/main.cpp)
target_link_libraries(unit-test gtest_main)
add_test(NAME example_test COMMAND unit-test)

0 comments on commit c9265ef

Please sign in to comment.