38 lines
1011 B
CMake
38 lines
1011 B
CMake
|
add_custom_target(BlangUnitTests)
|
||
|
|
||
|
enable_testing()
|
||
|
|
||
|
set(BLANG_UNITTESTS_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||
|
|
||
|
find_library(CPPUNIT_LIBRARY NAMES libcppunit.a)
|
||
|
find_path(CPPUNIT_INCLUDE NAMES cppunit/include)
|
||
|
|
||
|
if(NOT CPPUNIT_LIBRARY OR EXISTS CPPUNIT_LIBRARY)
|
||
|
message(FATAL_ERROR "CPPUNIT_LIBRARY is not found!")
|
||
|
endif()
|
||
|
|
||
|
if(NOT CPPUNIT_INCLUDE OR EXISTS CPPUNIT_INCLUDE)
|
||
|
message(FATAL_ERROR "CPPUNIT_INCLUDE is not found!")
|
||
|
endif()
|
||
|
|
||
|
include_directories(${CPPUNIT_INCLUDE})
|
||
|
|
||
|
# add_blang_unittest(test_name file1.cpp file2.cpp)
|
||
|
#
|
||
|
# Will compile the list of files together and link against the blang
|
||
|
# Produces a binary named 'test_name'.
|
||
|
function(add_blang_unittest test_name)
|
||
|
add_executable(${test_name} ${BLANG_UNITTESTS_DIR}/mainTest.cpp ${ARGN})
|
||
|
target_link_libraries(${test_name}
|
||
|
${CPPUNIT_LIBRARY}
|
||
|
)
|
||
|
add_custom_target(check-${test_name}
|
||
|
COMMAND ${test_name}
|
||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||
|
)
|
||
|
endfunction()
|
||
|
|
||
|
add_subdirectory(libblang)
|
||
|
add_subdirectory(Lex)
|
||
|
add_subdirectory(Mustache)
|