File: CppUTestBuildTimeDiscoverTests.cmake

package info (click to toggle)
cpputest 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,688 kB
  • sloc: cpp: 31,212; sh: 4,978; ansic: 1,360; makefile: 775; ruby: 676; xml: 8; sed: 1
file content (19 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Create target to discover tests
function (cpputest_buildtime_discover_tests EXECUTABLE)
  # The path to the discover script depends on execution mode:
  # - internal (building CppUTest it self).
  # - imported (installed, imported, and executed by a client of the CppUTest lib)
  if (PROJECT_NAME STREQUAL "CppUTest") # internal - (path is relative to source dir)
    SET(DISCOVER_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake)
  else (PROJECT_NAME STREQUAL "CppUTest") # Installed (path is relative to install directory)
    SET(DISCOVER_SCRIPT ${CppUTest_DIR}/Scripts/CppUTestBuildTimeDiscoverTests.cmake)
  endif (PROJECT_NAME STREQUAL "CppUTest")

  add_custom_command (TARGET ${EXECUTABLE}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -DTESTS_DETAILED:BOOL=${TESTS_DETAILED} -DEXECUTABLE=$<TARGET_FILE:${EXECUTABLE}> -P ${DISCOVER_SCRIPT}
    VERBATIM
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    COMMENT "Discovering Tests in ${EXECUTABLE}"
    VERBATIM)
endfunction ()