blob: 4727de35fd3e780a228d2237e2585483990c4607 (
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
|
enable_language(C)
function(check_components value)
get_cmake_property(comp COMPONENTS)
if(NOT comp STREQUAL value)
message(FATAL_ERROR "Expected value of COMPONENTS:\n ${value}\nActual value of COMPONENTS:\n ${comp}")
endif()
endfunction()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_library(tgt MODULE obj1.c)
else()
add_executable(tgt main.c)
endif()
install(TARGETS tgt
RUNTIME_DEPENDENCIES
RUNTIME DESTINATION bin COMPONENT bin1
LIBRARY DESTINATION lib COMPONENT lib1
FRAMEWORK DESTINATION fw COMPONENT fw1
)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
check_components("bin1;fw1;lib1")
else()
check_components("bin1;lib1")
endif()
install(RUNTIME_DEPENDENCY_SET deps
RUNTIME DESTINATION bin COMPONENT bin2
LIBRARY DESTINATION lib COMPONENT lib2
FRAMEWORK DESTINATION fw COMPONENT fw2
)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
check_components("bin1;fw1;fw2;lib1;lib2")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
check_components("bin1;bin2;lib1")
elseif()
check_components("bin1;lib1;lib2")
endif()
|