InstallRequiredSystemLibraries.cmake 27 KB

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