Commit b02b1804 authored by Otavio Rodolfo Piske's avatar Otavio Rodolfo Piske

"Added a build target to copy dll files to the test directory

This is a work-around to prevent test execution to fail due to not finding the DLLs. This affects only Windows builds and is work-in-progress as the directory locations for the binaries may be adjusted in the future.
Signed-off-by: 's avatarOtavio Rodolfo Piske <opiske@redhat.com>
parent 2de8a814
PROJECT(mqtt-tests)
SET(MQTT_TEST_BROKER "tcp://localhost:1883" CACHE STRING "Hostname of a test MQTT broker to use") SET(MQTT_TEST_BROKER "tcp://localhost:1883" CACHE STRING "Hostname of a test MQTT broker to use")
SET(MQTT_SSL_HOSTNAME "localhost" CACHE STRING "Hostname of a test SSL MQTT broker to use") SET(MQTT_SSL_HOSTNAME "localhost" CACHE STRING "Hostname of a test SSL MQTT broker to use")
ADD_EXECUTABLE( ADD_EXECUTABLE(
test1 test1
test1.c test1.c
...@@ -11,6 +14,14 @@ TARGET_LINK_LIBRARIES( ...@@ -11,6 +14,14 @@ TARGET_LINK_LIBRARIES(
paho-mqtt3c paho-mqtt3c
) )
IF (WIN32)
ADD_CUSTOM_COMMAND(
TARGET test1 PRE_BUILD
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test/dll-copy.cmake
COMMENT "Copying DLLs to test directory"
)
ENDIF()
ADD_TEST( ADD_TEST(
NAME test1 NAME test1
COMMAND "test1" "--connection" ${MQTT_TEST_BROKER} COMMAND "test1" "--connection" ${MQTT_TEST_BROKER}
......
FILE(GLOB dlls ${CMAKE_BINARY_DIR}/src/*.dll)
FOREACH(dll ${dlls})
MESSAGE(STATUS, "Copying dll runtime file ${CMAKE_BINARY_DIR}/src/${dll} to runtime dir ${CMAKE_BINARY_DIR}/test")
FILE(COPY ${dlls} DESTINATION ${CMAKE_BINARY_DIR}/test)
ENDFOREACH(dll)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment