InstallRequiredSystemLibraries.cmake 29 KB

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