InstallRequiredSystemLibraries.cmake 22 KB

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