1
0

InstallRequiredSystemLibraries.cmake 21 KB

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