InstallRequiredSystemLibraries.cmake 17 KB

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