Convert path to test inputs folder to native syntax on windows to make tests with file copying portable.

This commit is contained in:
Axel Kohlmeyer
2022-08-06 22:46:52 -04:00
parent 0f68aa80fe
commit 42594bbbb7
3 changed files with 8 additions and 6 deletions

View File

@ -36,7 +36,11 @@ if(Python_EXECUTABLE)
COMMENT "Check completeness of force style tests")
endif()
set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
string(REPLACE "/" "\\\\" TEST_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/tests")
else()
set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests)
endif()
add_library(style_tests STATIC yaml_writer.cpp error_stats.cpp test_config_reader.cpp test_main.cpp)
if(YAML_FOUND)
target_compile_definitions(style_tests PRIVATE TEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})