实际上他们两个可以达到一个目标(对于文件操作),但是又有本质上的区别,文档没有细看,但是一般利于项目的管理,使用install,install命令如果在cmake命令中没有指名install参数,实际上时不会执行的,只有在cmake命令中指名install,install命令(在CmakeLists.txt里)才会执行。
Demo:
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
87
88
89
90
91
|
cmake_minimum_required(VERSION 2.8 )
#set(CMAKE_C_COMPILER "D:\VS2008Release\VC\bin\amd64") #set(CMAKE_CXX_COMPILER "D:\VS2008Release\VC\bin\amd64") PROJECT(VisualStaticMT) #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Lib) #set(ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Lib") #message(STATUS ${CMAKE_BINARY_DIR}) set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} / lib)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} / lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} / bin )
#set(SHARE_LIBS_DIR ${CMAKE_BINARY_DIR}/Lib) add_subdirectory(bzlib) add_subdirectory(cairo) add_subdirectory(coders) add_subdirectory(croco) add_subdirectory(ffi) add_subdirectory(filters) add_subdirectory(glib) add_subdirectory(jbig) add_subdirectory(jp2) add_subdirectory(jpeg) add_subdirectory(lcms) add_subdirectory(librsvg) add_subdirectory(libxml) add_subdirectory(lqr) add_subdirectory(magick) add_subdirectory(Magick + + )
add_subdirectory(pango) add_subdirectory(pixman) add_subdirectory(png) add_subdirectory(tiff) add_subdirectory(ttf) add_subdirectory(wand) add_subdirectory(webp) add_subdirectory(wmf) add_subdirectory(zlib) #头文件输出 #file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/Magick++/lib/Magick++.h" #DESTINATION "${CMAKE_BINARY_DIR}/include" ) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Magick++/lib/Magick++.h"
DESTINATION "${CMAKE_BINARY_DIR}/include"
)
#wand文件夹 file (GLOB wand_hdrs "${CMAKE_CURRENT_SOURCE_DIR}/wand/*.h" )
#file(COPY ${wand_hdrs} #DESTINATION "${CMAKE_BINARY_DIR}/include/wand" ) install(FILES ${wand_hdrs} DESTINATION "${CMAKE_BINARY_DIR}/include/wand"
)
#file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/VisualMagick/wand/wand-config.h.in" #DESTINATION "${CMAKE_BINARY_DIR}/include/wand" ) #文件重命名 #file(RENAME "${CMAKE_BINARY_DIR}/include/wand/wand-config.h.in" "${CMAKE_BINARY_DIR}/include/wand/wand-config.h") install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/VisualMagick/wand/wand-config.h.in"
DESTINATION "${CMAKE_BINARY_DIR}/include/wand"
RENAME "wand-config.h" )
#Magick++文件夹 file (GLOB Magick_hdrs "${CMAKE_CURRENT_SOURCE_DIR}/Magick++/lib/Magick++/*.h" )
#file(COPY ${Magick_hdrs} #DESTINATION "${CMAKE_BINARY_DIR}/include/Magick++" ) install(FILES ${Magick_hdrs} DESTINATION "${CMAKE_BINARY_DIR}/include/Magick++"
)
#magick文件夹 file (GLOB magick_hdrs "${CMAKE_CURRENT_SOURCE_DIR}/magick/*.h" )
#file(COPY ${magick_hdrs} #DESTINATION "${CMAKE_BINARY_DIR}/include/magick" #) install(FILES ${magick_hdrs} DESTINATION "${CMAKE_BINARY_DIR}/include/magick"
)
#wand #add_subdirectory(cairo) |