InstallRequiredSystemLibraries.cmake 31 KB

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