InstallRequiredSystemLibraries.cmake 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. # By including this file, all library files listed in the variable
  2. # CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will be installed with
  3. # install(PROGRAMS ...) into bin for WIN32 and lib
  4. # for non-WIN32. If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP is set to TRUE
  5. # before including this file, then the INSTALL command is not called.
  6. # The user can use the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a
  7. # custom install command and install them however they want.
  8. # If it is the MSVC compiler, then the microsoft run
  9. # time libraries will be found and automatically added to the
  10. # CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS, and installed.
  11. # If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC
  12. # compiler, then the debug libraries are installed when available.
  13. # If CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY is set then only the debug
  14. # libraries are installed when both debug and release are available.
  15. # If CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time
  16. # libraries are installed as well as the CRT run time libraries.
  17. # If CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are
  18. # installed to that directory rather than the default.
  19. # If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this file
  20. # warns about required files that do not exist. You can set this variable to
  21. # ON before including this file to avoid the warning. For example, the Visual
  22. # Studio Express editions do not include the redistributable files, so if you
  23. # include this file on a machine with only VS Express installed, you'll get
  24. # the warning.
  25. #=============================================================================
  26. # Copyright 2006-2009 Kitware, Inc.
  27. #
  28. # Distributed under the OSI-approved BSD License (the "License");
  29. # see accompanying file Copyright.txt for details.
  30. #
  31. # This software is distributed WITHOUT ANY WARRANTY; without even the
  32. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  33. # See the License for more information.
  34. #=============================================================================
  35. # (To distribute this file outside of CMake, substitute the full
  36. # License text for the above reference.)
  37. if(MSVC)
  38. file(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
  39. if(CMAKE_CL_64)
  40. if(MSVC_VERSION GREATER 1599)
  41. # VS 10 and later:
  42. set(CMAKE_MSVC_ARCH x64)
  43. else()
  44. # VS 9 and earlier:
  45. set(CMAKE_MSVC_ARCH amd64)
  46. endif()
  47. else()
  48. set(CMAKE_MSVC_ARCH x86)
  49. endif()
  50. get_filename_component(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
  51. get_filename_component(base_dir "${devenv_dir}/../.." ABSOLUTE)
  52. if(MSVC70)
  53. set(__install__libs
  54. "${SYSTEMROOT}/system32/msvcp70.dll"
  55. "${SYSTEMROOT}/system32/msvcr70.dll"
  56. )
  57. endif()
  58. if(MSVC71)
  59. set(__install__libs
  60. "${SYSTEMROOT}/system32/msvcp71.dll"
  61. "${SYSTEMROOT}/system32/msvcr71.dll"
  62. )
  63. endif()
  64. if(MSVC80)
  65. # Find the runtime library redistribution directory.
  66. get_filename_component(msvc_install_dir
  67. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
  68. find_path(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
  69. PATHS
  70. "${msvc_install_dir}/../../VC/redist"
  71. "${base_dir}/VC/redist"
  72. )
  73. mark_as_advanced(MSVC80_REDIST_DIR)
  74. set(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
  75. # Install the manifest that allows DLLs to be loaded from the
  76. # directory containing the executable.
  77. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  78. set(__install__libs
  79. "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest"
  80. "${MSVC80_CRT_DIR}/msvcm80.dll"
  81. "${MSVC80_CRT_DIR}/msvcp80.dll"
  82. "${MSVC80_CRT_DIR}/msvcr80.dll"
  83. )
  84. endif()
  85. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  86. set(MSVC80_CRT_DIR
  87. "${MSVC80_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT")
  88. set(__install__libs ${__install__libs}
  89. "${MSVC80_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest"
  90. "${MSVC80_CRT_DIR}/msvcm80d.dll"
  91. "${MSVC80_CRT_DIR}/msvcp80d.dll"
  92. "${MSVC80_CRT_DIR}/msvcr80d.dll"
  93. )
  94. endif()
  95. endif()
  96. if(MSVC90)
  97. # Find the runtime library redistribution directory.
  98. get_filename_component(msvc_install_dir
  99. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
  100. get_filename_component(msvc_express_install_dir
  101. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
  102. find_path(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
  103. PATHS
  104. "${msvc_install_dir}/../../VC/redist"
  105. "${msvc_express_install_dir}/../../VC/redist"
  106. "${base_dir}/VC/redist"
  107. )
  108. mark_as_advanced(MSVC90_REDIST_DIR)
  109. set(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
  110. # Install the manifest that allows DLLs to be loaded from the
  111. # directory containing the executable.
  112. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  113. set(__install__libs
  114. "${MSVC90_CRT_DIR}/Microsoft.VC90.CRT.manifest"
  115. "${MSVC90_CRT_DIR}/msvcm90.dll"
  116. "${MSVC90_CRT_DIR}/msvcp90.dll"
  117. "${MSVC90_CRT_DIR}/msvcr90.dll"
  118. )
  119. endif()
  120. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  121. set(MSVC90_CRT_DIR
  122. "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
  123. set(__install__libs ${__install__libs}
  124. "${MSVC90_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest"
  125. "${MSVC90_CRT_DIR}/msvcm90d.dll"
  126. "${MSVC90_CRT_DIR}/msvcp90d.dll"
  127. "${MSVC90_CRT_DIR}/msvcr90d.dll"
  128. )
  129. endif()
  130. endif()
  131. macro(MSVCRT_FILES_FOR_VERSION version)
  132. set(v "${version}")
  133. # Find the runtime library redistribution directory.
  134. get_filename_component(msvc_install_dir
  135. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${v}.0;InstallDir]" ABSOLUTE)
  136. find_path(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT
  137. PATHS
  138. "${msvc_install_dir}/../../VC/redist"
  139. "${base_dir}/VC/redist"
  140. "$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist"
  141. "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio ${v}.0/VC/redist"
  142. )
  143. mark_as_advanced(MSVC${v}_REDIST_DIR)
  144. set(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT")
  145. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  146. set(__install__libs
  147. "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll"
  148. "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll"
  149. )
  150. endif()
  151. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  152. set(MSVC${v}_CRT_DIR
  153. "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT")
  154. set(__install__libs ${__install__libs}
  155. "${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll"
  156. "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll"
  157. )
  158. endif()
  159. endmacro()
  160. if(MSVC10)
  161. MSVCRT_FILES_FOR_VERSION(10)
  162. endif()
  163. if(MSVC11)
  164. MSVCRT_FILES_FOR_VERSION(11)
  165. endif()
  166. if(CMAKE_INSTALL_MFC_LIBRARIES)
  167. if(MSVC70)
  168. set(__install__libs ${__install__libs}
  169. "${SYSTEMROOT}/system32/mfc70.dll"
  170. )
  171. endif()
  172. if(MSVC71)
  173. set(__install__libs ${__install__libs}
  174. "${SYSTEMROOT}/system32/mfc71.dll"
  175. )
  176. endif()
  177. if(MSVC80)
  178. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  179. set(MSVC80_MFC_DIR
  180. "${MSVC80_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
  181. set(__install__libs ${__install__libs}
  182. "${MSVC80_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
  183. "${MSVC80_MFC_DIR}/mfc80d.dll"
  184. "${MSVC80_MFC_DIR}/mfc80ud.dll"
  185. "${MSVC80_MFC_DIR}/mfcm80d.dll"
  186. "${MSVC80_MFC_DIR}/mfcm80ud.dll"
  187. )
  188. endif()
  189. set(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
  190. # Install the manifest that allows DLLs to be loaded from the
  191. # directory containing the executable.
  192. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  193. set(__install__libs ${__install__libs}
  194. "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest"
  195. "${MSVC80_MFC_DIR}/mfc80.dll"
  196. "${MSVC80_MFC_DIR}/mfc80u.dll"
  197. "${MSVC80_MFC_DIR}/mfcm80.dll"
  198. "${MSVC80_MFC_DIR}/mfcm80u.dll"
  199. )
  200. endif()
  201. # include the language dll's for vs8 as well as the actuall dll's
  202. set(MSVC80_MFCLOC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
  203. # Install the manifest that allows DLLs to be loaded from the
  204. # directory containing the executable.
  205. set(__install__libs ${__install__libs}
  206. "${MSVC80_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
  207. "${MSVC80_MFCLOC_DIR}/mfc80chs.dll"
  208. "${MSVC80_MFCLOC_DIR}/mfc80cht.dll"
  209. "${MSVC80_MFCLOC_DIR}/mfc80enu.dll"
  210. "${MSVC80_MFCLOC_DIR}/mfc80esp.dll"
  211. "${MSVC80_MFCLOC_DIR}/mfc80deu.dll"
  212. "${MSVC80_MFCLOC_DIR}/mfc80fra.dll"
  213. "${MSVC80_MFCLOC_DIR}/mfc80ita.dll"
  214. "${MSVC80_MFCLOC_DIR}/mfc80jpn.dll"
  215. "${MSVC80_MFCLOC_DIR}/mfc80kor.dll"
  216. )
  217. endif()
  218. if(MSVC90)
  219. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  220. set(MSVC90_MFC_DIR
  221. "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
  222. set(__install__libs ${__install__libs}
  223. "${MSVC90_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
  224. "${MSVC90_MFC_DIR}/mfc90d.dll"
  225. "${MSVC90_MFC_DIR}/mfc90ud.dll"
  226. "${MSVC90_MFC_DIR}/mfcm90d.dll"
  227. "${MSVC90_MFC_DIR}/mfcm90ud.dll"
  228. )
  229. endif()
  230. set(MSVC90_MFC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
  231. # Install the manifest that allows DLLs to be loaded from the
  232. # directory containing the executable.
  233. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  234. set(__install__libs ${__install__libs}
  235. "${MSVC90_MFC_DIR}/Microsoft.VC90.MFC.manifest"
  236. "${MSVC90_MFC_DIR}/mfc90.dll"
  237. "${MSVC90_MFC_DIR}/mfc90u.dll"
  238. "${MSVC90_MFC_DIR}/mfcm90.dll"
  239. "${MSVC90_MFC_DIR}/mfcm90u.dll"
  240. )
  241. endif()
  242. # include the language dll's for vs9 as well as the actuall dll's
  243. set(MSVC90_MFCLOC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
  244. # Install the manifest that allows DLLs to be loaded from the
  245. # directory containing the executable.
  246. set(__install__libs ${__install__libs}
  247. "${MSVC90_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
  248. "${MSVC90_MFCLOC_DIR}/mfc90chs.dll"
  249. "${MSVC90_MFCLOC_DIR}/mfc90cht.dll"
  250. "${MSVC90_MFCLOC_DIR}/mfc90enu.dll"
  251. "${MSVC90_MFCLOC_DIR}/mfc90esp.dll"
  252. "${MSVC90_MFCLOC_DIR}/mfc90deu.dll"
  253. "${MSVC90_MFCLOC_DIR}/mfc90fra.dll"
  254. "${MSVC90_MFCLOC_DIR}/mfc90ita.dll"
  255. "${MSVC90_MFCLOC_DIR}/mfc90jpn.dll"
  256. "${MSVC90_MFCLOC_DIR}/mfc90kor.dll"
  257. )
  258. endif()
  259. macro(MFC_FILES_FOR_VERSION version)
  260. set(v "${version}")
  261. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  262. set(MSVC${v}_MFC_DIR
  263. "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugMFC")
  264. set(__install__libs ${__install__libs}
  265. "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll"
  266. "${MSVC${v}_MFC_DIR}/mfc${v}0ud.dll"
  267. "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll"
  268. "${MSVC${v}_MFC_DIR}/mfcm${v}0ud.dll"
  269. )
  270. endif()
  271. set(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC")
  272. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  273. set(__install__libs ${__install__libs}
  274. "${MSVC${v}_MFC_DIR}/mfc${v}0.dll"
  275. "${MSVC${v}_MFC_DIR}/mfc${v}0u.dll"
  276. "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll"
  277. "${MSVC${v}_MFC_DIR}/mfcm${v}0u.dll"
  278. )
  279. endif()
  280. # include the language dll's as well as the actuall dll's
  281. set(MSVC${v}_MFCLOC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFCLOC")
  282. set(__install__libs ${__install__libs}
  283. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0chs.dll"
  284. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0cht.dll"
  285. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0enu.dll"
  286. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0esp.dll"
  287. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0deu.dll"
  288. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0fra.dll"
  289. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0ita.dll"
  290. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0jpn.dll"
  291. "${MSVC${v}_MFCLOC_DIR}/mfc${v}0kor.dll"
  292. )
  293. endmacro()
  294. if(MSVC10)
  295. MFC_FILES_FOR_VERSION(10)
  296. endif()
  297. if(MSVC11)
  298. MFC_FILES_FOR_VERSION(11)
  299. endif()
  300. endif()
  301. foreach(lib
  302. ${__install__libs}
  303. )
  304. if(EXISTS ${lib})
  305. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  306. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  307. else()
  308. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  309. message(WARNING "system runtime library file does not exist: '${lib}'")
  310. # This warning indicates an incomplete Visual Studio installation
  311. # or a bug somewhere above here in this file.
  312. # If you would like to avoid this warning, fix the real problem, or
  313. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  314. # this file.
  315. endif()
  316. endif()
  317. endforeach()
  318. endif()
  319. if(WATCOM)
  320. get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
  321. if(WATCOM17)
  322. set( __install__libs ${CompilerPath}/clbr17.dll
  323. ${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll )
  324. endif()
  325. if(WATCOM18)
  326. set( __install__libs ${CompilerPath}/clbr18.dll
  327. ${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll )
  328. endif()
  329. if(WATCOM19)
  330. set( __install__libs ${CompilerPath}/clbr19.dll
  331. ${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll )
  332. endif()
  333. foreach(lib
  334. ${__install__libs}
  335. )
  336. if(EXISTS ${lib})
  337. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  338. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  339. else()
  340. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  341. message(WARNING "system runtime library file does not exist: '${lib}'")
  342. # This warning indicates an incomplete Watcom installation
  343. # or a bug somewhere above here in this file.
  344. # If you would like to avoid this warning, fix the real problem, or
  345. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  346. # this file.
  347. endif()
  348. endif()
  349. endforeach()
  350. endif()
  351. # Include system runtime libraries in the installation if any are
  352. # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
  353. if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
  354. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
  355. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
  356. if(WIN32)
  357. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
  358. else()
  359. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
  360. endif()
  361. endif()
  362. install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
  363. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION})
  364. endif()
  365. endif()