CMakeLists.txt 110 KB
Newer Older
Ken Martin's avatar
Ken Martin committed
1
2
# a macro for tests that have a simple format where the name matches the
# directory and project
3
4
5
6
macro(ADD_TEST_MACRO NAME COMMAND)
  string(REPLACE "." "/" dir "${NAME}")
  string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
  add_test(${NAME} ${CMAKE_CTEST_COMMAND}
Ken Martin's avatar
Ken Martin committed
7
    --build-and-test
8
9
    "${CMake_SOURCE_DIR}/Tests/${dir}"
    "${CMake_BINARY_DIR}/Tests/${dir}"
Ken Martin's avatar
Ken Martin committed
10
    --build-two-config
11
    ${build_generator_args}
12
    --build-project ${proj}
13
    ${${NAME}_CTEST_OPTIONS}
14
    --build-options ${build_options}
15
    ${${NAME}_BUILD_OPTIONS}
16
    --test-command ${COMMAND} ${ARGN})
17
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
18
endmacro()
Ken Martin's avatar
Ken Martin committed
19

20
include(${CMAKE_CURRENT_SOURCE_DIR}/RegexEscapeString.cmake)
21

22
include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
23

24
# Fake a user home directory to avoid polluting the real one.
25
26
27
28
29
if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
  set(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome")
  file(MAKE_DIRECTORY "${TEST_HOME}")
  file(WRITE "${TEST_HOME}/.cvspass" ":pserver:anoncvs@www.cmake.org:/cvsroot/KWSys A\n")
  set(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one.
30
31
# But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that
# need access to the real HOME directory.
32
33
set(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\")
set(ENV{HOME} \"${TEST_HOME}\")
34
")
35
endif()
36

37
# Choose a default configuration for CTest tests.
38
39
40
41
set(CTestTest_CONFIG Debug)
if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE)
  set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE})
endif()
42

43
configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
44
               ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
45

46
# Testing
47
if(BUILD_TESTING)
48
  set(CMAKE_TEST_DEVENV "")
49
  if(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
50
51
52
53
54
    if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio")
      set(CMAKE_TEST_MAKEPROGRAM "")
    else()
      set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}")
    endif()
55
56
57
58
    if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND
        NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
      set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}")
    endif()
59
60
  endif()

61
62
63
  if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32))
    set(TEST_CompileCommandOutput 1)
  endif()
64

65
  set(MAKE_IS_GNU )
66
  if(CMAKE_TEST_MAKEPROGRAM MATCHES make)
67
68
69
70
71
72
73
74
75
76
77
    execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
      RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
    if("${res}" STREQUAL "0")
      if("${out}" MATCHES "GNU")
        set(MAKE_IS_GNU 1)
      endif()
    endif()
  endif()

  # some old versions of make simply cannot handle spaces in paths
  if (MAKE_IS_GNU OR
78
79
      CMAKE_TEST_MAKEPROGRAM MATCHES "nmake|gmake|wmake" OR
      CMAKE_TEST_GENERATOR MATCHES "Visual Studio|XCode|Borland")
80
81
82
83
84
    set(MAKE_SUPPORTS_SPACES 1)
  else()
    set(MAKE_SUPPORTS_SPACES 0)
  endif()

85
86
87
  set(build_generator_args
    --build-generator ${CMAKE_TEST_GENERATOR}
    )
88
89
90
91
92
  if(CMAKE_TEST_GENERATOR_TOOLSET)
    list(APPEND build_generator_args
      --build-generator-toolset ${CMAKE_TEST_GENERATOR_TOOLSET}
      )
  endif()
93

94
  set(build_options)
95
96
97
  if(CMAKE_TEST_MAKEPROGRAM)
    list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
  endif()
98

99
100
101
  add_subdirectory(CMakeLib)
  add_subdirectory(CMakeOnly)
  add_subdirectory(RunCMake)
102

103
  add_subdirectory(FindPackageModeMakefileTest)
104

105
106
  add_subdirectory(CTestTestMemcheck)

107
  # Collect a list of all test build directories.
108
  set(TEST_BUILD_DIRS)
109

110
  # Should the long tests be run?
111
  option(CMAKE_RUN_LONG_TESTS
112
    "Should the long tests be run (such as Bootstrap)." ON)
113
  mark_as_advanced(CMAKE_RUN_LONG_TESTS)
114

