summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPack/tests/EXT/test.cmake
blob: 976cb6ae85be61d438c38107718def814173ab66 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
include(CPackComponent)

if(RunCMake_SUBTEST_SUFFIX STREQUAL "none")
  unset(CPACK_EXT_REQUESTED_VERSIONS)
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good")
  set(CPACK_EXT_REQUESTED_VERSIONS "1.0")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi")
  set(CPACK_EXT_REQUESTED_VERSIONS "1.0;2.0")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major")
  set(CPACK_EXT_REQUESTED_VERSIONS "2.0")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor")
  set(CPACK_EXT_REQUESTED_VERSIONS "1.1")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good")
  set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad")
  set(CPACK_EXT_REQUESTED_VERSIONS "1")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package")
  set(CPACK_EXT_ENABLE_STAGING 1)
  set(CPACK_EXT_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake")
endif()

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4)

cpack_add_component(f1
  DISPLAY_NAME "File 1"
  DESCRIPTION "Component for file 1"
  GROUP f12
  INSTALL_TYPES full f12
)

cpack_add_component(f2
  DISPLAY_NAME "File 2"
  DESCRIPTION "Component for file 2"
  GROUP f12
  DEPENDS f1
  INSTALL_TYPES full f12
)

cpack_add_component(f3
  DISPLAY_NAME "File 3"
  DESCRIPTION "Component for file 3"
  GROUP f34
  DEPENDS f1 f2
  INSTALL_TYPES full
)

cpack_add_component(f4
  DISPLAY_NAME "File 4"
  DESCRIPTION "Component for file 4"
  GROUP f34
  DEPENDS f2 f3 f1
  INSTALL_TYPES full
)

cpack_add_component_group(f12
  DISPLAY_NAME "Files 1 and 2"
  DESCRIPTION "Component group for files 1 and 2"
  PARENT_GROUP f1234
)

cpack_add_component_group(f34
  DISPLAY_NAME "Files 3 and 4"
  DESCRIPTION "Component group for files 3 and 4"
  PARENT_GROUP f1234
)

cpack_add_component_group(f1234
  DISPLAY_NAME "Files 1-4"
  DESCRIPTION "Component group for all files"
)

cpack_add_install_type(full
  DISPLAY_NAME "Full installation"
)

cpack_add_install_type(f12
  DISPLAY_NAME "Only files 1 and 2"
)