1
0

InstallRequiredSystemLibraries.cmake 30 KB

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