File: BuildPackageTest.cmake

package info (click to toggle)
molequeue 0.9.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,924 kB
  • sloc: cpp: 22,039; python: 478; xml: 364; sh: 59; makefile: 14
file content (40 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
get_filename_component(_BuildPackageTest_self_dir
  "${CMAKE_CURRENT_LIST_FILE}" PATH)


if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
  # Not a dashboard, do not add BuildPackage* tests by default:
  set(BUILD_PACKAGE_TEST_DEFAULT OFF)
else()
  # Dashboard, do add BuildPackage* tests by default:
  set(BUILD_PACKAGE_TEST_DEFAULT ON)
endif()


option(BUILD_PACKAGE_TEST "Add BuildPackage* tests..."
  ${BUILD_PACKAGE_TEST_DEFAULT})


function(BuildPackageTest_Add projname binary_dir)
  if (NOT BUILD_PACKAGE_TEST)
    return()
  endif()

  # Use the NAME/COMMAND form of add_test and pass $<CONFIGURATION>.
  # However, using this form requires passing -C when running ctest
  # from the command line, or setting CTEST_CONFIGURATION_TYPE
  # in a -S script.

  configure_file(
    ${_BuildPackageTest_self_dir}/BuildPackage.cmake.in
    ${binary_dir}/BuildPackage${projname}.cmake
    @ONLY
    )

  add_test(
    NAME BuildPackage${projname}
    COMMAND ${CMAKE_COMMAND}
      -D config=$<CONFIGURATION>
      -P ${binary_dir}/BuildPackage${projname}.cmake
    )
endfunction()