InstallRequiredSystemLibraries.cmake 30 KB

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