InstallRequiredSystemLibraries.cmake 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #.rst:
  4. # InstallRequiredSystemLibraries
  5. # ------------------------------
  6. #
  7. # Include this module to search for compiler-provided system runtime
  8. # libraries and add install rules for them. Some optional variables
  9. # may be set prior to including the module to adjust behavior:
  10. #
  11. # ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS``
  12. # Specify additional runtime libraries that may not be detected.
  13. # After inclusion any detected libraries will be appended to this.
  14. #
  15. # ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP``
  16. # Set to TRUE to skip calling the :command:`install(PROGRAMS)` command to
  17. # allow the includer to specify its own install rule, using the value of
  18. # ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` to get the list of libraries.
  19. #
  20. # ``CMAKE_INSTALL_DEBUG_LIBRARIES``
  21. # Set to TRUE to install the debug runtime libraries when available
  22. # with MSVC tools.
  23. #
  24. # ``CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY``
  25. # Set to TRUE to install only the debug runtime libraries with MSVC
  26. # tools even if the release runtime libraries are also available.
  27. #
  28. # ``CMAKE_INSTALL_UCRT_LIBRARIES``
  29. # Set to TRUE to install the Windows Universal CRT libraries for
  30. # app-local deployment (e.g. to Windows XP). This is meaningful
  31. # only with MSVC from Visual Studio 2015 or higher.
  32. #
  33. # One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable*
  34. # to an absolute path to tell CMake to look for Windows 10 SDKs in
  35. # a custom location. The specified directory is expected to contain
  36. # ``Redist/ucrt/DLLs/*`` directories.
  37. #
  38. # ``CMAKE_INSTALL_MFC_LIBRARIES``
  39. # Set to TRUE to install the MSVC MFC runtime libraries.
  40. #
  41. # ``CMAKE_INSTALL_OPENMP_LIBRARIES``
  42. # Set to TRUE to install the MSVC OpenMP runtime libraries
  43. #
  44. # ``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION``
  45. # Specify the :command:`install(PROGRAMS)` command ``DESTINATION``
  46. # option. If not specified, the default is ``bin`` on Windows
  47. # and ``lib`` elsewhere.
  48. #
  49. # ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS``
  50. # Set to TRUE to disable warnings about required library files that
  51. # do not exist. (For example, Visual Studio Express editions may
  52. # not provide the redistributable files.)
  53. #
  54. # ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT``
  55. # Specify the :command:`install(PROGRAMS)` command ``COMPONENT``
  56. # option. If not specified, no such option will be used.
  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(MSVC_VERSION EQUAL 1300)
  73. set(__install__libs
  74. "${SYSTEMROOT}/system32/msvcp70.dll"
  75. "${SYSTEMROOT}/system32/msvcr70.dll"
  76. )
  77. endif()
  78. if(MSVC_VERSION EQUAL 1310)
  79. set(__install__libs
  80. "${SYSTEMROOT}/system32/msvcp71.dll"
  81. "${SYSTEMROOT}/system32/msvcr71.dll"
  82. )
  83. endif()
  84. if(MSVC_VERSION EQUAL 1400)
  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. if(DEFINED MSVC80_REDIST_DIR AND EXISTS "${MSVC80_REDIST_DIR}")
  89. set(MSVC_REDIST_DIR "${MSVC80_REDIST_DIR}") # use old cache entry
  90. endif()
  91. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
  92. PATHS
  93. "${msvc_install_dir}/../../VC/redist"
  94. "${base_dir}/VC/redist"
  95. )
  96. mark_as_advanced(MSVC_REDIST_DIR)
  97. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
  98. # Install the manifest that allows DLLs to be loaded from the
  99. # directory containing the executable.
  100. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  101. set(__install__libs
  102. "${MSVC_CRT_DIR}/Microsoft.VC80.CRT.manifest"
  103. "${MSVC_CRT_DIR}/msvcm80.dll"
  104. "${MSVC_CRT_DIR}/msvcp80.dll"
  105. "${MSVC_CRT_DIR}/msvcr80.dll"
  106. )
  107. else()
  108. set(__install__libs)
  109. endif()
  110. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  111. set(MSVC_CRT_DIR
  112. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT")
  113. set(__install__libs ${__install__libs}
  114. "${MSVC_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest"
  115. "${MSVC_CRT_DIR}/msvcm80d.dll"
  116. "${MSVC_CRT_DIR}/msvcp80d.dll"
  117. "${MSVC_CRT_DIR}/msvcr80d.dll"
  118. )
  119. endif()
  120. endif()
  121. if(MSVC_VERSION EQUAL 1500)
  122. # Find the runtime library redistribution directory.
  123. get_filename_component(msvc_install_dir
  124. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
  125. get_filename_component(msvc_express_install_dir
  126. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
  127. if(DEFINED MSVC90_REDIST_DIR AND EXISTS "${MSVC90_REDIST_DIR}")
  128. set(MSVC_REDIST_DIR "${MSVC90_REDIST_DIR}") # use old cache entry
  129. endif()
  130. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
  131. PATHS
  132. "${msvc_install_dir}/../../VC/redist"
  133. "${msvc_express_install_dir}/../../VC/redist"
  134. "${base_dir}/VC/redist"
  135. )
  136. mark_as_advanced(MSVC_REDIST_DIR)
  137. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
  138. # Install the manifest that allows DLLs to be loaded from the
  139. # directory containing the executable.
  140. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  141. set(__install__libs
  142. "${MSVC_CRT_DIR}/Microsoft.VC90.CRT.manifest"
  143. "${MSVC_CRT_DIR}/msvcm90.dll"
  144. "${MSVC_CRT_DIR}/msvcp90.dll"
  145. "${MSVC_CRT_DIR}/msvcr90.dll"
  146. )
  147. else()
  148. set(__install__libs)
  149. endif()
  150. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  151. set(MSVC_CRT_DIR
  152. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
  153. set(__install__libs ${__install__libs}
  154. "${MSVC_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest"
  155. "${MSVC_CRT_DIR}/msvcm90d.dll"
  156. "${MSVC_CRT_DIR}/msvcp90d.dll"
  157. "${MSVC_CRT_DIR}/msvcr90d.dll"
  158. )
  159. endif()
  160. endif()
  161. if(MSVC_VERSION EQUAL 1910)
  162. set(_MSVCRT_DLL_VERSION 140)
  163. set(_MSVCRT_IDE_VERSION 15)
  164. elseif(MSVC_VERSION EQUAL 1900)
  165. set(_MSVCRT_DLL_VERSION 140)
  166. set(_MSVCRT_IDE_VERSION 14)
  167. elseif(MSVC_VERSION EQUAL 1800)
  168. set(_MSVCRT_DLL_VERSION 120)
  169. set(_MSVCRT_IDE_VERSION 12)
  170. elseif(MSVC_VERSION EQUAL 1700)
  171. set(_MSVCRT_DLL_VERSION 110)
  172. set(_MSVCRT_IDE_VERSION 11)
  173. elseif(MSVC_VERSION EQUAL 1600)
  174. set(_MSVCRT_DLL_VERSION 100)
  175. set(_MSVCRT_IDE_VERSION 10)
  176. else()
  177. set(_MSVCRT_DLL_VERSION "")
  178. set(_MSVCRT_IDE_VERSION "")
  179. endif()
  180. if(_MSVCRT_DLL_VERSION)
  181. set(v "${_MSVCRT_DLL_VERSION}")
  182. set(vs "${_MSVCRT_IDE_VERSION}")
  183. # Find the runtime library redistribution directory.
  184. if(vs VERSION_LESS 15 AND DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
  185. set(MSVC_REDIST_DIR "${MSVC${vs}_REDIST_DIR}") # use old cache entry
  186. endif()
  187. if(NOT vs VERSION_LESS 15)
  188. set(_vs_redist_paths "")
  189. cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR) # undocumented query
  190. if(IS_DIRECTORY "${_vs_dir}")
  191. file(GLOB _vs_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
  192. endif()
  193. unset(_vs_dir)
  194. else()
  195. get_filename_component(_vs_dir
  196. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
  197. set(programfilesx86 "ProgramFiles(x86)")
  198. set(_vs_redist_paths
  199. "${_vs_dir}/../../VC/redist"
  200. "${base_dir}/VC/redist"
  201. "$ENV{ProgramFiles}/Microsoft Visual Studio ${vs}.0/VC/redist"
  202. "$ENV{${programfilesx86}}/Microsoft Visual Studio ${vs}.0/VC/redist"
  203. )
  204. unset(_vs_dir)
  205. unset(programfilesx86)
  206. endif()
  207. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.CRT PATHS ${_vs_redist_paths})
  208. unset(_vs_redist_paths)
  209. mark_as_advanced(MSVC_REDIST_DIR)
  210. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.CRT")
  211. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  212. set(__install__libs
  213. "${MSVC_CRT_DIR}/msvcp${v}.dll"
  214. )
  215. if(NOT vs VERSION_LESS 14)
  216. list(APPEND __install__libs
  217. "${MSVC_CRT_DIR}/vcruntime${v}.dll"
  218. "${MSVC_CRT_DIR}/concrt${v}.dll"
  219. )
  220. else()
  221. list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}.dll")
  222. endif()
  223. else()
  224. set(__install__libs)
  225. endif()
  226. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  227. set(MSVC_CRT_DIR
  228. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.DebugCRT")
  229. set(__install__libs ${__install__libs}
  230. "${MSVC_CRT_DIR}/msvcp${v}d.dll"
  231. )
  232. if(NOT vs VERSION_LESS 14)
  233. list(APPEND __install__libs
  234. "${MSVC_CRT_DIR}/vcruntime${v}d.dll"
  235. "${MSVC_CRT_DIR}/concrt${v}d.dll"
  236. )
  237. else()
  238. list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}d.dll")
  239. endif()
  240. endif()
  241. if(CMAKE_INSTALL_UCRT_LIBRARIES AND NOT vs VERSION_LESS 14)
  242. # Find the Windows Kits directory.
  243. get_filename_component(windows_kits_dir
  244. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
  245. set(programfilesx86 "ProgramFiles(x86)")
  246. find_path(WINDOWS_KITS_DIR NAMES Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
  247. PATHS
  248. $ENV{CMAKE_WINDOWS_KITS_10_DIR}
  249. "${windows_kits_dir}"
  250. "$ENV{ProgramFiles}/Windows Kits/10"
  251. "$ENV{${programfilesx86}}/Windows Kits/10"
  252. )
  253. mark_as_advanced(WINDOWS_KITS_DIR)
  254. # Glob the list of UCRT DLLs.
  255. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  256. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
  257. list(APPEND __install__libs ${__ucrt_dlls})
  258. endif()
  259. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  260. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll")
  261. list(APPEND __install__libs ${__ucrt_dlls})
  262. endif()
  263. endif()
  264. endif()
  265. if(CMAKE_INSTALL_MFC_LIBRARIES)
  266. if(MSVC_VERSION EQUAL 1300)
  267. set(__install__libs ${__install__libs}
  268. "${SYSTEMROOT}/system32/mfc70.dll"
  269. )
  270. endif()
  271. if(MSVC_VERSION EQUAL 1310)
  272. set(__install__libs ${__install__libs}
  273. "${SYSTEMROOT}/system32/mfc71.dll"
  274. )
  275. endif()
  276. if(MSVC_VERSION EQUAL 1400)
  277. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  278. set(MSVC_MFC_DIR
  279. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
  280. set(__install__libs ${__install__libs}
  281. "${MSVC_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
  282. "${MSVC_MFC_DIR}/mfc80d.dll"
  283. "${MSVC_MFC_DIR}/mfc80ud.dll"
  284. "${MSVC_MFC_DIR}/mfcm80d.dll"
  285. "${MSVC_MFC_DIR}/mfcm80ud.dll"
  286. )
  287. endif()
  288. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
  289. # Install the manifest that allows DLLs to be loaded from the
  290. # directory containing the executable.
  291. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  292. set(__install__libs ${__install__libs}
  293. "${MSVC_MFC_DIR}/Microsoft.VC80.MFC.manifest"
  294. "${MSVC_MFC_DIR}/mfc80.dll"
  295. "${MSVC_MFC_DIR}/mfc80u.dll"
  296. "${MSVC_MFC_DIR}/mfcm80.dll"
  297. "${MSVC_MFC_DIR}/mfcm80u.dll"
  298. )
  299. endif()
  300. # include the language dll's for vs8 as well as the actuall dll's
  301. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
  302. # Install the manifest that allows DLLs to be loaded from the
  303. # directory containing the executable.
  304. set(__install__libs ${__install__libs}
  305. "${MSVC_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
  306. "${MSVC_MFCLOC_DIR}/mfc80chs.dll"
  307. "${MSVC_MFCLOC_DIR}/mfc80cht.dll"
  308. "${MSVC_MFCLOC_DIR}/mfc80enu.dll"
  309. "${MSVC_MFCLOC_DIR}/mfc80esp.dll"
  310. "${MSVC_MFCLOC_DIR}/mfc80deu.dll"
  311. "${MSVC_MFCLOC_DIR}/mfc80fra.dll"
  312. "${MSVC_MFCLOC_DIR}/mfc80ita.dll"
  313. "${MSVC_MFCLOC_DIR}/mfc80jpn.dll"
  314. "${MSVC_MFCLOC_DIR}/mfc80kor.dll"
  315. )
  316. endif()
  317. if(MSVC_VERSION EQUAL 1500)
  318. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  319. set(MSVC_MFC_DIR
  320. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
  321. set(__install__libs ${__install__libs}
  322. "${MSVC_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
  323. "${MSVC_MFC_DIR}/mfc90d.dll"
  324. "${MSVC_MFC_DIR}/mfc90ud.dll"
  325. "${MSVC_MFC_DIR}/mfcm90d.dll"
  326. "${MSVC_MFC_DIR}/mfcm90ud.dll"
  327. )
  328. endif()
  329. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
  330. # Install the manifest that allows DLLs to be loaded from the
  331. # directory containing the executable.
  332. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  333. set(__install__libs ${__install__libs}
  334. "${MSVC_MFC_DIR}/Microsoft.VC90.MFC.manifest"
  335. "${MSVC_MFC_DIR}/mfc90.dll"
  336. "${MSVC_MFC_DIR}/mfc90u.dll"
  337. "${MSVC_MFC_DIR}/mfcm90.dll"
  338. "${MSVC_MFC_DIR}/mfcm90u.dll"
  339. )
  340. endif()
  341. # include the language dll's for vs9 as well as the actuall dll's
  342. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
  343. # Install the manifest that allows DLLs to be loaded from the
  344. # directory containing the executable.
  345. set(__install__libs ${__install__libs}
  346. "${MSVC_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
  347. "${MSVC_MFCLOC_DIR}/mfc90chs.dll"
  348. "${MSVC_MFCLOC_DIR}/mfc90cht.dll"
  349. "${MSVC_MFCLOC_DIR}/mfc90enu.dll"
  350. "${MSVC_MFCLOC_DIR}/mfc90esp.dll"
  351. "${MSVC_MFCLOC_DIR}/mfc90deu.dll"
  352. "${MSVC_MFCLOC_DIR}/mfc90fra.dll"
  353. "${MSVC_MFCLOC_DIR}/mfc90ita.dll"
  354. "${MSVC_MFCLOC_DIR}/mfc90jpn.dll"
  355. "${MSVC_MFCLOC_DIR}/mfc90kor.dll"
  356. )
  357. endif()
  358. if(MSVC_VERSION EQUAL 1910)
  359. set(_MFC_DLL_VERSION 140)
  360. set(_MFC_IDE_VERSION 15)
  361. elseif(MSVC_VERSION EQUAL 1900)
  362. set(_MFC_DLL_VERSION 140)
  363. set(_MFC_IDE_VERSION 14)
  364. elseif(MSVC_VERSION EQUAL 1800)
  365. set(_MFC_DLL_VERSION 120)
  366. set(_MFC_IDE_VERSION 12)
  367. elseif(MSVC_VERSION EQUAL 1700)
  368. set(_MFC_DLL_VERSION 110)
  369. set(_MFC_IDE_VERSION 11)
  370. elseif(MSVC_VERSION EQUAL 1600)
  371. set(_MFC_DLL_VERSION 100)
  372. set(_MFC_IDE_VERSION 10)
  373. else()
  374. set(_MFC_DLL_VERSION "")
  375. set(_MFC_IDE_VERSION "")
  376. endif()
  377. if(_MFC_DLL_VERSION)
  378. set(v "${_MFC_DLL_VERSION}")
  379. set(vs "${_MFC_IDE_VERSION}")
  380. # Starting with VS 15 the MFC DLLs may be in a different directory.
  381. if (NOT vs VERSION_LESS 15)
  382. file(GLOB _MSVC_REDIST_DIRS "${MSVC_REDIST_DIR}/../*")
  383. find_path(MSVC_REDIST_MFC_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.MFC
  384. PATHS ${_MSVC_REDIST_DIRS} NO_DEFAULT_PATH)
  385. mark_as_advanced(MSVC_REDIST_MFC_DIR)
  386. unset(_MSVC_REDIST_DIRS)
  387. else()
  388. set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
  389. endif()
  390. # Multi-Byte Character Set versions of MFC are available as optional
  391. # addon since Visual Studio 12. So for version 12 or higher, check
  392. # whether they are available and exclude them if they are not.
  393. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  394. set(MSVC_MFC_DIR
  395. "${MSVC_REDIST_MFC_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.DebugMFC")
  396. set(__install__libs ${__install__libs}
  397. "${MSVC_MFC_DIR}/mfc${v}ud.dll"
  398. "${MSVC_MFC_DIR}/mfcm${v}ud.dll"
  399. )
  400. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}d.dll")
  401. set(__install__libs ${__install__libs}
  402. "${MSVC_MFC_DIR}/mfc${v}d.dll"
  403. "${MSVC_MFC_DIR}/mfcm${v}d.dll"
  404. )
  405. endif()
  406. endif()
  407. set(MSVC_MFC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.MFC")
  408. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  409. set(__install__libs ${__install__libs}
  410. "${MSVC_MFC_DIR}/mfc${v}u.dll"
  411. "${MSVC_MFC_DIR}/mfcm${v}u.dll"
  412. )
  413. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}.dll")
  414. set(__install__libs ${__install__libs}
  415. "${MSVC_MFC_DIR}/mfc${v}.dll"
  416. "${MSVC_MFC_DIR}/mfcm${v}.dll"
  417. )
  418. endif()
  419. endif()
  420. # include the language dll's as well as the actuall dll's
  421. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.MFCLOC")
  422. set(__install__libs ${__install__libs}
  423. "${MSVC_MFCLOC_DIR}/mfc${v}chs.dll"
  424. "${MSVC_MFCLOC_DIR}/mfc${v}cht.dll"
  425. "${MSVC_MFCLOC_DIR}/mfc${v}deu.dll"
  426. "${MSVC_MFCLOC_DIR}/mfc${v}enu.dll"
  427. "${MSVC_MFCLOC_DIR}/mfc${v}esn.dll"
  428. "${MSVC_MFCLOC_DIR}/mfc${v}fra.dll"
  429. "${MSVC_MFCLOC_DIR}/mfc${v}ita.dll"
  430. "${MSVC_MFCLOC_DIR}/mfc${v}jpn.dll"
  431. "${MSVC_MFCLOC_DIR}/mfc${v}kor.dll"
  432. "${MSVC_MFCLOC_DIR}/mfc${v}rus.dll"
  433. )
  434. endif()
  435. endif()
  436. # MSVC 8 was the first version with OpenMP
  437. # Furthermore, there is no debug version of this
  438. if(CMAKE_INSTALL_OPENMP_LIBRARIES)
  439. if(MSVC_VERSION EQUAL 1910)
  440. set(_MSOMP_DLL_VERSION 140)
  441. set(_MSOMP_IDE_VERSION 15)
  442. elseif(MSVC_VERSION EQUAL 1900)
  443. set(_MSOMP_DLL_VERSION 140)
  444. set(_MSOMP_IDE_VERSION 14)
  445. elseif(MSVC_VERSION EQUAL 1800)
  446. set(_MSOMP_DLL_VERSION 120)
  447. set(_MSOMP_IDE_VERSION 12)
  448. elseif(MSVC_VERSION EQUAL 1700)
  449. set(_MSOMP_DLL_VERSION 110)
  450. set(_MSOMP_IDE_VERSION 11)
  451. elseif(MSVC_VERSION EQUAL 1600)
  452. set(_MSOMP_DLL_VERSION 100)
  453. set(_MSOMP_IDE_VERSION 10)
  454. elseif(MSVC_VERSION EQUAL 1500)
  455. set(_MSOMP_DLL_VERSION 90)
  456. set(_MSOMP_IDE_VERSION 9)
  457. elseif(MSVC_VERSION EQUAL 1400)
  458. set(_MSOMP_DLL_VERSION 80)
  459. set(_MSOMP_IDE_VERSION 8)
  460. else()
  461. set(_MSOMP_DLL_VERSION "")
  462. set(_MSOMP_IDE_VERSION "")
  463. endif()
  464. if(_MSOMP_DLL_VERSION)
  465. set(v "${_MSOMP_DLL_VERSION}")
  466. set(vs "${_MSOMP_IDE_VERSION}")
  467. set(MSVC_OPENMP_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.OPENMP")
  468. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  469. set(__install__libs ${__install__libs}
  470. "${MSVC_OPENMP_DIR}/vcomp${v}.dll")
  471. endif()
  472. endif()
  473. endif()
  474. foreach(lib
  475. ${__install__libs}
  476. )
  477. if(EXISTS ${lib})
  478. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  479. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  480. else()
  481. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  482. message(WARNING "system runtime library file does not exist: '${lib}'")
  483. # This warning indicates an incomplete Visual Studio installation
  484. # or a bug somewhere above here in this file.
  485. # If you would like to avoid this warning, fix the real problem, or
  486. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  487. # this file.
  488. endif()
  489. endif()
  490. endforeach()
  491. endif()
  492. if(WATCOM)
  493. get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
  494. if(CMAKE_C_COMPILER_VERSION)
  495. set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
  496. else()
  497. set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
  498. endif()
  499. string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
  500. list(GET _watcom_version_list 0 _watcom_major)
  501. list(GET _watcom_version_list 1 _watcom_minor)
  502. set( __install__libs
  503. ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
  504. ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
  505. ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
  506. foreach(lib
  507. ${__install__libs}
  508. )
  509. if(EXISTS ${lib})
  510. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  511. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  512. else()
  513. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  514. message(WARNING "system runtime library file does not exist: '${lib}'")
  515. # This warning indicates an incomplete Watcom installation
  516. # or a bug somewhere above here in this file.
  517. # If you would like to avoid this warning, fix the real problem, or
  518. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  519. # this file.
  520. endif()
  521. endif()
  522. endforeach()
  523. endif()
  524. # Include system runtime libraries in the installation if any are
  525. # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
  526. if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
  527. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
  528. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
  529. if(WIN32)
  530. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
  531. else()
  532. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
  533. endif()
  534. endif()
  535. if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
  536. set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT
  537. COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
  538. endif()
  539. install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
  540. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  541. ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
  542. )
  543. endif()
  544. endif()