115
116
  if (CMAKE_RUN_LONG_TESTS)
    option(CTEST_TEST_CTEST
117
      "Should the tests that run a full sub ctest process be run?"
118
      OFF)
119
    mark_as_advanced(CTEST_TEST_CTEST)
120
  endif ()
121

122
123
124
125
  # Should tests that use CVS be run?
  #
  set(do_cvs_tests 0)

126
127
  if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
    find_package(CVS QUIET)
128
  else()
129
    find_program(CVS_EXECUTABLE NAMES cvs)
130
  endif()
131

132
133
  if(CVS_EXECUTABLE)
    set(do_cvs_tests 1)
134
  endif()
135

136
137
138
  if(do_cvs_tests AND NOT UNIX)
    if("${CVS_EXECUTABLE}" MATCHES "cygwin")
      set(do_cvs_tests 0)
139
140
    endif()
  endif()
141

142
143
144
145
146
147
148
149
150
151
152
  # Should CPack tests be run? By default, yes, but...
  #
  # Disable packaging test on Apple 10.3 and below. PackageMaker starts
  # DiskManagementTool as root and disowns it
  # (http://lists.apple.com/archives/installer-dev/2005/Jul/msg00005.html).
  # It is left holding open pipe handles and preventing ProcessUNIX from
  # detecting end-of-data even after its immediate child exits. Then
  # the test hangs until it times out and is killed. This is a
  # well-known bug in kwsys process execution that I would love to get
  # time to fix.
  #
153
  option(CTEST_TEST_CPACK
154
155
    "Should the tests that use '--build-target package' be run?"
    ON)
156
157
158
159
  mark_as_advanced(CTEST_TEST_CPACK)
  set(CTEST_TEST_OSX_ARCH 0)
  if(APPLE)
    execute_process(
160
161
162
163
      COMMAND sw_vers -productVersion
      OUTPUT_VARIABLE OSX_VERSION
      OUTPUT_STRIP_TRAILING_WHITESPACE
      )
164
165
166
167
    if(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]")
      message(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4")
      message(STATUS "OSX_VERSION='${OSX_VERSION}'")
      set(CTEST_TEST_CPACK OFF)
168
    else()
169
      set(CTEST_TEST_OSX_ARCH 1)
170
171
    endif()
  endif()
172

173
174
  # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
  # whichever is greater.
175
176
177
  set(CMAKE_LONG_TEST_TIMEOUT 1500)
  if(CTEST_TEST_TIMEOUT)
    set(CMAKE_LONG_TEST_TIMEOUT ${CTEST_TEST_TIMEOUT})
178
  endif()
179
180
  if(CMAKE_LONG_TEST_TIMEOUT LESS 1500)
    set(CMAKE_LONG_TEST_TIMEOUT 1500)
181
  endif()
182

183
184
185
  add_test(NAME CMake.Copyright
    COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake)

186
  # add a bunch of standard build-and-test style tests
Ken Martin's avatar
Ken Martin committed
187
188
  ADD_TEST_MACRO(CommandLineTest CommandLineTest)
  ADD_TEST_MACRO(FindPackageTest FindPackageTest)
Bill Hoffman's avatar
Bill Hoffman committed
189
  ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll)
Ken Martin's avatar
Ken Martin committed
190
191
192
193
194
  ADD_TEST_MACRO(StringFileTest StringFileTest)
  ADD_TEST_MACRO(TryCompile TryCompile)
  ADD_TEST_MACRO(TarTest TarTest)
  ADD_TEST_MACRO(SystemInformation SystemInformation)
  ADD_TEST_MACRO(MathTest MathTest)
195
  # assume no resources building to test
196
  set(TEST_RESOURCES FALSE)
197
  # for windows and cygwin assume we have resources
198
199
200
  if(WIN32 OR CYGWIN)
    set(TEST_RESOURCES TRUE)
  endif()
201
  # for borland and watcom there is no resource support
202
  if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake" OR
203
      "${CMAKE_TEST_GENERATOR}" MATCHES "Borland")
204
205
206
    set(TEST_RESOURCES FALSE)
  endif()
  if(TEST_RESOURCES)
207
    ADD_TEST_MACRO(VSResource VSResource)
208
  endif()
Ken Martin's avatar
Ken Martin committed
209
210
  ADD_TEST_MACRO(Simple Simple)
  ADD_TEST_MACRO(PreOrder PreOrder)
211
  ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
