From 1619d4a20341265f47f81e95e56b080bf679444b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ron=20Ricardo=20Perez-Lopez?= Date: Mon, 16 Sep 2024 01:03:45 -0700 Subject: [PATCH] Do not build tests for `make all` or `make install` --- tests/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bd24b037..f78063b0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,7 +36,7 @@ if (WITH_MSAT) add_definitions(-DWITH_MSAT) endif() -add_library(pono-test-lib "${PONO_LIB_TYPE}" +add_library(pono-test-lib EXCLUDE_FROM_ALL "${PONO_LIB_TYPE}" "${CMAKE_CURRENT_SOURCE_DIR}/common_ts.cpp" ) @@ -44,10 +44,14 @@ add_library(pono-test-lib "${PONO_LIB_TYPE}" target_include_directories(pono-test-lib PUBLIC "${INCLUDE_DIRS}") target_link_libraries(pono-test-lib pono-lib) +# Create `make check` target that (re-)builds tests before trying to run them. +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) + macro(pono_add_test name) - add_executable(${name} "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp") + add_executable(${name} EXCLUDE_FROM_ALL "${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp") target_link_libraries(${name} gtest gtest_main) target_link_libraries(${name} pono-test-lib) # also includes pono-lib because it's linked + add_dependencies(check ${name}) add_test(NAME ${name} COMMAND ${name}) endmacro()