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.cmake41
1 files changed, 20 insertions, 21 deletions
diff --git a/scripts/cmake/platforms/native/build_configuration.cmake b/scripts/cmake/platforms/native/build_configuration.cmake
index c87ac89..bf6f980 100644
--- a/scripts/cmake/platforms/native/build_configuration.cmake
+++ b/scripts/cmake/platforms/native/build_configuration.cmake
@@ -15,19 +15,6 @@
# limitations under the License.
#----------------------------------------------------------------------------
-set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test)
-
-file(MAKE_DIRECTORY ${TEST_TPIP})
-set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include)
-file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE})
-
-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 bash -c "cp -R <DOWNLOAD_DIR>/catch.hpp ${TEST_TPIP_INCLUDE}"
- INSTALL_COMMAND "")
-
function(set_platform_global_defaults)
message(STATUS "Platform: Native (Linux based x86_64/aarch64 system)")
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
@@ -35,6 +22,24 @@ function(set_platform_global_defaults)
CACHE FILEPATH "Toolchain file")
endif()
+ set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test)
+
+ file(MAKE_DIRECTORY ${TEST_TPIP})
+ set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include)
+ file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE})
+
+ 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
+ INTERFACE
+ ${TEST_TPIP_INCLUDE})
+
endfunction()
function(platform_custom_post_build)
@@ -98,16 +103,10 @@ function(platform_custom_post_build)
set(TEST_TARGET_NAME "${CMAKE_PROJECT_NAME}-${use_case}-tests")
add_executable(${TEST_TARGET_NAME} ${TEST_SOURCES})
- target_include_directories(${TEST_TARGET_NAME} PUBLIC
- ${TEST_TPIP_INCLUDE} ${TEST_RESOURCES_INCLUDE})
- target_link_libraries(${TEST_TARGET_NAME} PUBLIC ${UC_LIB_NAME})
+ target_include_directories(${TEST_TARGET_NAME} PRIVATE ${TEST_RESOURCES_INCLUDE})
+ target_link_libraries(${TEST_TARGET_NAME} PRIVATE ${UC_LIB_NAME} catch2)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE
"ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}"
TESTS)
-
- add_dependencies(
- "${TEST_TARGET_NAME}"
- "catch2-headers"
- )
endif ()
endfunction() \ No newline at end of file