Commit 1b65e39d authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED use the Debug version if needed + possible use outside CamiTK CE

parent 3d6f3dd0
......@@ -101,10 +101,53 @@ macro(camitk_add_integration_test)
set(CAMITK_CMAKE_MACRO_PATH ${SDK_TOP_LEVEL_SOURCE_DIR}/cmake/modules/macros/camitk/test)
endif()
#-- check if debug postfix is needed
set(APP_NAME camitk-actionstatemachine)
if(NOT CAMITK_COMMUNITY_EDITION_BUILD)
# this macro is called outside CamiTK CE
# find the complete path to the test programs (removing any previous attempt to find a test application
# as this could be another application)
unset(CAMITK_INTEGRATION_TEST_EXECUTABLE CACHE)
find_program(CAMITK_INTEGRATION_TEST_EXECUTABLE
NAMES ${APP_NAME}${CAMITK_DEBUG_POSTFIX} ${APP_NAME}
PATH_SUFFIXES "bin"
PATHS ${CAMITK_BIN_DIR}
)
if (NOT CAMITK_INTEGRATION_TEST_EXECUTABLE)
# Test programs should be installed
message(FATAL_ERROR "${APP_NAME} not found.\n This means that action state machine was not installed during CamiTK SDK installation.")
endif()
else()
# in CamiTK CE build
# add debug postfix if needed by MSVC
set(APP_SUFFIX "")
# determine which version of the executable to use (debug-suffixed or not)
if(MSVC)
if(NOT CMAKE_BUILD_TYPE)
# Assume the developer that is running the test suite compiled everything in Debug
set(APP_SUFFIX ${CAMITK_DEBUG_POSTFIX})
else()
# support multiplaform (sometimes the "Debug" type is all uppercase, as on Win32, sometimes it is CamelCase)
string(TOUPPER ${CMAKE_BUILD_TYPE} CAMITK_BUILD_TYPE_UPPER)
if (CAMITK_BUILD_TYPE_UPPER STREQUAL "DEBUG")
# manage debug build only
set(APP_SUFFIX ${CAMITK_DEBUG_POSTFIX})
endif()
# if build type is not debug, everything is ok as
endif()
endif()
# In CamiTK CE build directly use the binary dir version
set(CAMITK_INTEGRATION_TEST_EXECUTABLE ${CMAKE_BINARY_DIR}/bin/${APP_NAME}${APP_SUFFIX})
endif()
#-- and add the test
add_test(NAME ${CAMITK_INTEGRATION_TEST_NAME}
COMMAND ${CMAKE_COMMAND}
-DCAMITK_TEST_COMMAND=${CMAKE_BINARY_DIR}/bin/camitk-actionstatemachine
-DCAMITK_TEST_COMMAND=${CAMITK_INTEGRATION_TEST_EXECUTABLE}
-DCAMITK_TEST_COMMAND_ARG=${CAMITK_TEST_EXECUTABLE_ARG}
-DCAMITK_TEST_EXPECTED_FILES=${CAMITK_INTEGRATION_TEST_EXPECTED_OUTPUT_FILES}
-DCAMITK_TEST_OUTPUT_DIR=${CAMITK_TEST_OUTPUT_DIR}
......
......@@ -75,7 +75,7 @@ macro(camitk_init_test)
if (NOT CAMITK_INIT_TEST_EXECUTABLE)
# Test programs should be installed
message(FATAL_ERROR "${TEST_APPLICATION_ARG} not found.\n This means that automatic test applications were not installed during CamiTK SDK installation.")
message(FATAL_ERROR "${APP_NAME} not found.\n This means that automatic test applications were not installed during CamiTK SDK installation.")
endif()
else()
# in CamiTK CE build
......@@ -88,7 +88,7 @@ macro(camitk_init_test)
# Assume the developer that is running the test suite compiled everything in Debug
set(APP_SUFFIX ${CAMITK_DEBUG_POSTFIX})
else()
# support multiplaform (sometimes the "Debug" type is all uppercase, as on Win32, sometimes it is Camelcase)
# support multiplaform (sometimes the "Debug" type is all uppercase, as on Win32, sometimes it is CamelCase)
string(TOUPPER ${CMAKE_BUILD_TYPE} CAMITK_BUILD_TYPE_UPPER)
if (CAMITK_BUILD_TYPE_UPPER STREQUAL "DEBUG")
# manage debug build only
......
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