2018-07-13 08:12:16 +08:00
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
|
|
|
|
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
|
|
|
|
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
|
|
|
|
)
|
|
|
|
# private is overwritten in the gdb_api test cases
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-keyword-macro")
|
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
# This would be the place to enable warnings for Windows builds, although
|
|
|
|
# config.inc doesn't seem to do that currently
|
|
|
|
endif()
|
|
|
|
|
2017-11-16 00:03:29 +08:00
|
|
|
file(GLOB_RECURSE sources "*.cpp" "*.h")
|
2017-10-10 01:29:51 +08:00
|
|
|
|
|
|
|
file(GLOB_RECURSE testing_utils "testing-utils/*.cpp" "testing-utils/*.h")
|
|
|
|
|
2019-05-15 21:44:58 +08:00
|
|
|
if(NOT WITH_MEMORY_ANALYZER)
|
|
|
|
file(GLOB_RECURSE memory_analyzer_sources "memory-analyzer/*.cpp")
|
|
|
|
list(REMOVE_ITEM sources ${memory_analyzer_sources})
|
|
|
|
endif()
|
|
|
|
|
2017-08-31 00:10:45 +08:00
|
|
|
list(REMOVE_ITEM sources
|
|
|
|
# Don't build
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/elf_reader.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/smt2_parser.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/json.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cpp_parser.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/osx_fat_reader.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/wp.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cpp_scanner.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ieee_float.cpp
|
2017-09-20 00:26:52 +08:00
|
|
|
|
2017-10-10 01:29:51 +08:00
|
|
|
# Will be built into a separate library and linked
|
|
|
|
${testing_utils}
|
|
|
|
|
2017-09-20 00:26:52 +08:00
|
|
|
# Intended to fail to compile
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/util/expr_cast/expr_undefined_casts.cpp
|
2017-08-31 00:10:45 +08:00
|
|
|
)
|
|
|
|
|
2017-10-10 01:29:51 +08:00
|
|
|
add_subdirectory(testing-utils)
|
|
|
|
|
2017-11-16 00:03:29 +08:00
|
|
|
add_executable(unit ${sources})
|
2017-08-31 00:10:45 +08:00
|
|
|
target_include_directories(unit
|
|
|
|
PUBLIC
|
|
|
|
${CBMC_BINARY_DIR}
|
|
|
|
${CBMC_SOURCE_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2019-02-01 14:48:55 +08:00
|
|
|
${CUDD_INCLUDE}
|
2017-08-31 00:10:45 +08:00
|
|
|
)
|
2018-02-15 15:40:25 +08:00
|
|
|
target_link_libraries(
|
|
|
|
unit
|
|
|
|
testing-utils
|
|
|
|
ansi-c
|
|
|
|
solvers
|
2018-12-15 20:07:07 +08:00
|
|
|
goto-checker
|
2018-02-15 15:40:25 +08:00
|
|
|
goto-programs
|
|
|
|
goto-instrument-lib
|
2018-12-15 20:07:07 +08:00
|
|
|
goto-symex
|
2018-04-11 23:56:41 +08:00
|
|
|
cbmc-lib
|
2017-02-24 02:39:14 +08:00
|
|
|
json-symtab-language
|
2019-05-20 22:52:05 +08:00
|
|
|
statement-list
|
2018-02-15 15:40:25 +08:00
|
|
|
)
|
|
|
|
|
2017-08-31 00:17:38 +08:00
|
|
|
add_test(
|
|
|
|
NAME unit
|
|
|
|
COMMAND $<TARGET_FILE:unit>
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
2017-10-12 18:42:50 +08:00
|
|
|
set_tests_properties(unit PROPERTIES LABELS "CORE;CBMC")
|