InstallRequiredSystemLibraries.cmake 17 KB

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