212
  set_tests_properties(MissingSourceFile PROPERTIES
213
    PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
214
  if(CMAKE_Fortran_COMPILER)
215
    ADD_TEST_MACRO(FortranOnly FortranOnly)
216
  endif()
217
218
219
220
221
222
  # test Visual Studio GNU Fortran mixing with cmake_add_fortran_subdirectory
  # run this project if we have a working fortran compiler or
  # the test is enabled with CMAKE_TEST_CMAKE_ADD_FORTRAN cache variable.
  # If you enable the test, CMake should find the MinGW fortran install,
  # or in some cases you might need to set the PATH so that cmake can find
  # the gfortran from mingw.
223
224
  if(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN)
    set(CMAKE_SKIP_VSGNUFortran FALSE)
225
226
    # disable test for apple builds using ifort if they are building
    # more than one architecture, as ifort does not support that.
227
228
229
230
231
232
233
234
    if(APPLE AND (CMAKE_Fortran_COMPILER MATCHES ifort))
      list(LENGTH CMAKE_OSX_ARCHITECTURES len)
      if("${len}" GREATER 1)
        message(STATUS "Skip VSGNUFortran for ifort dual cpu mac build")
        set(CMAKE_SKIP_VSGNUFortran TRUE)
      endif()
    endif()
    if((CMAKE_C_COMPILER MATCHES lsb)
235
        AND (CMAKE_Fortran_COMPILER MATCHES ifort))
236
237
238
239
      message(STATUS "Skip VSGNUFortran for ifort and lsb compilers")
      set(CMAKE_SKIP_VSGNUFortran TRUE)
    endif()
    if(NOT CMAKE_SKIP_VSGNUFortran)
240
      ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake)
241
242
    endif()
  endif()
Ken Martin's avatar
Ken Martin committed
243
244
  ADD_TEST_MACRO(COnly COnly)
  ADD_TEST_MACRO(CxxOnly CxxOnly)
245
  ADD_TEST_MACRO(IPO COnly/COnly)
246
  ADD_TEST_MACRO(OutDir runtime/OutDir)
Brad King's avatar
Brad King committed
247
  ADD_TEST_MACRO(ObjectLibrary UseCshared)
Ken Martin's avatar
Ken Martin committed
248
249
  ADD_TEST_MACRO(NewlineArgs NewlineArgs)
  ADD_TEST_MACRO(SetLang SetLang)
250
  ADD_TEST_MACRO(EmptyProperty EmptyProperty)
251
252
  ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
  ADD_TEST_MACRO(LoadCommand LoadedCommand)
253
  ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory)
254
  ADD_TEST_MACRO(LinkLanguage LinkLanguage)
255
256
  ADD_TEST_MACRO(LinkLine LinkLine)
  ADD_TEST_MACRO(MacroTest miniMacroTest)
257
  ADD_TEST_MACRO(FunctionTest miniFunctionTest)
258
  ADD_TEST_MACRO(ReturnTest ReturnTest)
259
  ADD_TEST_MACRO(Properties Properties)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
260
  ADD_TEST_MACRO(Assembler HelloAsm)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
261
  ADD_TEST_MACRO(SourceGroups SourceGroups)
262
  ADD_TEST_MACRO(Preprocess Preprocess)
