summaryrefslogtreecommitdiff
path: root/scripts/cmake/platforms/native/build_configuration.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cmake/platforms/native/build_configuration.cmake')
-rw-r--r--scripts/cmake/platforms/native/build_configuration.cmake26
1 files changed, 16 insertions, 10 deletions
diff --git a/scripts/cmake/platforms/native/build_configuration.cmake b/scripts/cmake/platforms/native/build_configuration.cmake
index a858f50..d0b4dfb 100644
--- a/scripts/cmake/platforms/native/build_configuration.cmake
+++ b/scripts/cmake/platforms/native/build_configuration.cmake
@@ -28,19 +28,25 @@ function(set_platform_global_defaults)
file(MAKE_DIRECTORY ${TEST_TPIP})
set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include)
file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE})
+ set(CATCH_HEADER_URL "https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp")
+ set(CATCH_HEADER_MD5 dc6bb8ce282ad134476b37275804c44c)
- ExternalProject_Add(catch2-headers
- URL https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp
- DOWNLOAD_NO_EXTRACT 1
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ${CMAKE_COMMAND} -E copy <DOWNLOAD_DIR>/catch.hpp ${TEST_TPIP_INCLUDE}
- INSTALL_COMMAND "")
- add_library(catch2 INTERFACE)
- target_include_directories(catch2
+ include(FetchContent)
+ FetchContent_Declare(catch2-header-download
+ URL ${CATCH_HEADER_URL}
+ URL_HASH MD5=${CATCH_HEADER_MD5}
+ DOWNLOAD_DIR ${TEST_TPIP_INCLUDE}
+ DOWNLOAD_NO_EXTRACT ON
+ )
+ FetchContent_MakeAvailable(catch2-header-download)
+
+ add_library(mlek-catch2 INTERFACE)
+ target_include_directories(mlek-catch2
INTERFACE
${TEST_TPIP_INCLUDE})
- add_dependencies(catch2 catch2-headers)
+ add_dependencies(mlek-catch2 catch2-header-download)
+ add_library(mlek::Catch2 ALIAS mlek-catch2)
endfunction()
@@ -106,7 +112,7 @@ function(platform_custom_post_build)
set(TEST_TARGET_NAME "${use_case}_tests")
add_executable(${TEST_TARGET_NAME} ${TEST_SOURCES})
target_include_directories(${TEST_TARGET_NAME} PRIVATE ${TEST_RESOURCES_INCLUDE})
- target_link_libraries(${TEST_TARGET_NAME} PRIVATE ${UC_LIB_NAME} catch2)
+ target_link_libraries(${TEST_TARGET_NAME} PRIVATE ${UC_LIB_NAME} mlek::Catch2)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE
"ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}"
TESTS)