2021-04-06 00:21:43 +01:00
|
|
|
# Catch2 should be installed system wide
|
|
|
|
find_package(Catch2 REQUIRED)
|
2020-07-10 18:06:26 +01:00
|
|
|
|
|
|
|
# Tests need to be added as executables first
|
|
|
|
add_executable(tests serenetests.cpp)
|
2021-04-06 16:20:20 +01:00
|
|
|
add_dependencies(tests SereneDialectGen)
|
|
|
|
add_dependencies(tests serene)
|
2021-06-08 22:01:08 +01:00
|
|
|
target_link_libraries(tests PRIVATE
|
|
|
|
serene
|
|
|
|
${llvm_libs}
|
|
|
|
MLIRAnalysis
|
|
|
|
MLIRIR
|
|
|
|
MLIRParser
|
|
|
|
MLIRSideEffectInterfaces
|
|
|
|
MLIRTransforms
|
|
|
|
)
|
2020-07-10 18:06:26 +01:00
|
|
|
|
2021-04-11 18:36:00 +01:00
|
|
|
target_compile_features(tests PRIVATE cxx_std_17)
|
2020-07-10 18:06:26 +01:00
|
|
|
|
|
|
|
# Should be linked to the main library, as well as the Catch2 testing library
|
2021-04-06 16:20:20 +01:00
|
|
|
target_link_libraries(tests PUBLIC serene Catch2::Catch2)
|
|
|
|
# target_include_directories(serene SYSTEM PRIVATE $ENV{INCLUDE})
|
|
|
|
# target_include_directories(serene PUBLIC ${INCLUDE_DIR})
|
2020-07-10 18:06:26 +01:00
|
|
|
|
|
|
|
# If you register a test, then ctest and make test will run it.
|
|
|
|
# You can also run examples and check the output, as well.
|
|
|
|
# add_test(NAME testlibtest serene testlib) # Command can be a target
|
2021-04-06 00:21:43 +01:00
|
|
|
include(CTest)
|
|
|
|
include(Catch)
|
|
|
|
catch_discover_tests(tests)
|