263
  set(ExportImport_BUILD_OPTIONS -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
264
  ADD_TEST_MACRO(ExportImport ExportImport)
Brad King's avatar
Brad King committed
265
  ADD_TEST_MACRO(Unset Unset)
266
  ADD_TEST_MACRO(PolicyScope PolicyScope)
267
  ADD_TEST_MACRO(EmptyLibrary EmptyLibrary)
268
  ADD_TEST_MACRO(CompileDefinitions CompileDefinitions)
269
  ADD_TEST_MACRO(CompileOptions CompileOptions)
270
  ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
271
  ADD_TEST_MACRO(AliasTarget AliasTarget)
272
  ADD_TEST_MACRO(StagingPrefix StagingPrefix)
273
  ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
274
  set_tests_properties(EmptyLibrary PROPERTIES
275
    PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
276
  ADD_TEST_MACRO(CrossCompile CrossCompile)
277
  set_tests_properties(CrossCompile PROPERTIES
278
    PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode")
279
  if("${CMAKE_TEST_GENERATOR}" MATCHES "Make")
280
    ADD_TEST_MACRO(Policy0002 Policy0002)
281
  endif()
282
  if(CTEST_TEST_OSX_ARCH)
283
    ADD_TEST_MACRO(Architecture Architecture)
284
    set_tests_properties(Architecture PROPERTIES
285
      PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)")
286
  endif()
287

288
  list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
289

290
  if(NOT QT4_FOUND)
291
    find_package(Qt4 QUIET)
292
  endif()
293

294
  if(QT4_FOUND)
295
296
297
298
    # test whether the Qt4 which has been found works, on some machines
    # which run nightly builds there were errors like "wrong file format"
    # for libQtCore.so. So first check it works, and only if it does add
    # the automoc test.
299
300
301
    include(CheckCXXSourceCompiles)
    set(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
    set(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
302

303
304
    set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
    set(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES})
305
306
307
308

    CHECK_CXX_SOURCE_COMPILES("#include <QCoreApplication>\n int main() {return (qApp == 0 ? 0 : 1); }\n"
                              QT4_WORKS)

309
310
311
    set(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}")
    set(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}")
  endif()
312

313
  # run test for BundleUtilities on supported platforms/compilers
314
  if(MSVC OR
315
     MINGW OR
316
317
     CMAKE_SYSTEM_NAME MATCHES "Linux" OR
     CMAKE_SYSTEM_NAME MATCHES "Darwin")
318
  if(NOT "${CMAKE_TEST_GENERATOR}" STREQUAL "Watcom WMake")
319

320
    add_test(BundleUtilities ${CMAKE_CTEST_COMMAND}
321
322
323
      --build-and-test
      "${CMake_SOURCE_DIR}/Tests/BundleUtilities"
      "${CMake_BINARY_DIR}/Tests/BundleUtilities"
324
      ${build_generator_args}
325
      --build-project BundleUtilities
326
      --build-options ${build_options}
327
      )
328
    list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities")
329
330
331

    # run test for DeployQt4 on supported platforms/compilers (which depends on BundleUtilities)
    # this test also depends on the existence of the standard qtiff plugin
332
    if(QT4_WORKS AND QT_QTSQL_FOUND)
333
      add_test(Qt4Deploy ${CMAKE_CTEST_COMMAND}
334
335
336
        --build-and-test
        "${CMake_SOURCE_DIR}/Tests/Qt4Deploy"
        "${CMake_BINARY_DIR}/Tests/Qt4Deploy"
337
        ${build_generator_args}
338
        --build-project Qt4Deploy
339
        --build-options ${build_options}
340
        -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
341
        -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
342
        )
343
      list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Deploy")
344
345
    endif()

346
347
  endif()
  endif()
348

349
350
351
352
  set(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly")
  set(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly")
  set(CMAKE_BUILD_TEST_EXE COnly)
  configure_file("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
353
    "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY)
354
  add_test(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P
355
    "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake")
356
  list(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR})
357
  # now do it again for a project that has two project commands
358
359
360
361
  set(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/DoubleProject")
  set(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/DoubleProject")
  set(CMAKE_BUILD_TEST_EXE just_silly)
  configure_file("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
362
    "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake" @ONLY)
363
  add_test(CMakeDoubleProject ${CMAKE_CMAKE_COMMAND} -P
364
    "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake")
365
  list(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR})
366

Brad King's avatar
Brad King committed
367
368
  ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize)

369
370
371
372
  add_test(Module.ExternalData ${CMAKE_CTEST_COMMAND}
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/Module/ExternalData"
    "${CMake_BINARY_DIR}/Tests/Module/ExternalData"
373
    ${build_generator_args}
374
    --build-project ExternalDataTest
375
    --build-noclean
376
    --force-new-ctest-process
377
378
    --build-options ${build_options}
      -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
379
380
381
382
    --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
    )
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData")

383
384
  ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader)

385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
  if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
    include(CheckCXXCompilerFlag)
    check_cxx_compiler_flag(-fPIE run_pic_test)
  else()
    if (CMAKE_CXX_COMPILER_ID MATCHES "PGI"
        OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale"
        OR CMAKE_SYSTEM_NAME MATCHES "IRIX64"
        OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
      set(run_pic_test 0)
    else()
      set(run_pic_test 1)
    endif()
  endif()

  if (run_pic_test)
    ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets)
  endif()

403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
  if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND
    (NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2) AND
    (CMAKE_SYSTEM_NAME MATCHES "Linux"))

    include(CheckCXXCompilerFlag)
    check_cxx_compiler_flag(
      -fvisibility-inlines-hidden run_inlines_hidden_test)
  endif()

  if(run_inlines_hidden_test)
    add_test(VisibilityInlinesHidden ${CMAKE_CTEST_COMMAND}
      --build-and-test
      "${CMake_SOURCE_DIR}/Tests/VisibilityInlinesHidden"
      "${CMake_BINARY_DIR}/Tests/VisibilityInlinesHidden"
      ${build_generator_args}
      --build-project VisibilityInlinesHidden
      --build-options ${build_options}
    )
    list(APPEND TEST_BUILD_DIRS
      "${CMake_BINARY_DIR}/Tests/VisibilityInlinesHidden"
    )
  endif()

426
  add_test(LinkFlags-prepare
427
428
429
430
    ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/LinkFlags"
    "${CMake_BINARY_DIR}/Tests/LinkFlags"
431
    ${build_generator_args}
432
433
    --build-project LinkFlags
    --build-target LinkFlags
434
435
    --build-options ${build_options}
      -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE}
436
    )
437
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags")
438

439
440
  macro(ADD_LINK_FLAGS_TEST name depends)
    add_test(LinkFlags-${name}
441
442
443
      ${CMAKE_CMAKE_COMMAND} --build "${CMake_BINARY_DIR}/Tests/LinkFlags"
      --target LinkFlags_${name} --config \${CTEST_CONFIGURATION_TYPE}
      )
444
    set_tests_properties(LinkFlags-${name} PROPERTIES
445
      PASS_REGULAR_EXPRESSION "BADFLAG" DEPENDS LinkFlags-${depends})
446
  endmacro()
447
448
  ADD_LINK_FLAGS_TEST(lib prepare)
  ADD_LINK_FLAGS_TEST(dll lib)
449
450
  ADD_LINK_FLAGS_TEST(mod dll)
  ADD_LINK_FLAGS_TEST(exe mod)
451
452
  ADD_LINK_FLAGS_TEST(lib_config exe)
  ADD_LINK_FLAGS_TEST(dll_config lib_config)
453
454
455
456
457
458
459
460
461
462
  ADD_LINK_FLAGS_TEST(mod_config dll_config)
  ADD_LINK_FLAGS_TEST(exe_config mod_config)
  ADD_LINK_FLAGS_TEST(lib_flags exe_config)
  ADD_LINK_FLAGS_TEST(dll_flags lib_flags)
  ADD_LINK_FLAGS_TEST(mod_flags dll_flags)
  ADD_LINK_FLAGS_TEST(exe_flags mod_flags)
  ADD_LINK_FLAGS_TEST(lib_flags_config exe_flags)
  ADD_LINK_FLAGS_TEST(dll_flags_config lib_flags_config)
  ADD_LINK_FLAGS_TEST(mod_flags_config dll_flags_config)
  ADD_LINK_FLAGS_TEST(exe_flags_config mod_flags_config)
463

464
465
  # If we are running right now with a UnixMakefiles based generator,
  # build the "Simple" test with the ExtraGenerators, if available
466
  # This doesn't test whether the generated project files work (unfortunately),
467
  # mainly it tests that cmake doesn't crash when generating these project files.
468
  if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles"  OR  ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
469
    # check which generators we have
470
471
    execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
      OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
472
    # check for the Eclipse generator
473
474
    if ("${cmakeOutput}" MATCHES Eclipse)
      add_test(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND}
475
476
477
478
479
         --build-and-test
         "${CMake_SOURCE_DIR}/Tests/Simple"
         "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator"
         --build-two-config
         --build-generator "Eclipse CDT4 - Unix Makefiles"
480
         --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
481
         --build-project Simple
482
         --build-options ${build_options}
483
         --test-command Simple)
484
      list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator")
485
    endif ()
486
487

    # check for the CodeBlocks generator
488
489
    if ("${cmakeOutput}" MATCHES CodeBlocks)
      add_test(Simple_CodeBlocksGenerator ${CMAKE_CTEST_COMMAND}
490
491
492
493
494
         --build-and-test
         "${CMake_SOURCE_DIR}/Tests/Simple"
         "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator"
         --build-two-config
         --build-generator "CodeBlocks - Unix Makefiles"
495
         --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
496
         --build-project Simple
497
         --build-options ${build_options}
498
         --test-command Simple)
499
      list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator")
500
    endif ()
501
    # check for the KDevelop3 generator
502
503
    if ("${cmakeOutput}" MATCHES KDevelop3)
      add_test(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND}
504
505
506
507
508
         --build-and-test
         "${CMake_SOURCE_DIR}/Tests/Simple"
         "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator"
         --build-two-config
         --build-generator "KDevelop3 - Unix Makefiles"
509
         --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
510
         --build-project Simple
511
         --build-options ${build_options}
512
         --test-command Simple)
513
      list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator")
514
    endif ()
515

516
  endif()
517

518
  # test for correct sub-project generation
519
520
  # not implemented in VS 6, VS 7.0, Xcode, or Ninja
  if(NOT CMAKE_TEST_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja")
521
522
    # run cmake and configure all of SubProject
    # but only build the independent executable car
523
    add_test(SubProject ${CMAKE_CTEST_COMMAND}
524
525
526
527
      --build-and-test
      "${CMake_SOURCE_DIR}/Tests/SubProject"
      "${CMake_BINARY_DIR}/Tests/SubProject"
      --build-project SubProject
528
      ${build_generator_args}
529
      --build-target car
530
      --build-options ${build_options}
531
532
      --test-command car
      )
533

534
535
536
537
538
    # For stage 2, do not run cmake again.
    # Then build the foo sub project which should build
    # the bar library which should be referenced because
    # foo links to the static library bar, but bar is not
    # directly in the foo sub project
539
540
541
542
543
    if(CMAKE_TEST_MAKEPROGRAM)
      set(SubProject-Stage2_BUILD_MAKEPROGRAM
        --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
        )
    endif()
544
    add_test(SubProject-Stage2  ${CMAKE_CTEST_COMMAND}
545
      --build-and-test
546
547
548
549
550
      "${CMake_SOURCE_DIR}/Tests/SubProject/foo"
      "${CMake_BINARY_DIR}/Tests/SubProject/foo"
      --build-generator ${CMAKE_TEST_GENERATOR}
      --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
      ${SubProject-Stage2_BUILD_MAKEPROGRAM}
551
      --build-nocmake
552
553
      --build-project foo
      --build-target foo
554
      --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo"
555
      --build-options ${build_options}
556
557
      --test-command foo
      )
558
559
    set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject)
    list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject")
560
  endif()
561

562
563
  # macro to add a test that will build a nightly release
  # of CMake for given platform using the release scripts
564
565
566
567
  macro(ADD_NIGHTLY_BUILD_TEST name script)
    set(_TEST_DIR "${CMake_BINARY_DIR}/Tests/${name}")
    file(MAKE_DIRECTORY "${_TEST_DIR}")
    file(WRITE "${_TEST_DIR}/nightly-cmake.sh"
568
      "cd ${_TEST_DIR}
569
${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=nightly -P ${CMake_SOURCE_DIR}/Utilities/Release/${script}
570
${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
571
    ")
572
573
574
    add_test(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
    if(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
      set_tests_properties (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
575
576
    endif()
  endmacro()
577
  if(CMAKE_BUILD_NIGHTLY_RELEASES)
578
579
580
581
    ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows
      dash2win64_release.cmake)
    ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac
      dashmacmini2_release.cmake)
582
583
    ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac64
      dashmacmini5_release.cmake)
584
585
    ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux
      magrathea_release.cmake)
586
  endif()
587

588
  # add tests with more complex invocations
589
  add_test(Framework ${CMAKE_CTEST_COMMAND}
590
591
592
593
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/Framework"
    "${CMake_BINARY_DIR}/Tests/Framework"
    --build-two-config
594
    ${build_generator_args}
595
    --build-project Framework
596
    --build-options ${build_options}
597
598
    "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install"
    --test-command bar)
599
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework")
600

601
  add_test(TargetName ${CMAKE_CTEST_COMMAND}
602
603
604
605
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/TargetName"
    "${CMake_BINARY_DIR}/Tests/TargetName"
    --build-two-config
606
    ${build_generator_args}
607
    --build-project TargetName
608
    --build-options ${build_options}
609
    --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
610
611
    ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
    ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
612
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName")
613

614
  add_test(LibName ${CMAKE_CTEST_COMMAND}
615
616
617
618
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/LibName"
    "${CMake_BINARY_DIR}/Tests/LibName"
    --build-two-config
619
    ${build_generator_args}
620
    --build-project LibName
621
    --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
622
    --build-options ${build_options}
623
624
    --test-command foobar
    )
625
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName")
626

627
  add_test(CustComDepend ${CMAKE_CTEST_COMMAND}
628
629
630
631
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/CustComDepend"
    "${CMake_BINARY_DIR}/Tests/CustComDepend"
    --build-two-config
632
    ${build_generator_args}
633
    --build-project CustComDepend
634
    --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin"
635
    --build-options ${build_options}
636
637
    --test-command foo bar.c
    )
638
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend")
639

640
  add_test(ArgumentExpansion  ${CMAKE_CTEST_COMMAND}
Ben Boeckel's avatar
Ben Boeckel committed
641
642
643
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/ArgumentExpansion"
    "${CMake_BINARY_DIR}/Tests/ArgumentExpansion"
644
    ${build_generator_args}
Ben Boeckel's avatar
Ben Boeckel committed
645
646
    --build-project ArgumentExpansion
    --build-exe-dir "${CMake_BINARY_DIR}/Tests/ArgumentExpansion/bin"
647
    --build-options ${build_options}
Ben Boeckel's avatar
Ben Boeckel committed
648
    )
649
  set_tests_properties(ArgumentExpansion PROPERTIES
650
    FAIL_REGULAR_EXPRESSION "Unexpected: ")
651
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion")
Ben Boeckel's avatar
Ben Boeckel committed
652

Brad King's avatar
Brad King committed
653
654
655
656
  add_test(GeneratorExpression  ${CMAKE_CTEST_COMMAND}
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/GeneratorExpression"
    "${CMake_BINARY_DIR}/Tests/GeneratorExpression"
657
    ${build_generator_args}
Brad King's avatar
Brad King committed
658
    --build-project GeneratorExpression
659
660
    --build-options ${build_options}
      -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
661
    --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
Brad King's avatar
Brad King committed
662
663
664
    )
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression")

665
  add_test(CustomCommand  ${CMAKE_CTEST_COMMAND}
666
667
668
669
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/CustomCommand"
    "${CMake_BINARY_DIR}/Tests/CustomCommand"
    --build-two-config
670
    ${build_generator_args}
671
672
    --build-project CustomCommand
    --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
673
    --build-options ${build_options}
674
675
    --test-command CustomCommand
    )
676
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand")
677

678
679
  ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND})

680
  add_test(CustomCommandWorkingDirectory  ${CMAKE_CTEST_COMMAND}
681
682
683
684
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory"
    "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory"
    --build-two-config
685
    ${build_generator_args}
686
    --build-project TestWorkingDir
687
    --build-options ${build_options}
688
689
    --test-command working
    )
690
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory")
691

692
   #add_test(SimpleExclude ${CMAKE_CTEST_COMMAND}
Ken Martin's avatar
Ken Martin committed
693
694
695
   #  --build-and-test
   #  "${CMake_SOURCE_DIR}/Tests/SimpleExclude"
   #  "${CMake_BINARY_DIR}/Tests/SimpleExclude"
696
   #  ${build_generator_args}
Ken Martin's avatar
Ken Martin committed
697
698
   #  --build-project SimpleExclude
   #  --build-two-config
699
   #  --build-options ${build_options}
Ken Martin's avatar
Ken Martin committed
700
   #  --test-command t4
701
702
   #--test-command "${CMAKE_COMMAND}"
   #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}"
703
   #-P "${CMake_BINARY_DIR}/Tests/SimpleExclude/run.cmake"
Ken Martin's avatar
Ken Martin committed
704
   #)
705

706
#  add_test(SameName  ${CMAKE_CTEST_COMMAND}
707
708
709
#    --build-and-test
#    "${CMake_SOURCE_DIR}/Tests/SameName"
#    "${CMake_BINARY_DIR}/Tests/SameName"
710
#    ${build_generator_args}
711
712
#    --build-project SameName
#    --build-two-config
713
#    --build-options ${build_options}
714
715
716
#    --test-command
#    "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2")

717
  add_test(OutOfSource ${CMAKE_CTEST_COMMAND}
718
719
720
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/OutOfSource"
    "${CMake_BINARY_DIR}/Tests/OutOfSource"
721
    ${build_generator_args}
722
723
    --build-project OutOfSource
    --build-two-config
724
    --build-options ${build_options}
725
726
    --test-command
    "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple")
727
728
729
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource")
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSourceDeep")
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfBinary")
730

731
  add_test(BuildDepends ${CMAKE_CTEST_COMMAND}
732
733
734
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/BuildDepends"
    "${CMake_BINARY_DIR}/Tests/BuildDepends"
735
    ${build_generator_args}
736
    --build-project BuildDepends
737
    --build-options ${build_options}
738
    )
739
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
740

741
  set(SimpleInstallInstallDir
742
    "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
743
  add_test(SimpleInstall ${CMAKE_CTEST_COMMAND}
744
745
746
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
    "${CMake_BINARY_DIR}/Tests/SimpleInstall"
747
    ${build_generator_args}
748
749
    --build-project TestSimpleInstall
    --build-two-config
750
    --build-options ${build_options}
751
    "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
752
    "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}"
753
    --test-command   ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
754
755
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall")
  add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
756
757
758
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
    "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
759
    ${build_generator_args}
760
761
    --build-project TestSimpleInstall
    --build-two-config
762
    --build-options ${build_options}
763
764
    "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
    "-DSTAGE2:BOOL=1"
765
    --test-command   ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
766
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
767

768
769
770
771
772
773
774
775
776
777
778
779
780
  set(MissingInstallInstallDir
    "${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory")
  add_test(MissingInstall ${CMAKE_CTEST_COMMAND}
    --build-and-test
    "${CMake_SOURCE_DIR}/Tests/MissingInstall"
    "${CMake_BINARY_DIR}/Tests/MissingInstall"
    ${build_generator_args}
    --build-project TestMissingInstall
    --build-two-config
    --build-options ${build_options}
    "-DCMAKE_INSTALL_PREFIX:PATH=${MissingInstallInstallDir}")
  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MissingInstall")

781
782
783
784
  # By default, run the CPackComponents test if the CTEST_TEST_CPACK
  # option is ON:
  #
  set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
785
  set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
786
  set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
787

788
789
  if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*")
    find_program(RPMBUILD NAMES rpmbuild)
790
  endif()
791
792
793
  # Do not try to build RPM
  if (NOT RPMBUILD)
    set(CPACK_BINARY_RPM OFF)
794
  endif()
795

796
797
798
799
800
  find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
    PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
    DOC "makensis program location"
    )

801
802
803
804
805
806
  # But on Windows, only run the CPackComponents test if the NSIS
  # installer builder is available:
  #
  if(WIN32)
    if(NSIS_MAKENSIS_EXECUTABLE)
      set(CTEST_RUN_CPackComponents ON)
807
    else()
808
      set(CTEST_RUN_CPackComponents OFF)
809
      set(CTEST_package_X11_TEST OFF)
810
811
    endif()
  endif()
812

813
814
815
816
817
818
819
820
821
822
823
824
825
826
  # On Windows run the CPackWiXGenerator test
  # if the WiX Toolset seems to be available
  if(WIN32)
    file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT)

    find_program(WIX_LIGHT_EXECUTABLE light
      PATHS "${WIX_ROOT}/bin"
      DOC "WiX Toolset light.exe location")

    if(WIX_LIGHT_EXECUTABLE)
      add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND}
        --build-and-test
        "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator"
        "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
827
        ${build_generator_args}
828
        --build-project CPackWiXGenerator
829
        --build-options ${build_options}
830
831
832
833
834
835
        --test-command ${CMAKE_CMAKE_COMMAND}
          "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
          -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
    endif()
  endif()

836
  if(CTEST_RUN_CPackComponents)
837
    set(CPackComponents_BUILD_OPTIONS)
838
    if(APPLE)
839
      set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
840
    endif()
841
    if(NSIS_MAKENSIS_EXECUTABLE)
842
      set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
843
        -DCPACK_BINARY_NSIS:BOOL=ON)
844
    endif()
845

846
    add_test(CPackComponents ${CMAKE_CTEST_COMMAND}
847
848
849
      --build-and-test
      "${CMake_SOURCE_DIR}/Tests/CPackComponents"
      "${CMake_BINARY_DIR}/Tests/CPackComponents"
850
      ${build_generator_args}
851
852
853
      --build-project CPackComponents
      --build-two-config
      --build-target package
854
      --build-options ${build_options}
855
856
        -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
        -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
857
        ${CPackComponents_BUILD_OPTIONS}
858
        --graphviz=CPackComponents.dot
859
860
861
      --test-command ${CMAKE_CMAKE_COMMAND}
        "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
        -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")