InstallRequiredSystemLibraries.cmake 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  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. Include this module to search for compiler-provided system runtime
  7. libraries and add install rules for them. Some optional variables
  8. may be set prior to including the module to adjust behavior:
  9. ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS``
  10. Specify additional runtime libraries that may not be detected.
  11. After inclusion any detected libraries will be appended to this.
  12. ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP``
  13. Set to TRUE to skip calling the :command:`install(PROGRAMS)` command to
  14. allow the includer to specify its own install rule, using the value of
  15. ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` to get the list of libraries.
  16. ``CMAKE_INSTALL_DEBUG_LIBRARIES``
  17. Set to TRUE to install the debug runtime libraries when available
  18. with MSVC tools.
  19. ``CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY``
  20. Set to TRUE to install only the debug runtime libraries with MSVC
  21. tools even if the release runtime libraries are also available.
  22. ``CMAKE_INSTALL_UCRT_LIBRARIES``
  23. .. versionadded:: 3.6
  24. Set to TRUE to install the Windows Universal CRT libraries for
  25. app-local deployment (e.g. to Windows XP). This is meaningful
  26. only with MSVC from Visual Studio 2015 or higher.
  27. .. versionadded:: 3.9
  28. One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable*
  29. to an absolute path to tell CMake to look for Windows 10 SDKs in
  30. a custom location. The specified directory is expected to contain
  31. ``Redist/ucrt/DLLs/*`` directories.
  32. ``CMAKE_INSTALL_MFC_LIBRARIES``
  33. Set to TRUE to install the MSVC MFC runtime libraries.
  34. ``CMAKE_INSTALL_OPENMP_LIBRARIES``
  35. Set to TRUE to install the MSVC OpenMP runtime libraries
  36. ``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION``
  37. Specify the :command:`install(PROGRAMS)` command ``DESTINATION``
  38. option. If not specified, the default is ``bin`` on Windows
  39. and ``lib`` elsewhere.
  40. ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS``
  41. Set to TRUE to disable warnings about required library files that
  42. do not exist. (For example, Visual Studio Express editions may
  43. not provide the redistributable files.)
  44. ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT``
  45. .. versionadded:: 3.3
  46. Specify the :command:`install(PROGRAMS)` command ``COMPONENT``
  47. option. If not specified, no such option will be used.
  48. .. versionadded:: 3.10
  49. Support for installing Intel compiler runtimes.
  50. #]=======================================================================]
  51. set(_IRSL_HAVE_Intel FALSE)
  52. set(_IRSL_HAVE_MSVC FALSE)
  53. foreach(LANG IN ITEMS C CXX Fortran)
  54. if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "Intel")
  55. if(NOT _IRSL_HAVE_Intel)
  56. # The oneAPI icx/ifx compilers are under ${os}/bin.
  57. # The classic icc/icpc/icl/ifort compilers may be under ${os}/bin/intel64.
  58. get_filename_component(_Intel_basedir "${CMAKE_${LANG}_COMPILER}" PATH)
  59. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  60. set(_Intel_archdir intel64)
  61. else()
  62. set(_Intel_archdir ia32)
  63. endif()
  64. set(_Intel_compiler_ver ${CMAKE_${LANG}_COMPILER_VERSION})
  65. if(WIN32)
  66. set(_Intel_possible_redistdirs
  67. "${_Intel_basedir}/../redist/${_Intel_archdir}_win/compiler"
  68. "${_Intel_basedir}/../redist/${_Intel_archdir}/compiler"
  69. "${_Intel_basedir}/../../redist/${_Intel_archdir}_win/compiler"
  70. "${_Intel_basedir}/../../redist/${_Intel_archdir}/compiler"
  71. )
  72. elseif(APPLE)
  73. set(_Intel_possible_redistdirs
  74. "${_Intel_basedir}/../../compiler/lib"
  75. )
  76. else()
  77. set(_Intel_possible_redistdirs
  78. "${_Intel_basedir}/../lib/${_Intel_archdir}"
  79. "${_Intel_basedir}/../compiler/lib/${_Intel_archdir}_lin"
  80. "${_Intel_basedir}/../../compiler/lib/${_Intel_archdir}_lin"
  81. )
  82. endif()
  83. set(_Intel_redistdir NOT-FOUND)
  84. foreach(dir IN LISTS _Intel_possible_redistdirs)
  85. if(EXISTS "${dir}")
  86. set(_Intel_redistdir "${dir}")
  87. break()
  88. endif()
  89. endforeach()
  90. # Fall back to last dir
  91. if(NOT _Intel_redistdir)
  92. list(POP_BACK _Intel_possible_redistdirs _Intel_redistdir)
  93. endif()
  94. unset(_Intel_possible_redistdirs)
  95. set(_IRSL_HAVE_Intel TRUE)
  96. endif()
  97. elseif("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "MSVC")
  98. set(_IRSL_HAVE_MSVC TRUE)
  99. endif()
  100. endforeach()
  101. if(MSVC)
  102. file(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
  103. if(MSVC_C_ARCHITECTURE_ID)
  104. string(TOLOWER "${MSVC_C_ARCHITECTURE_ID}" CMAKE_MSVC_ARCH)
  105. elseif(MSVC_CXX_ARCHITECTURE_ID)
  106. string(TOLOWER "${MSVC_CXX_ARCHITECTURE_ID}" CMAKE_MSVC_ARCH)
  107. else()
  108. set(CMAKE_MSVC_ARCH x86)
  109. endif()
  110. if(CMAKE_MSVC_ARCH STREQUAL "x64")
  111. if(MSVC_VERSION LESS 1600)
  112. # VS 9 and earlier:
  113. set(CMAKE_MSVC_ARCH amd64)
  114. endif()
  115. endif()
  116. get_filename_component(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
  117. get_filename_component(base_dir "${devenv_dir}/../.." ABSOLUTE)
  118. if(MSVC_VERSION EQUAL 1300)
  119. set(__install__libs
  120. "${SYSTEMROOT}/system32/msvcp70.dll"
  121. "${SYSTEMROOT}/system32/msvcr70.dll"
  122. )
  123. endif()
  124. if(MSVC_VERSION EQUAL 1310)
  125. set(__install__libs
  126. "${SYSTEMROOT}/system32/msvcp71.dll"
  127. "${SYSTEMROOT}/system32/msvcr71.dll"
  128. )
  129. endif()
  130. if(MSVC_TOOLSET_VERSION EQUAL 80)
  131. # Find the runtime library redistribution directory.
  132. get_filename_component(msvc_install_dir
  133. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
  134. if(DEFINED MSVC80_REDIST_DIR AND EXISTS "${MSVC80_REDIST_DIR}")
  135. set(MSVC_REDIST_DIR "${MSVC80_REDIST_DIR}") # use old cache entry
  136. endif()
  137. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
  138. PATHS
  139. "${msvc_install_dir}/../../VC/redist"
  140. "${base_dir}/VC/redist"
  141. )
  142. mark_as_advanced(MSVC_REDIST_DIR)
  143. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
  144. # Install the manifest that allows DLLs to be loaded from the
  145. # directory containing the executable.
  146. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  147. set(__install__libs
  148. "${MSVC_CRT_DIR}/Microsoft.VC80.CRT.manifest"
  149. "${MSVC_CRT_DIR}/msvcm80.dll"
  150. "${MSVC_CRT_DIR}/msvcp80.dll"
  151. "${MSVC_CRT_DIR}/msvcr80.dll"
  152. )
  153. else()
  154. set(__install__libs)
  155. endif()
  156. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  157. set(MSVC_CRT_DIR
  158. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT")
  159. set(__install__libs ${__install__libs}
  160. "${MSVC_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest"
  161. "${MSVC_CRT_DIR}/msvcm80d.dll"
  162. "${MSVC_CRT_DIR}/msvcp80d.dll"
  163. "${MSVC_CRT_DIR}/msvcr80d.dll"
  164. )
  165. endif()
  166. endif()
  167. if(MSVC_TOOLSET_VERSION EQUAL 90)
  168. # Find the runtime library redistribution directory.
  169. get_filename_component(msvc_install_dir
  170. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
  171. get_filename_component(msvc_express_install_dir
  172. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
  173. if(DEFINED MSVC90_REDIST_DIR AND EXISTS "${MSVC90_REDIST_DIR}")
  174. set(MSVC_REDIST_DIR "${MSVC90_REDIST_DIR}") # use old cache entry
  175. endif()
  176. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
  177. PATHS
  178. "${msvc_install_dir}/../../VC/redist"
  179. "${msvc_express_install_dir}/../../VC/redist"
  180. "${base_dir}/VC/redist"
  181. )
  182. mark_as_advanced(MSVC_REDIST_DIR)
  183. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
  184. # Install the manifest that allows DLLs to be loaded from the
  185. # directory containing the executable.
  186. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  187. set(__install__libs
  188. "${MSVC_CRT_DIR}/Microsoft.VC90.CRT.manifest"
  189. "${MSVC_CRT_DIR}/msvcm90.dll"
  190. "${MSVC_CRT_DIR}/msvcp90.dll"
  191. "${MSVC_CRT_DIR}/msvcr90.dll"
  192. )
  193. else()
  194. set(__install__libs)
  195. endif()
  196. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  197. set(MSVC_CRT_DIR
  198. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
  199. set(__install__libs ${__install__libs}
  200. "${MSVC_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest"
  201. "${MSVC_CRT_DIR}/msvcm90d.dll"
  202. "${MSVC_CRT_DIR}/msvcp90d.dll"
  203. "${MSVC_CRT_DIR}/msvcr90d.dll"
  204. )
  205. endif()
  206. endif()
  207. set(MSVC_REDIST_NAME "")
  208. set(_MSVC_DLL_VERSION "")
  209. set(_MSVC_IDE_VERSION "")
  210. if(MSVC_VERSION GREATER_EQUAL 2000)
  211. message(WARNING "MSVC ${MSVC_VERSION} not yet supported.")
  212. elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 144)
  213. message(WARNING "MSVC toolset v${MSVC_TOOLSET_VERSION} not yet supported.")
  214. elseif(MSVC_TOOLSET_VERSION EQUAL 143)
  215. set(MSVC_REDIST_NAME VC143)
  216. set(_MSVC_DLL_VERSION 140)
  217. set(_MSVC_IDE_VERSION 17)
  218. elseif(MSVC_TOOLSET_VERSION EQUAL 142)
  219. set(MSVC_REDIST_NAME VC142)
  220. set(_MSVC_DLL_VERSION 140)
  221. set(_MSVC_IDE_VERSION 16)
  222. if(MSVC_VERSION EQUAL 1920)
  223. # VS2019 named this differently prior to update 1.
  224. set(MSVC_REDIST_NAME VC141)
  225. endif()
  226. elseif(MSVC_TOOLSET_VERSION EQUAL 141)
  227. set(MSVC_REDIST_NAME VC141)
  228. set(_MSVC_DLL_VERSION 140)
  229. set(_MSVC_IDE_VERSION 15)
  230. if(MSVC_VERSION EQUAL 1910)
  231. # VS2017 named this differently prior to update 3.
  232. set(MSVC_REDIST_NAME VC150)
  233. endif()
  234. elseif(MSVC_TOOLSET_VERSION)
  235. set(MSVC_REDIST_NAME VC${MSVC_TOOLSET_VERSION})
  236. math(EXPR _MSVC_DLL_VERSION "${MSVC_TOOLSET_VERSION} / 10 * 10")
  237. math(EXPR _MSVC_IDE_VERSION "${MSVC_TOOLSET_VERSION} / 10")
  238. endif()
  239. set(_MSVCRT_DLL_VERSION "")
  240. set(_MSVCRT_IDE_VERSION "")
  241. if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
  242. set(_MSVCRT_DLL_VERSION "${_MSVC_DLL_VERSION}")
  243. set(_MSVCRT_IDE_VERSION "${_MSVC_IDE_VERSION}")
  244. endif()
  245. if(_MSVCRT_DLL_VERSION)
  246. set(v "${_MSVCRT_DLL_VERSION}")
  247. set(vs "${_MSVCRT_IDE_VERSION}")
  248. # Find the runtime library redistribution directory.
  249. if(vs VERSION_LESS 15 AND DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
  250. set(MSVC_REDIST_DIR "${MSVC${vs}_REDIST_DIR}") # use old cache entry
  251. endif()
  252. if(NOT vs VERSION_LESS 15)
  253. set(_vs_redist_paths "")
  254. # The toolset and its redistributables may come with any VS version 15 or newer.
  255. set(_MSVC_IDE_VERSIONS 17 16 15)
  256. foreach(_vs_ver ${_MSVC_IDE_VERSIONS})
  257. set(_vs_glob_redist_paths "")
  258. cmake_host_system_information(RESULT _vs_dir QUERY VS_${_vs_ver}_DIR) # undocumented query
  259. if(IS_DIRECTORY "${_vs_dir}")
  260. file(GLOB _vs_glob_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
  261. list(REVERSE _vs_glob_redist_paths)
  262. list(APPEND _vs_redist_paths ${_vs_glob_redist_paths})
  263. endif()
  264. unset(_vs_glob_redist_paths)
  265. endforeach()
  266. unset(_MSVC_IDE_VERSIONS)
  267. unset(_vs_dir)
  268. else()
  269. get_filename_component(_vs_dir
  270. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
  271. set(programfilesx86 "ProgramFiles(x86)")
  272. set(_vs_redist_paths
  273. "${_vs_dir}/../../VC/redist"
  274. "${base_dir}/VC/redist"
  275. "$ENV{ProgramFiles}/Microsoft Visual Studio ${vs}.0/VC/redist"
  276. "$ENV{${programfilesx86}}/Microsoft Visual Studio ${vs}.0/VC/redist"
  277. )
  278. unset(_vs_dir)
  279. unset(programfilesx86)
  280. endif()
  281. find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.CRT PATHS ${_vs_redist_paths})
  282. unset(_vs_redist_paths)
  283. mark_as_advanced(MSVC_REDIST_DIR)
  284. set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.CRT")
  285. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  286. set(__install__libs
  287. "${MSVC_CRT_DIR}/msvcp${v}.dll"
  288. )
  289. if(NOT vs VERSION_LESS 14)
  290. foreach(crt
  291. "${MSVC_CRT_DIR}/msvcp${v}_1.dll"
  292. "${MSVC_CRT_DIR}/msvcp${v}_2.dll"
  293. "${MSVC_CRT_DIR}/msvcp${v}_atomic_wait.dll"
  294. "${MSVC_CRT_DIR}/msvcp${v}_codecvt_ids.dll"
  295. "${MSVC_CRT_DIR}/vcruntime${v}_1.dll"
  296. )
  297. if(EXISTS "${crt}")
  298. list(APPEND __install__libs "${crt}")
  299. endif()
  300. endforeach()
  301. list(APPEND __install__libs
  302. "${MSVC_CRT_DIR}/vcruntime${v}.dll"
  303. "${MSVC_CRT_DIR}/concrt${v}.dll"
  304. )
  305. else()
  306. list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}.dll")
  307. endif()
  308. else()
  309. set(__install__libs)
  310. endif()
  311. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  312. set(MSVC_CRT_DIR
  313. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugCRT")
  314. set(__install__libs ${__install__libs}
  315. "${MSVC_CRT_DIR}/msvcp${v}d.dll"
  316. )
  317. if(NOT vs VERSION_LESS 14)
  318. foreach(crt
  319. "${MSVC_CRT_DIR}/msvcp${v}_1d.dll"
  320. "${MSVC_CRT_DIR}/msvcp${v}_2d.dll"
  321. "${MSVC_CRT_DIR}/msvcp${v}d_atomic_wait.dll"
  322. "${MSVC_CRT_DIR}/msvcp${v}d_codecvt_ids.dll"
  323. "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll"
  324. )
  325. if(EXISTS "${crt}")
  326. list(APPEND __install__libs "${crt}")
  327. endif()
  328. endforeach()
  329. list(APPEND __install__libs
  330. "${MSVC_CRT_DIR}/vcruntime${v}d.dll"
  331. "${MSVC_CRT_DIR}/concrt${v}d.dll"
  332. )
  333. else()
  334. list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}d.dll")
  335. endif()
  336. endif()
  337. if(CMAKE_INSTALL_UCRT_LIBRARIES AND NOT vs VERSION_LESS 14)
  338. # Find the Windows Kits directory.
  339. get_filename_component(windows_kits_dir
  340. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
  341. set(programfilesx86 "ProgramFiles(x86)")
  342. if(";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;(10\.[0-9.]+)[;\]]=])
  343. set(__ucrt_version "${CMAKE_MATCH_1}/")
  344. else()
  345. set(__ucrt_version "")
  346. endif()
  347. find_path(WINDOWS_KITS_DIR
  348. NAMES
  349. Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
  350. Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
  351. PATHS
  352. $ENV{CMAKE_WINDOWS_KITS_10_DIR}
  353. "${windows_kits_dir}"
  354. "$ENV{ProgramFiles}/Windows Kits/10"
  355. "$ENV{${programfilesx86}}/Windows Kits/10"
  356. )
  357. mark_as_advanced(WINDOWS_KITS_DIR)
  358. # Glob the list of UCRT DLLs.
  359. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  360. if(EXISTS "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll")
  361. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
  362. else()
  363. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
  364. endif()
  365. list(APPEND __install__libs ${__ucrt_dlls})
  366. endif()
  367. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  368. if(EXISTS "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/ucrtbased.dll")
  369. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/*.dll")
  370. else()
  371. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll")
  372. endif()
  373. list(APPEND __install__libs ${__ucrt_dlls})
  374. endif()
  375. endif()
  376. endif()
  377. if(CMAKE_INSTALL_MFC_LIBRARIES)
  378. if(MSVC_VERSION EQUAL 1300)
  379. set(__install__libs ${__install__libs}
  380. "${SYSTEMROOT}/system32/mfc70.dll"
  381. )
  382. endif()
  383. if(MSVC_VERSION EQUAL 1310)
  384. set(__install__libs ${__install__libs}
  385. "${SYSTEMROOT}/system32/mfc71.dll"
  386. )
  387. endif()
  388. if(MSVC_VERSION EQUAL 1400)
  389. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  390. set(MSVC_MFC_DIR
  391. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
  392. set(__install__libs ${__install__libs}
  393. "${MSVC_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
  394. "${MSVC_MFC_DIR}/mfc80d.dll"
  395. "${MSVC_MFC_DIR}/mfc80ud.dll"
  396. "${MSVC_MFC_DIR}/mfcm80d.dll"
  397. "${MSVC_MFC_DIR}/mfcm80ud.dll"
  398. )
  399. endif()
  400. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
  401. # Install the manifest that allows DLLs to be loaded from the
  402. # directory containing the executable.
  403. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  404. set(__install__libs ${__install__libs}
  405. "${MSVC_MFC_DIR}/Microsoft.VC80.MFC.manifest"
  406. "${MSVC_MFC_DIR}/mfc80.dll"
  407. "${MSVC_MFC_DIR}/mfc80u.dll"
  408. "${MSVC_MFC_DIR}/mfcm80.dll"
  409. "${MSVC_MFC_DIR}/mfcm80u.dll"
  410. )
  411. endif()
  412. # include the language dll's for vs8 as well as the actual dll's
  413. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
  414. # Install the manifest that allows DLLs to be loaded from the
  415. # directory containing the executable.
  416. set(__install__libs ${__install__libs}
  417. "${MSVC_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
  418. "${MSVC_MFCLOC_DIR}/mfc80chs.dll"
  419. "${MSVC_MFCLOC_DIR}/mfc80cht.dll"
  420. "${MSVC_MFCLOC_DIR}/mfc80enu.dll"
  421. "${MSVC_MFCLOC_DIR}/mfc80esp.dll"
  422. "${MSVC_MFCLOC_DIR}/mfc80deu.dll"
  423. "${MSVC_MFCLOC_DIR}/mfc80fra.dll"
  424. "${MSVC_MFCLOC_DIR}/mfc80ita.dll"
  425. "${MSVC_MFCLOC_DIR}/mfc80jpn.dll"
  426. "${MSVC_MFCLOC_DIR}/mfc80kor.dll"
  427. )
  428. endif()
  429. if(MSVC_VERSION EQUAL 1500)
  430. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  431. set(MSVC_MFC_DIR
  432. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
  433. set(__install__libs ${__install__libs}
  434. "${MSVC_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
  435. "${MSVC_MFC_DIR}/mfc90d.dll"
  436. "${MSVC_MFC_DIR}/mfc90ud.dll"
  437. "${MSVC_MFC_DIR}/mfcm90d.dll"
  438. "${MSVC_MFC_DIR}/mfcm90ud.dll"
  439. )
  440. endif()
  441. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
  442. # Install the manifest that allows DLLs to be loaded from the
  443. # directory containing the executable.
  444. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  445. set(__install__libs ${__install__libs}
  446. "${MSVC_MFC_DIR}/Microsoft.VC90.MFC.manifest"
  447. "${MSVC_MFC_DIR}/mfc90.dll"
  448. "${MSVC_MFC_DIR}/mfc90u.dll"
  449. "${MSVC_MFC_DIR}/mfcm90.dll"
  450. "${MSVC_MFC_DIR}/mfcm90u.dll"
  451. )
  452. endif()
  453. # include the language dll's for vs9 as well as the actual dll's
  454. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
  455. # Install the manifest that allows DLLs to be loaded from the
  456. # directory containing the executable.
  457. set(__install__libs ${__install__libs}
  458. "${MSVC_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
  459. "${MSVC_MFCLOC_DIR}/mfc90chs.dll"
  460. "${MSVC_MFCLOC_DIR}/mfc90cht.dll"
  461. "${MSVC_MFCLOC_DIR}/mfc90enu.dll"
  462. "${MSVC_MFCLOC_DIR}/mfc90esp.dll"
  463. "${MSVC_MFCLOC_DIR}/mfc90deu.dll"
  464. "${MSVC_MFCLOC_DIR}/mfc90fra.dll"
  465. "${MSVC_MFCLOC_DIR}/mfc90ita.dll"
  466. "${MSVC_MFCLOC_DIR}/mfc90jpn.dll"
  467. "${MSVC_MFCLOC_DIR}/mfc90kor.dll"
  468. )
  469. endif()
  470. set(_MFC_DLL_VERSION "")
  471. set(_MFC_IDE_VERSION "")
  472. if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
  473. set(_MFC_DLL_VERSION ${_MSVC_DLL_VERSION})
  474. set(_MFC_IDE_VERSION ${_MSVC_IDE_VERSION})
  475. endif()
  476. if(_MFC_DLL_VERSION)
  477. set(v "${_MFC_DLL_VERSION}")
  478. set(vs "${_MFC_IDE_VERSION}")
  479. # Starting with VS 15 the MFC DLLs may be in a different directory.
  480. if (NOT vs VERSION_LESS 15)
  481. file(GLOB _MSVC_REDIST_DIRS "${MSVC_REDIST_DIR}/../*")
  482. find_path(MSVC_REDIST_MFC_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC
  483. PATHS ${_MSVC_REDIST_DIRS} NO_DEFAULT_PATH)
  484. mark_as_advanced(MSVC_REDIST_MFC_DIR)
  485. unset(_MSVC_REDIST_DIRS)
  486. else()
  487. set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
  488. endif()
  489. # Multi-Byte Character Set versions of MFC are available as optional
  490. # addon since Visual Studio 12. So for version 12 or higher, check
  491. # whether they are available and exclude them if they are not.
  492. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  493. set(MSVC_MFC_DIR
  494. "${MSVC_REDIST_MFC_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugMFC")
  495. set(__install__libs ${__install__libs}
  496. "${MSVC_MFC_DIR}/mfc${v}ud.dll"
  497. "${MSVC_MFC_DIR}/mfcm${v}ud.dll"
  498. )
  499. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}d.dll")
  500. set(__install__libs ${__install__libs}
  501. "${MSVC_MFC_DIR}/mfc${v}d.dll"
  502. )
  503. endif()
  504. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfcm${v}d.dll")
  505. set(__install__libs ${__install__libs}
  506. "${MSVC_MFC_DIR}/mfcm${v}d.dll"
  507. )
  508. endif()
  509. endif()
  510. set(MSVC_MFC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC")
  511. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  512. set(__install__libs ${__install__libs}
  513. "${MSVC_MFC_DIR}/mfc${v}u.dll"
  514. "${MSVC_MFC_DIR}/mfcm${v}u.dll"
  515. )
  516. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}.dll")
  517. set(__install__libs ${__install__libs}
  518. "${MSVC_MFC_DIR}/mfc${v}.dll"
  519. )
  520. endif()
  521. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfcm${v}.dll")
  522. set(__install__libs ${__install__libs}
  523. "${MSVC_MFC_DIR}/mfcm${v}.dll"
  524. )
  525. endif()
  526. endif()
  527. # include the language dll's as well as the actual dll's
  528. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFCLOC")
  529. set(__install__libs ${__install__libs}
  530. "${MSVC_MFCLOC_DIR}/mfc${v}chs.dll"
  531. "${MSVC_MFCLOC_DIR}/mfc${v}cht.dll"
  532. "${MSVC_MFCLOC_DIR}/mfc${v}deu.dll"
  533. "${MSVC_MFCLOC_DIR}/mfc${v}enu.dll"
  534. "${MSVC_MFCLOC_DIR}/mfc${v}esn.dll"
  535. "${MSVC_MFCLOC_DIR}/mfc${v}fra.dll"
  536. "${MSVC_MFCLOC_DIR}/mfc${v}ita.dll"
  537. "${MSVC_MFCLOC_DIR}/mfc${v}jpn.dll"
  538. "${MSVC_MFCLOC_DIR}/mfc${v}kor.dll"
  539. "${MSVC_MFCLOC_DIR}/mfc${v}rus.dll"
  540. )
  541. endif()
  542. endif()
  543. # MSVC 8 was the first version with OpenMP
  544. # Furthermore, there is no debug version of this
  545. if(CMAKE_INSTALL_OPENMP_LIBRARIES AND _IRSL_HAVE_MSVC)
  546. set(_MSOMP_DLL_VERSION ${_MSVC_DLL_VERSION})
  547. set(_MSOMP_IDE_VERSION ${_MSVC_IDE_VERSION})
  548. if(_MSOMP_DLL_VERSION)
  549. set(v "${_MSOMP_DLL_VERSION}")
  550. set(vs "${_MSOMP_IDE_VERSION}")
  551. set(MSVC_OPENMP_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.OPENMP")
  552. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  553. set(__install__libs ${__install__libs}
  554. "${MSVC_OPENMP_DIR}/vcomp${v}.dll")
  555. endif()
  556. endif()
  557. endif()
  558. foreach(lib
  559. ${__install__libs}
  560. )
  561. if(EXISTS ${lib})
  562. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  563. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  564. else()
  565. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  566. message(WARNING "system runtime library file does not exist: '${lib}'")
  567. # This warning indicates an incomplete Visual Studio installation
  568. # or a bug somewhere above here in this file.
  569. # If you would like to avoid this warning, fix the real problem, or
  570. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  571. # this file.
  572. endif()
  573. endif()
  574. endforeach()
  575. endif()
  576. if(_IRSL_HAVE_Intel)
  577. unset(__install_libs)
  578. if(CMAKE_INSTALL_OPENMP_LIBRARIES)
  579. if(WIN32)
  580. list(APPEND __install_libs "${_Intel_redistdir}/libiomp5md.dll" "${_Intel_redistdir}/libiompstubs5md.dll")
  581. elseif(APPLE)
  582. list(APPEND __install_libs "${_Intel_redistdir}/libiomp5.dylib" "${_Intel_redistdir}/libiompstubs5.dylib")
  583. else()
  584. list(APPEND __install_libs "${_Intel_redistdir}/libiomp5.so" "${_Intel_redistdir}/libiompstubs5.so")
  585. if(_Intel_compiler_ver VERSION_LESS 17)
  586. list(APPEND __install_libs "${_Intel_redistdir}/libomp_db.so")
  587. endif()
  588. if(_Intel_compiler_ver VERSION_LESS 13)
  589. list(APPEND __install_libs "${_Intel_redistdir}/libiompprof5.so")
  590. endif()
  591. endif()
  592. endif()
  593. if(WIN32)
  594. set(__install_dirs "${_Intel_redistdir}/1033")
  595. if(EXISTS "${_Intel_redistdir}/1041")
  596. list(APPEND __install_dirs "${_Intel_redistdir}/1041")
  597. endif()
  598. if(_Intel_compiler_ver VERSION_LESS 18)
  599. list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c")
  600. endif()
  601. foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libioffload_host.dll libirngmd.dll
  602. libmmd.dll libmmdd.dll libmpx.dll liboffload.dll svml_dispmd.dll)
  603. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  604. endforeach()
  605. if(CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
  606. list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.dll")
  607. endif()
  608. if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
  609. foreach(__Intel_lib IN ITEMS ifdlg100.dll libicaf.dll libifcoremd.dll libifcoremdd.dll libifcorert.dll libifcorertd.dll libifportmd.dll)
  610. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  611. endforeach()
  612. endif()
  613. elseif(APPLE)
  614. foreach(__Intel_lib IN ITEMS libchkp.dylib libcilkrts.5.dylib libcilkrts.dylib libimf.dylib libintlc.dylib libirc.dylib libirng.dylib libsvml.dylib)
  615. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  616. endforeach()
  617. if(CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
  618. if(_Intel_compiler_ver VERSION_LESS 17)
  619. list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.dylib")
  620. endif()
  621. endif()
  622. if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
  623. foreach(__Intel_lib IN ITEMS libifcore.dylib libifcoremt.dylib libifport.dylib libifportmt.dylib)
  624. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  625. endforeach()
  626. endif()
  627. else()
  628. foreach(__Intel_lib IN ITEMS libchkp.so libcilkrts.so libcilkrts.so.5 libimf.so libintlc.so libintlc.so.5 libirc.so libpdbx.so libpdbx.so.5 libsvml.so)
  629. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  630. endforeach()
  631. if(_Intel_compiler_ver VERSION_GREATER_EQUAL 13)
  632. foreach(__Intel_lib IN ITEMS libirng.so liboffload.so liboffload.so.5)
  633. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  634. endforeach()
  635. endif()
  636. if(CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_CXX_COMPILER_ID MATCHES Intel)
  637. set(__install_dirs "${_Intel_redistdir}/irml")
  638. list(APPEND __install_libs "${_Intel_redistdir}/cilk_db.so")
  639. if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15)
  640. list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.so" "${_Intel_redistdir}/libgfxoffload.so")
  641. endif()
  642. endif()
  643. if(_Intel_compiler_ver VERSION_GREATER_EQUAL 16)
  644. foreach(__Intel_lib IN ITEMS libioffload_host.so libioffload_host.so.5 libioffload_target.so libioffload_target.so.5 libmpx.so offload_main)
  645. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  646. endforeach()
  647. endif()
  648. if(_Intel_compiler_ver VERSION_LESS 15)
  649. foreach(__Intel_lib IN ITEMS libcxaguard.so libcxaguard.so.5)
  650. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  651. endforeach()
  652. endif()
  653. if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
  654. foreach(__Intel_lib IN ITEMS libicaf.so libifcore.so libifcore.so.5 libifcoremt.so libifcoremt.so.5 libifport.so libifport.so.5)
  655. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  656. endforeach()
  657. endif()
  658. endif()
  659. foreach(lib IN LISTS __install_libs)
  660. if(EXISTS ${lib})
  661. list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
  662. else()
  663. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  664. message(WARNING "system runtime library file does not exist: '${lib}'")
  665. endif()
  666. endif()
  667. endforeach()
  668. foreach(dir IN LISTS __install_dirs)
  669. if(EXISTS ${dir})
  670. list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_DIRECTORIES ${dir})
  671. else()
  672. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  673. message(WARNING "system runtime library file does not exist: '${dir}'")
  674. endif()
  675. endif()
  676. endforeach()
  677. endif()
  678. if(WATCOM)
  679. get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
  680. if(CMAKE_C_COMPILER_VERSION)
  681. set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
  682. else()
  683. set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
  684. endif()
  685. string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
  686. list(GET _watcom_version_list 0 _watcom_major)
  687. list(GET _watcom_version_list 1 _watcom_minor)
  688. set( __install__libs
  689. ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
  690. ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
  691. ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
  692. foreach(lib
  693. ${__install__libs}
  694. )
  695. if(EXISTS ${lib})
  696. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  697. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  698. else()
  699. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  700. message(WARNING "system runtime library file does not exist: '${lib}'")
  701. # This warning indicates an incomplete Watcom installation
  702. # or a bug somewhere above here in this file.
  703. # If you would like to avoid this warning, fix the real problem, or
  704. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  705. # this file.
  706. endif()
  707. endif()
  708. endforeach()
  709. endif()
  710. # Include system runtime libraries in the installation if any are
  711. # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
  712. if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
  713. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
  714. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
  715. if(WIN32)
  716. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
  717. else()
  718. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
  719. endif()
  720. endif()
  721. if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
  722. set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT
  723. COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
  724. endif()
  725. install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
  726. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  727. ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
  728. )
  729. install(DIRECTORY ${CMAKE_INSTALL_SYSTEM_RUNTIME_DIRECTORIES}
  730. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  731. ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
  732. )
  733. endif()
  734. endif()