Computer Assisted Medical Intervention Tool Kit  version 5.2
CamiTKInitTest.h
Go to the documentation of this file.
1 #
38  set(TEST_APPLICATION_ARG ${ARGN})
39 
40  set(CAMITK_TEST_ID "0")
41  set(CAMITK_TEST_LIST "")
42 
43  # check for executable
44  if(NOT TEST_APPLICATION_ARG)
45  message(FATAL_ERROR "Initializing test cannot proceed: please specify the test application to use in brackets")
46  else()
47  if(TARGET ${TEST_APPLICATION_ARG})
48  # get the application real name using the target properties
49  get_target_property( APP_NAME ${TEST_APPLICATION_ARG} OUTPUT_NAME)
50 
51  # add debug postfix if needed by MSVC
52  set(APP_SUFFIX "")
53  if(MSVC)
54  get_target_property(APP_SUFFIX ${TEST_APPLICATION_ARG} DEBUG_POSTFIX)
55  endif()
56 
57  # CAMITK_INIT_TEST_EXECUTABLE is not the application name but the full path to the binary to be executed
58  set(CAMITK_INIT_TEST_EXECUTABLE ${CMAKE_BINARY_DIR}/bin/${APP_NAME}${APP_SUFFIX})
59  else()
60  # This is not an application of the current CEP
61  # In this case: the application name should be given as the default parameter
62  set(APP_NAME ${TEST_APPLICATION_ARG})
63 
64  if(NOT CAMITK_COMMUNITY_EDITION_BUILD)
65  # this macro is called outside CamiTK CE
66 
67  # find the complete path to the test programs (removing any previous attempt to find a test application
68  # as this could be another application)
69  unset(CAMITK_INIT_TEST_EXECUTABLE CACHE)
70  find_program(CAMITK_INIT_TEST_EXECUTABLE
71  NAMES ${APP_NAME}${CAMITK_DEBUG_POSTFIX} ${APP_NAME}
72  PATH_SUFFIXES "bin"
73  PATHS ${CAMITK_BIN_DIR}
74  )
75 
76  if (NOT CAMITK_INIT_TEST_EXECUTABLE)
77  # Test programs should be installed
78  message(FATAL_ERROR "${APP_NAME} not found.\n This means that automatic test applications were not installed during CamiTK SDK installation.")
79  endif()
80  else()
81  # in CamiTK CE build
82 
83  # add debug postfix if needed by MSVC
84  set(APP_SUFFIX "")
85  # determine which version of the executable to use (debug-suffixed or not)
86  if(MSVC)
87  if(NOT CMAKE_BUILD_TYPE)
88  # Assume the developer that is running the test suite compiled everything in Debug
89  set(APP_SUFFIX ${CAMITK_DEBUG_POSTFIX})
90  else()
91  # support multiplaform (sometimes the "Debug" type is all uppercase, as on Win32, sometimes it is CamelCase)
92  string(TOUPPER ${CMAKE_BUILD_TYPE} CAMITK_BUILD_TYPE_UPPER)
93  if (CAMITK_BUILD_TYPE_UPPER STREQUAL "DEBUG")
94  # manage debug build only
95  set(APP_SUFFIX ${CAMITK_DEBUG_POSTFIX})
96  endif()
97  # if build type is not debug, everything is ok as
98  endif()
99  endif()
100 
101  # In CamiTK CE build directly use the binary dir version
102  set(CAMITK_INIT_TEST_EXECUTABLE ${CMAKE_BINARY_DIR}/bin/${APP_NAME}${APP_SUFFIX})
103  endif()
104  endif()
105  endif()
106 
107  set(CAMITK_TEST_BASENAME ${TEST_APPLICATION_ARG})
108 end(){)
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
test result unset(PREVIOUS_ATTEMPTS) file(GLOB ALL_OUTPUT_FILES $
Definition: CamiTKTestActionStateMachine.h:16
camitk_init_test()
camitk_init_test is a macro to initialize a group of test (for the same command) It is used to initia...
Definition: CamiTKInitTest.h:37