Skip to content

Commit e885287

Browse files
Report status (failure or success) when downloading doctest .h
While we're at it, fix option name typo XSIMD_DOWNLOAD_DOCTEST -> DOWNLOAD_DOCTEST Fix #1056
1 parent e4e871c commit e885287

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ endif()
169169
add_executable(test_xsimd ${XSIMD_TESTS} ${XSIMD_HEADERS})
170170
target_include_directories(test_xsimd PRIVATE ${XSIMD_INCLUDE_DIR})
171171

172-
option(XSIMD_DOWNLOAD_DOCTEST OFF)
172+
option(DOWNLOAD_DOCTEST OFF)
173173
find_package(doctest QUIET)
174174
if (doctest_FOUND)
175175
set(DOCTEST_MINIMAL_VERSION 2.4.9)
@@ -181,7 +181,15 @@ elseif(DOWNLOAD_DOCTEST)
181181
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doctest")
182182
file(DOWNLOAD
183183
"https://github.com/doctest/doctest/releases/download/v2.4.9/doctest.h"
184-
"${CMAKE_CURRENT_BINARY_DIR}/doctest/doctest.h")
184+
"${CMAKE_CURRENT_BINARY_DIR}/doctest/doctest.h"
185+
STATUS DOWNLOAD_DOCTEST_STATUS)
186+
list(GET DOWNLOAD_DOCTEST_STATUS 0 DOWNLOAD_DOCTEST_STATUS_CODE)
187+
list(GET DOWNLOAD_DOCTEST_STATUS 1 DOWNLOAD_DOCTEST_ERROR_MESSAGE)
188+
if(${DOWNLOAD_DOCTEST_STATUS_CODE} EQUAL 0)
189+
message(STATUS "Successfully downloaded doctest.h")
190+
else()
191+
message(FATAL_ERROR "Error occurred during download of doctest: ${DOWNLOAD_DOCTEST_ERROR_MESSAGE}")
192+
endif()
185193
target_include_directories(test_xsimd PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
186194
else()
187195
message(FATAL_ERROR "

0 commit comments

Comments
 (0)