InstallRequiredSystemLibraries.cmake 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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. set(_IRSL_HAVE_MSVC FALSE)
  58. foreach(LANG IN ITEMS C CXX)
  59. if(CMAKE_${LANG}_COMPILER_ID STREQUAL MSVC)
  60. set(_IRSL_HAVE_MSVC TRUE)
  61. endif()
  62. endforeach()
  63. if(MSVC)
  64. file(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
  65. if(CMAKE_CL_64)
  66. if(MSVC_VERSION GREATER 1599)
  67. # VS 10 and later:
  68. set(CMAKE_MSVC_ARCH x64)
  69. else()
  70. # VS 9 and earlier:
  71. set(CMAKE_MSVC_ARCH amd64)
  72. endif()
  73. else()
  74. set(CMAKE_MSVC_ARCH x86)
  75. endif()
  76. get_filename_component(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
  77. get_filename_component(base_dir "${devenv_dir}/../.." ABSOLUTE)
  78. if(MSVC_VERSION EQUAL 1300)
  79. set(__install__libs
  80. "${SYSTEMROOT}/system32/msvcp70.dll"
  81. "${SYSTEMROOT}/system32/msvcr70.dll"
  82. )
  83. endif()
  84. if(MSVC_VERSION EQUAL 1310)
  85. set(__install__libs
  86. "${SYSTEMROOT}/system32/msvcp71.dll"
  87. "${SYSTEMROOT}/system32/msvcr71.dll"
  88. )
  89. endif()
  90. if(MSVC_VERSION EQUAL 1400)
  91. set(MSVC_REDIST_NAME VC80)
  92. # Find the runtime library redistribution directory.
  93. get_filename_component(msvc_install_dir
  94. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
  95. if(DEFINED MSVC80_REDIST_DIR AND EXISTS "${MSVC80_REDIST_DIR}")
  96. set(MSVC_REDIST_DIR "${MSVC80_REDIST_DIR}") # use old cache entry
  97. endif()
  98. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
  99. PATHS
  100. "${msvc_install_dir}/../../VC/redist"
  101. "${base_dir}/VC/redist"
  102. )
  103. mark_as_advanced(MSVC_REDIST_DIR)
  104. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
  105. # Install the manifest that allows DLLs to be loaded from the
  106. # directory containing the executable.
  107. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  108. set(__install__libs
  109. "${MSVC_CRT_DIR}/Microsoft.VC80.CRT.manifest"
  110. "${MSVC_CRT_DIR}/msvcm80.dll"
  111. "${MSVC_CRT_DIR}/msvcp80.dll"
  112. "${MSVC_CRT_DIR}/msvcr80.dll"
  113. )
  114. else()
  115. set(__install__libs)
  116. endif()
  117. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  118. set(MSVC_CRT_DIR
  119. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT")
  120. set(__install__libs ${__install__libs}
  121. "${MSVC_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest"
  122. "${MSVC_CRT_DIR}/msvcm80d.dll"
  123. "${MSVC_CRT_DIR}/msvcp80d.dll"
  124. "${MSVC_CRT_DIR}/msvcr80d.dll"
  125. )
  126. endif()
  127. endif()
  128. if(MSVC_VERSION EQUAL 1500)
  129. set(MSVC_REDIST_NAME VC90)
  130. # Find the runtime library redistribution directory.
  131. get_filename_component(msvc_install_dir
  132. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
  133. get_filename_component(msvc_express_install_dir
  134. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
  135. if(DEFINED MSVC90_REDIST_DIR AND EXISTS "${MSVC90_REDIST_DIR}")
  136. set(MSVC_REDIST_DIR "${MSVC90_REDIST_DIR}") # use old cache entry
  137. endif()
  138. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
  139. PATHS
  140. "${msvc_install_dir}/../../VC/redist"
  141. "${msvc_express_install_dir}/../../VC/redist"
  142. "${base_dir}/VC/redist"
  143. )
  144. mark_as_advanced(MSVC_REDIST_DIR)
  145. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
  146. # Install the manifest that allows DLLs to be loaded from the
  147. # directory containing the executable.
  148. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  149. set(__install__libs
  150. "${MSVC_CRT_DIR}/Microsoft.VC90.CRT.manifest"
  151. "${MSVC_CRT_DIR}/msvcm90.dll"
  152. "${MSVC_CRT_DIR}/msvcp90.dll"
  153. "${MSVC_CRT_DIR}/msvcr90.dll"
  154. )
  155. else()
  156. set(__install__libs)
  157. endif()
  158. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  159. set(MSVC_CRT_DIR
  160. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
  161. set(__install__libs ${__install__libs}
  162. "${MSVC_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest"
  163. "${MSVC_CRT_DIR}/msvcm90d.dll"
  164. "${MSVC_CRT_DIR}/msvcp90d.dll"
  165. "${MSVC_CRT_DIR}/msvcr90d.dll"
  166. )
  167. endif()
  168. endif()
  169. if(MSVC_VERSION EQUAL 1911)
  170. set(MSVC_REDIST_NAME VC141)
  171. set(_MSVCRT_DLL_VERSION 140)
  172. set(_MSVCRT_IDE_VERSION 15)
  173. elseif(MSVC_VERSION EQUAL 1910)
  174. set(MSVC_REDIST_NAME VC150)
  175. set(_MSVCRT_DLL_VERSION 140)
  176. set(_MSVCRT_IDE_VERSION 15)
  177. elseif(MSVC_VERSION EQUAL 1900)
  178. set(MSVC_REDIST_NAME VC140)
  179. set(_MSVCRT_DLL_VERSION 140)
  180. set(_MSVCRT_IDE_VERSION 14)
  181. elseif(MSVC_VERSION EQUAL 1800)
  182. set(MSVC_REDIST_NAME VC120)
  183. set(_MSVCRT_DLL_VERSION 120)
  184. set(_MSVCRT_IDE_VERSION 12)
  185. elseif(MSVC_VERSION EQUAL 1700)
  186. set(MSVC_REDIST_NAME VC110)
  187. set(_MSVCRT_DLL_VERSION 110)
  188. set(_MSVCRT_IDE_VERSION 11)
  189. elseif(MSVC_VERSION EQUAL 1600)
  190. set(MSVC_REDIST_NAME VC100)
  191. set(_MSVCRT_DLL_VERSION 100)
  192. set(_MSVCRT_IDE_VERSION 10)
  193. else()
  194. set(MSVC_REDIST_NAME "")
  195. set(_MSVCRT_DLL_VERSION "")
  196. set(_MSVCRT_IDE_VERSION "")
  197. endif()
  198. if(_MSVCRT_DLL_VERSION)
  199. set(v "${_MSVCRT_DLL_VERSION}")
  200. set(vs "${_MSVCRT_IDE_VERSION}")
  201. # Find the runtime library redistribution directory.
  202. if(vs VERSION_LESS 15 AND DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
  203. set(MSVC_REDIST_DIR "${MSVC${vs}_REDIST_DIR}") # use old cache entry
  204. endif()
  205. if(NOT vs VERSION_LESS 15)
  206. set(_vs_redist_paths "")
  207. cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR) # undocumented query
  208. if(IS_DIRECTORY "${_vs_dir}")
  209. file(GLOB _vs_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
  210. endif()
  211. unset(_vs_dir)
  212. else()
  213. get_filename_component(_vs_dir
  214. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
  215. set(programfilesx86 "ProgramFiles(x86)")
  216. set(_vs_redist_paths
  217. "${_vs_dir}/../../VC/redist"
  218. "${base_dir}/VC/redist"
  219. "$ENV{ProgramFiles}/Microsoft Visual Studio ${vs}.0/VC/redist"
  220. "$ENV{${programfilesx86}}/Microsoft Visual Studio ${vs}.0/VC/redist"
  221. )
  222. unset(_vs_dir)
  223. unset(programfilesx86)
  224. endif()
  225. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.CRT PATHS ${_vs_redist_paths})
  226. unset(_vs_redist_paths)
  227. mark_as_advanced(MSVC_REDIST_DIR)
  228. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.CRT")
  229. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  230. set(__install__libs
  231. "${MSVC_CRT_DIR}/msvcp${v}.dll"
  232. )
  233. if(NOT vs VERSION_LESS 14)
  234. list(APPEND __install__libs
  235. "${MSVC_CRT_DIR}/vcruntime${v}.dll"
  236. "${MSVC_CRT_DIR}/concrt${v}.dll"
  237. )
  238. else()
  239. list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}.dll")
  240. endif()
  241. else()
  242. set(__install__libs)
  243. endif()
  244. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  245. set(MSVC_CRT_DIR
  246. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugCRT")
  247. set(__install__libs ${__install__libs}
  248. "${MSVC_CRT_DIR}/msvcp${v}d.dll"
  249. )
  250. if(NOT vs VERSION_LESS 14)
  251. list(APPEND __install__libs
  252. "${MSVC_CRT_DIR}/vcruntime${v}d.dll"
  253. "${MSVC_CRT_DIR}/concrt${v}d.dll"
  254. )
  255. else()
  256. list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}d.dll")
  257. endif()
  258. endif()
  259. if(CMAKE_INSTALL_UCRT_LIBRARIES AND NOT vs VERSION_LESS 14)
  260. # Find the Windows Kits directory.
  261. get_filename_component(windows_kits_dir
  262. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
  263. set(programfilesx86 "ProgramFiles(x86)")
  264. find_path(WINDOWS_KITS_DIR NAMES Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
  265. PATHS
  266. $ENV{CMAKE_WINDOWS_KITS_10_DIR}
  267. "${windows_kits_dir}"
  268. "$ENV{ProgramFiles}/Windows Kits/10"
  269. "$ENV{${programfilesx86}}/Windows Kits/10"
  270. )
  271. mark_as_advanced(WINDOWS_KITS_DIR)
  272. # Glob the list of UCRT DLLs.
  273. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  274. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
  275. list(APPEND __install__libs ${__ucrt_dlls})
  276. endif()
  277. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  278. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll")
  279. list(APPEND __install__libs ${__ucrt_dlls})
  280. endif()
  281. endif()
  282. endif()
  283. if(CMAKE_INSTALL_MFC_LIBRARIES)
  284. if(MSVC_VERSION EQUAL 1300)
  285. set(__install__libs ${__install__libs}
  286. "${SYSTEMROOT}/system32/mfc70.dll"
  287. )
  288. endif()
  289. if(MSVC_VERSION EQUAL 1310)
  290. set(__install__libs ${__install__libs}
  291. "${SYSTEMROOT}/system32/mfc71.dll"
  292. )
  293. endif()
  294. if(MSVC_VERSION EQUAL 1400)
  295. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  296. set(MSVC_MFC_DIR
  297. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
  298. set(__install__libs ${__install__libs}
  299. "${MSVC_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
  300. "${MSVC_MFC_DIR}/mfc80d.dll"
  301. "${MSVC_MFC_DIR}/mfc80ud.dll"
  302. "${MSVC_MFC_DIR}/mfcm80d.dll"
  303. "${MSVC_MFC_DIR}/mfcm80ud.dll"
  304. )
  305. endif()
  306. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
  307. # Install the manifest that allows DLLs to be loaded from the
  308. # directory containing the executable.
  309. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  310. set(__install__libs ${__install__libs}
  311. "${MSVC_MFC_DIR}/Microsoft.VC80.MFC.manifest"
  312. "${MSVC_MFC_DIR}/mfc80.dll"
  313. "${MSVC_MFC_DIR}/mfc80u.dll"
  314. "${MSVC_MFC_DIR}/mfcm80.dll"
  315. "${MSVC_MFC_DIR}/mfcm80u.dll"
  316. )
  317. endif()
  318. # include the language dll's for vs8 as well as the actuall dll's
  319. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
  320. # Install the manifest that allows DLLs to be loaded from the
  321. # directory containing the executable.
  322. set(__install__libs ${__install__libs}
  323. "${MSVC_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
  324. "${MSVC_MFCLOC_DIR}/mfc80chs.dll"
  325. "${MSVC_MFCLOC_DIR}/mfc80cht.dll"
  326. "${MSVC_MFCLOC_DIR}/mfc80enu.dll"
  327. "${MSVC_MFCLOC_DIR}/mfc80esp.dll"
  328. "${MSVC_MFCLOC_DIR}/mfc80deu.dll"
  329. "${MSVC_MFCLOC_DIR}/mfc80fra.dll"
  330. "${MSVC_MFCLOC_DIR}/mfc80ita.dll"
  331. "${MSVC_MFCLOC_DIR}/mfc80jpn.dll"
  332. "${MSVC_MFCLOC_DIR}/mfc80kor.dll"
  333. )
  334. endif()
  335. if(MSVC_VERSION EQUAL 1500)
  336. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  337. set(MSVC_MFC_DIR
  338. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
  339. set(__install__libs ${__install__libs}
  340. "${MSVC_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
  341. "${MSVC_MFC_DIR}/mfc90d.dll"
  342. "${MSVC_MFC_DIR}/mfc90ud.dll"
  343. "${MSVC_MFC_DIR}/mfcm90d.dll"
  344. "${MSVC_MFC_DIR}/mfcm90ud.dll"
  345. )
  346. endif()
  347. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
  348. # Install the manifest that allows DLLs to be loaded from the
  349. # directory containing the executable.
  350. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  351. set(__install__libs ${__install__libs}
  352. "${MSVC_MFC_DIR}/Microsoft.VC90.MFC.manifest"
  353. "${MSVC_MFC_DIR}/mfc90.dll"
  354. "${MSVC_MFC_DIR}/mfc90u.dll"
  355. "${MSVC_MFC_DIR}/mfcm90.dll"
  356. "${MSVC_MFC_DIR}/mfcm90u.dll"
  357. )
  358. endif()
  359. # include the language dll's for vs9 as well as the actuall dll's
  360. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
  361. # Install the manifest that allows DLLs to be loaded from the
  362. # directory containing the executable.
  363. set(__install__libs ${__install__libs}
  364. "${MSVC_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
  365. "${MSVC_MFCLOC_DIR}/mfc90chs.dll"
  366. "${MSVC_MFCLOC_DIR}/mfc90cht.dll"
  367. "${MSVC_MFCLOC_DIR}/mfc90enu.dll"
  368. "${MSVC_MFCLOC_DIR}/mfc90esp.dll"
  369. "${MSVC_MFCLOC_DIR}/mfc90deu.dll"
  370. "${MSVC_MFCLOC_DIR}/mfc90fra.dll"
  371. "${MSVC_MFCLOC_DIR}/mfc90ita.dll"
  372. "${MSVC_MFCLOC_DIR}/mfc90jpn.dll"
  373. "${MSVC_MFCLOC_DIR}/mfc90kor.dll"
  374. )
  375. endif()
  376. if(MSVC_VERSION EQUAL 1911)
  377. set(_MFC_DLL_VERSION 140)
  378. set(_MFC_IDE_VERSION 15)
  379. elseif(MSVC_VERSION EQUAL 1910)
  380. set(_MFC_DLL_VERSION 140)
  381. set(_MFC_IDE_VERSION 15)
  382. elseif(MSVC_VERSION EQUAL 1900)
  383. set(_MFC_DLL_VERSION 140)
  384. set(_MFC_IDE_VERSION 14)
  385. elseif(MSVC_VERSION EQUAL 1800)
  386. set(_MFC_DLL_VERSION 120)
  387. set(_MFC_IDE_VERSION 12)
  388. elseif(MSVC_VERSION EQUAL 1700)
  389. set(_MFC_DLL_VERSION 110)
  390. set(_MFC_IDE_VERSION 11)
  391. elseif(MSVC_VERSION EQUAL 1600)
  392. set(_MFC_DLL_VERSION 100)
  393. set(_MFC_IDE_VERSION 10)
  394. else()
  395. set(_MFC_DLL_VERSION "")
  396. set(_MFC_IDE_VERSION "")
  397. endif()
  398. if(_MFC_DLL_VERSION)
  399. set(v "${_MFC_DLL_VERSION}")
  400. set(vs "${_MFC_IDE_VERSION}")
  401. # Starting with VS 15 the MFC DLLs may be in a different directory.
  402. if (NOT vs VERSION_LESS 15)
  403. file(GLOB _MSVC_REDIST_DIRS "${MSVC_REDIST_DIR}/../*")
  404. find_path(MSVC_REDIST_MFC_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC
  405. PATHS ${_MSVC_REDIST_DIRS} NO_DEFAULT_PATH)
  406. mark_as_advanced(MSVC_REDIST_MFC_DIR)
  407. unset(_MSVC_REDIST_DIRS)
  408. else()
  409. set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
  410. endif()
  411. # Multi-Byte Character Set versions of MFC are available as optional
  412. # addon since Visual Studio 12. So for version 12 or higher, check
  413. # whether they are available and exclude them if they are not.
  414. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  415. set(MSVC_MFC_DIR
  416. "${MSVC_REDIST_MFC_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugMFC")
  417. set(__install__libs ${__install__libs}
  418. "${MSVC_MFC_DIR}/mfc${v}ud.dll"
  419. "${MSVC_MFC_DIR}/mfcm${v}ud.dll"
  420. )
  421. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}d.dll")
  422. set(__install__libs ${__install__libs}
  423. "${MSVC_MFC_DIR}/mfc${v}d.dll"
  424. "${MSVC_MFC_DIR}/mfcm${v}d.dll"
  425. )
  426. endif()
  427. endif()
  428. set(MSVC_MFC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC")
  429. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  430. set(__install__libs ${__install__libs}
  431. "${MSVC_MFC_DIR}/mfc${v}u.dll"
  432. "${MSVC_MFC_DIR}/mfcm${v}u.dll"
  433. )
  434. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}.dll")
  435. set(__install__libs ${__install__libs}
  436. "${MSVC_MFC_DIR}/mfc${v}.dll"
  437. "${MSVC_MFC_DIR}/mfcm${v}.dll"
  438. )
  439. endif()
  440. endif()
  441. # include the language dll's as well as the actuall dll's
  442. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFCLOC")
  443. set(__install__libs ${__install__libs}
  444. "${MSVC_MFCLOC_DIR}/mfc${v}chs.dll"
  445. "${MSVC_MFCLOC_DIR}/mfc${v}cht.dll"
  446. "${MSVC_MFCLOC_DIR}/mfc${v}deu.dll"
  447. "${MSVC_MFCLOC_DIR}/mfc${v}enu.dll"
  448. "${MSVC_MFCLOC_DIR}/mfc${v}esn.dll"
  449. "${MSVC_MFCLOC_DIR}/mfc${v}fra.dll"
  450. "${MSVC_MFCLOC_DIR}/mfc${v}ita.dll"
  451. "${MSVC_MFCLOC_DIR}/mfc${v}jpn.dll"
  452. "${MSVC_MFCLOC_DIR}/mfc${v}kor.dll"
  453. "${MSVC_MFCLOC_DIR}/mfc${v}rus.dll"
  454. )
  455. endif()
  456. endif()
  457. # MSVC 8 was the first version with OpenMP
  458. # Furthermore, there is no debug version of this
  459. if(CMAKE_INSTALL_OPENMP_LIBRARIES AND _IRSL_HAVE_MSVC)
  460. if(MSVC_VERSION EQUAL 1911)
  461. set(_MSOMP_DLL_VERSION 140)
  462. set(_MSOMP_IDE_VERSION 15)
  463. elseif(MSVC_VERSION EQUAL 1910)
  464. set(_MSOMP_DLL_VERSION 140)
  465. set(_MSOMP_IDE_VERSION 15)
  466. elseif(MSVC_VERSION EQUAL 1900)
  467. set(_MSOMP_DLL_VERSION 140)
  468. set(_MSOMP_IDE_VERSION 14)
  469. elseif(MSVC_VERSION EQUAL 1800)
  470. set(_MSOMP_DLL_VERSION 120)
  471. set(_MSOMP_IDE_VERSION 12)
  472. elseif(MSVC_VERSION EQUAL 1700)
  473. set(_MSOMP_DLL_VERSION 110)
  474. set(_MSOMP_IDE_VERSION 11)
  475. elseif(MSVC_VERSION EQUAL 1600)
  476. set(_MSOMP_DLL_VERSION 100)
  477. set(_MSOMP_IDE_VERSION 10)
  478. elseif(MSVC_VERSION EQUAL 1500)
  479. set(_MSOMP_DLL_VERSION 90)
  480. set(_MSOMP_IDE_VERSION 9)
  481. elseif(MSVC_VERSION EQUAL 1400)
  482. set(_MSOMP_DLL_VERSION 80)
  483. set(_MSOMP_IDE_VERSION 8)
  484. else()
  485. set(_MSOMP_DLL_VERSION "")
  486. set(_MSOMP_IDE_VERSION "")
  487. endif()
  488. if(_MSOMP_DLL_VERSION)
  489. set(v "${_MSOMP_DLL_VERSION}")
  490. set(vs "${_MSOMP_IDE_VERSION}")
  491. set(MSVC_OPENMP_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.OPENMP")
  492. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  493. set(__install__libs ${__install__libs}
  494. "${MSVC_OPENMP_DIR}/vcomp${v}.dll")
  495. endif()
  496. endif()
  497. endif()
  498. foreach(lib
  499. ${__install__libs}
  500. )
  501. if(EXISTS ${lib})
  502. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  503. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  504. else()
  505. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  506. message(WARNING "system runtime library file does not exist: '${lib}'")
  507. # This warning indicates an incomplete Visual Studio installation
  508. # or a bug somewhere above here in this file.
  509. # If you would like to avoid this warning, fix the real problem, or
  510. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  511. # this file.
  512. endif()
  513. endif()
  514. endforeach()
  515. endif()
  516. if(WATCOM)
  517. get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
  518. if(CMAKE_C_COMPILER_VERSION)
  519. set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
  520. else()
  521. set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
  522. endif()
  523. string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
  524. list(GET _watcom_version_list 0 _watcom_major)
  525. list(GET _watcom_version_list 1 _watcom_minor)
  526. set( __install__libs
  527. ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
  528. ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
  529. ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
  530. foreach(lib
  531. ${__install__libs}
  532. )
  533. if(EXISTS ${lib})
  534. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  535. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  536. else()
  537. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  538. message(WARNING "system runtime library file does not exist: '${lib}'")
  539. # This warning indicates an incomplete Watcom installation
  540. # or a bug somewhere above here in this file.
  541. # If you would like to avoid this warning, fix the real problem, or
  542. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  543. # this file.
  544. endif()
  545. endif()
  546. endforeach()
  547. endif()
  548. # Include system runtime libraries in the installation if any are
  549. # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
  550. if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
  551. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
  552. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
  553. if(WIN32)
  554. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
  555. else()
  556. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
  557. endif()
  558. endif()
  559. if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
  560. set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT
  561. COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
  562. endif()
  563. install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
  564. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  565. ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
  566. )
  567. endif()
  568. endif()