XSteam/3rdparty/ValveFileVDF/tests/CMakeLists.txt
2024-10-11 19:40:20 +08:00

27 lines
900 B
CMake

set(SRCS
"main.cpp"
"vdf_parser_test.cpp"
"../Readme.md")
add_executable(tests ${SRCS})
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT tests) #requires cmake 3.6
set_property(TARGET tests PROPERTY COMPILE_WARNING_AS_ERROR ON)
add_definitions("-DSOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")
target_compile_features(tests PUBLIC cxx_std_17)
target_link_libraries(tests PRIVATE ValveFileVDF)
target_compile_options(tests PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wconversion -pedantic-errors -Wsign-conversion>
$<$<CXX_COMPILER_ID:MSVC>:
/W4>)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_link_libraries(tests PUBLIC -fsanitize=address,undefined)
endif()
if (BUILD_TESTING)
add_test(NAME vdf_tests COMMAND tests)
endif()