summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2020-11-22 10:43:25 -0500
committerAllen Winter <allen.winter@kdab.com>2020-11-22 10:43:25 -0500
commit47f9a47ab0f3cad8d7d8de3960319de46a7a446c (patch)
tree931af839e0fda73e8feae6bcd418c2d9eb484d7c
parent6f9155642a6ec738d918152d4b677d9d150e0380 (diff)
downloadlibical-git-47f9a47ab0f3cad8d7d8de3960319de46a7a446c.tar.gz
buildsystem - allow icalrecurtests on Windows
if cmake is v3.14+ we can use compare_files --ignore-eol option which makes the comparison with the reference files work on Windows.
-rw-r--r--cmake/run_test.cmake7
-rw-r--r--src/test/CMakeLists.txt7
2 files changed, 12 insertions, 2 deletions
diff --git a/cmake/run_test.cmake b/cmake/run_test.cmake
index 5aa5abbf..db6c5c4d 100644
--- a/cmake/run_test.cmake
+++ b/cmake/run_test.cmake
@@ -28,8 +28,13 @@ if(test_not_successful)
message(SEND_ERROR "Unable to run test '${test_cmd}': ${err} : shell output: ${test_not_successful}!")
endif()
+#cmake v3.14 compare_files can ignore line endings
+set(ignore_eol "")
+if(NOT CMAKE_VERSION VERSION_LESS 3.14)
+ set(ignore_eol "--ignore-eol")
+endif()
execute_process(
- COMMAND ${CMAKE_COMMAND} -E compare_files ${output_blessed} ${output_test}
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${ignore_eol} ${output_blessed} ${output_test}
RESULT_VARIABLE test_not_successful
ERROR_VARIABLE err
)
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index a5685cd5..7f327281 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -172,7 +172,12 @@ testme(builtin_timezones "${builtin_timezones_SRCS}")
########### next target ###############
-if(NOT WIN32) #since we currently do not have a Windows reference file
+#cmake v3.14 compare_files can ignore line endings => needed on Windows
+set(CMAKE_COMPARE_FILES_IGNORE_EOL FALSE)
+if(NOT ${CMAKE_VERSION} VERSION_LESS 3.14)
+ set(CMAKE_COMPARE_FILES_IGNORE_EOL TRUE)
+endif()
+if(NOT WIN32 OR CMAKE_COMPARE_FILES_IGNORE_EOL)
if(NOT USE_32BIT_TIME_T) #tests for years greater than 2037 will fail
set(icalrecurtest_SRCS icalrecur_test.c)
add_executable(icalrecurtest ${icalrecurtest_SRCS})