31 lines
1.2 KiB
CMake
31 lines
1.2 KiB
CMake
add_library(test test.cpp test.h)
|
|
target_compile_options(test PRIVATE ${COMMON_FLAGS})
|
|
target_include_directories(test PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
|
target_include_directories(test PUBLIC ${LUNA_BASE}/usr/include)
|
|
|
|
function(luna_test SOURCE_FILE APP_NAME)
|
|
add_executable(${APP_NAME} ${SOURCE_FILE})
|
|
target_compile_options(${APP_NAME} PRIVATE -O0 ${COMMON_FLAGS} -fno-threadsafe-statics -Wno-write-strings)
|
|
add_dependencies(${APP_NAME} libc)
|
|
target_include_directories(${APP_NAME} PRIVATE ${LUNA_BASE}/usr/include)
|
|
target_link_libraries(${APP_NAME} PRIVATE test os)
|
|
install(TARGETS ${APP_NAME} DESTINATION ${LUNA_BASE}/usr/bin/tests)
|
|
endfunction()
|
|
|
|
if(BUILD_TESTS)
|
|
luna_test(libluna/TestVector.cpp TestVector)
|
|
luna_test(libluna/TestBase64.cpp TestBase64)
|
|
luna_test(libluna/TestUtf8.cpp TestUtf8)
|
|
luna_test(libluna/TestFormat.cpp TestFormat)
|
|
luna_test(libluna/TestHashTable.cpp TestHashTable)
|
|
luna_test(libluna/TestCPath.cpp TestCPath)
|
|
luna_test(libluna/TestSharedPtr.cpp TestSharedPtr)
|
|
luna_test(libluna/TestSHA.cpp TestSHA)
|
|
luna_test(libc/TestScanf.cpp TestScanf)
|
|
luna_test(libc/TestString.cpp TestString)
|
|
luna_test(libc/TestEnv.cpp TestEnv)
|
|
luna_test(libc/TestGlobalCtors.cpp TestGlobalCtors)
|
|
|
|
luna_app(run-tests.cpp run-tests)
|
|
endif()
|