InstallRequiredSystemLibraries.cmake 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  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. if(";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;(10\.[0-9.]+)[;\]]=])
  283. set(__ucrt_version "${CMAKE_MATCH_1}/")
  284. else()
  285. set(__ucrt_version "")
  286. endif()
  287. find_path(WINDOWS_KITS_DIR
  288. NAMES
  289. Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
  290. Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
  291. PATHS
  292. $ENV{CMAKE_WINDOWS_KITS_10_DIR}
  293. "${windows_kits_dir}"
  294. "$ENV{ProgramFiles}/Windows Kits/10"
  295. "$ENV{${programfilesx86}}/Windows Kits/10"
  296. )
  297. mark_as_advanced(WINDOWS_KITS_DIR)
  298. # Glob the list of UCRT DLLs.
  299. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  300. if(EXISTS "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll")
  301. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
  302. else()
  303. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
  304. endif()
  305. list(APPEND __install__libs ${__ucrt_dlls})
  306. endif()
  307. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  308. if(EXISTS "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/ucrtbased.dll")
  309. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/*.dll")
  310. else()
  311. file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll")
  312. endif()
  313. list(APPEND __install__libs ${__ucrt_dlls})
  314. endif()
  315. endif()
  316. endif()
  317. if(CMAKE_INSTALL_MFC_LIBRARIES)
  318. if(MSVC_VERSION EQUAL 1300)
  319. set(__install__libs ${__install__libs}
  320. "${SYSTEMROOT}/system32/mfc70.dll"
  321. )
  322. endif()
  323. if(MSVC_VERSION EQUAL 1310)
  324. set(__install__libs ${__install__libs}
  325. "${SYSTEMROOT}/system32/mfc71.dll"
  326. )
  327. endif()
  328. if(MSVC_VERSION EQUAL 1400)
  329. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  330. set(MSVC_MFC_DIR
  331. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
  332. set(__install__libs ${__install__libs}
  333. "${MSVC_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
  334. "${MSVC_MFC_DIR}/mfc80d.dll"
  335. "${MSVC_MFC_DIR}/mfc80ud.dll"
  336. "${MSVC_MFC_DIR}/mfcm80d.dll"
  337. "${MSVC_MFC_DIR}/mfcm80ud.dll"
  338. )
  339. endif()
  340. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
  341. # Install the manifest that allows DLLs to be loaded from the
  342. # directory containing the executable.
  343. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  344. set(__install__libs ${__install__libs}
  345. "${MSVC_MFC_DIR}/Microsoft.VC80.MFC.manifest"
  346. "${MSVC_MFC_DIR}/mfc80.dll"
  347. "${MSVC_MFC_DIR}/mfc80u.dll"
  348. "${MSVC_MFC_DIR}/mfcm80.dll"
  349. "${MSVC_MFC_DIR}/mfcm80u.dll"
  350. )
  351. endif()
  352. # include the language dll's for vs8 as well as the actual dll's
  353. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
  354. # Install the manifest that allows DLLs to be loaded from the
  355. # directory containing the executable.
  356. set(__install__libs ${__install__libs}
  357. "${MSVC_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
  358. "${MSVC_MFCLOC_DIR}/mfc80chs.dll"
  359. "${MSVC_MFCLOC_DIR}/mfc80cht.dll"
  360. "${MSVC_MFCLOC_DIR}/mfc80enu.dll"
  361. "${MSVC_MFCLOC_DIR}/mfc80esp.dll"
  362. "${MSVC_MFCLOC_DIR}/mfc80deu.dll"
  363. "${MSVC_MFCLOC_DIR}/mfc80fra.dll"
  364. "${MSVC_MFCLOC_DIR}/mfc80ita.dll"
  365. "${MSVC_MFCLOC_DIR}/mfc80jpn.dll"
  366. "${MSVC_MFCLOC_DIR}/mfc80kor.dll"
  367. )
  368. endif()
  369. if(MSVC_VERSION EQUAL 1500)
  370. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  371. set(MSVC_MFC_DIR
  372. "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
  373. set(__install__libs ${__install__libs}
  374. "${MSVC_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
  375. "${MSVC_MFC_DIR}/mfc90d.dll"
  376. "${MSVC_MFC_DIR}/mfc90ud.dll"
  377. "${MSVC_MFC_DIR}/mfcm90d.dll"
  378. "${MSVC_MFC_DIR}/mfcm90ud.dll"
  379. )
  380. endif()
  381. set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
  382. # Install the manifest that allows DLLs to be loaded from the
  383. # directory containing the executable.
  384. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  385. set(__install__libs ${__install__libs}
  386. "${MSVC_MFC_DIR}/Microsoft.VC90.MFC.manifest"
  387. "${MSVC_MFC_DIR}/mfc90.dll"
  388. "${MSVC_MFC_DIR}/mfc90u.dll"
  389. "${MSVC_MFC_DIR}/mfcm90.dll"
  390. "${MSVC_MFC_DIR}/mfcm90u.dll"
  391. )
  392. endif()
  393. # include the language dll's for vs9 as well as the actual dll's
  394. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
  395. # Install the manifest that allows DLLs to be loaded from the
  396. # directory containing the executable.
  397. set(__install__libs ${__install__libs}
  398. "${MSVC_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
  399. "${MSVC_MFCLOC_DIR}/mfc90chs.dll"
  400. "${MSVC_MFCLOC_DIR}/mfc90cht.dll"
  401. "${MSVC_MFCLOC_DIR}/mfc90enu.dll"
  402. "${MSVC_MFCLOC_DIR}/mfc90esp.dll"
  403. "${MSVC_MFCLOC_DIR}/mfc90deu.dll"
  404. "${MSVC_MFCLOC_DIR}/mfc90fra.dll"
  405. "${MSVC_MFCLOC_DIR}/mfc90ita.dll"
  406. "${MSVC_MFCLOC_DIR}/mfc90jpn.dll"
  407. "${MSVC_MFCLOC_DIR}/mfc90kor.dll"
  408. )
  409. endif()
  410. set(_MFC_DLL_VERSION "")
  411. set(_MFC_IDE_VERSION "")
  412. if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
  413. set(_MFC_DLL_VERSION ${_MSVC_DLL_VERSION})
  414. set(_MFC_IDE_VERSION ${_MSVC_IDE_VERSION})
  415. endif()
  416. if(_MFC_DLL_VERSION)
  417. set(v "${_MFC_DLL_VERSION}")
  418. set(vs "${_MFC_IDE_VERSION}")
  419. # Starting with VS 15 the MFC DLLs may be in a different directory.
  420. if (NOT vs VERSION_LESS 15)
  421. file(GLOB _MSVC_REDIST_DIRS "${MSVC_REDIST_DIR}/../*")
  422. find_path(MSVC_REDIST_MFC_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC
  423. PATHS ${_MSVC_REDIST_DIRS} NO_DEFAULT_PATH)
  424. mark_as_advanced(MSVC_REDIST_MFC_DIR)
  425. unset(_MSVC_REDIST_DIRS)
  426. else()
  427. set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
  428. endif()
  429. # Multi-Byte Character Set versions of MFC are available as optional
  430. # addon since Visual Studio 12. So for version 12 or higher, check
  431. # whether they are available and exclude them if they are not.
  432. if(CMAKE_INSTALL_DEBUG_LIBRARIES)
  433. set(MSVC_MFC_DIR
  434. "${MSVC_REDIST_MFC_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugMFC")
  435. set(__install__libs ${__install__libs}
  436. "${MSVC_MFC_DIR}/mfc${v}ud.dll"
  437. "${MSVC_MFC_DIR}/mfcm${v}ud.dll"
  438. )
  439. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}d.dll")
  440. set(__install__libs ${__install__libs}
  441. "${MSVC_MFC_DIR}/mfc${v}d.dll"
  442. )
  443. endif()
  444. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfcm${v}d.dll")
  445. set(__install__libs ${__install__libs}
  446. "${MSVC_MFC_DIR}/mfcm${v}d.dll"
  447. )
  448. endif()
  449. endif()
  450. set(MSVC_MFC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC")
  451. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  452. set(__install__libs ${__install__libs}
  453. "${MSVC_MFC_DIR}/mfc${v}u.dll"
  454. "${MSVC_MFC_DIR}/mfcm${v}u.dll"
  455. )
  456. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}.dll")
  457. set(__install__libs ${__install__libs}
  458. "${MSVC_MFC_DIR}/mfc${v}.dll"
  459. )
  460. endif()
  461. if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfcm${v}.dll")
  462. set(__install__libs ${__install__libs}
  463. "${MSVC_MFC_DIR}/mfcm${v}.dll"
  464. )
  465. endif()
  466. endif()
  467. # include the language dll's as well as the actual dll's
  468. set(MSVC_MFCLOC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFCLOC")
  469. set(__install__libs ${__install__libs}
  470. "${MSVC_MFCLOC_DIR}/mfc${v}chs.dll"
  471. "${MSVC_MFCLOC_DIR}/mfc${v}cht.dll"
  472. "${MSVC_MFCLOC_DIR}/mfc${v}deu.dll"
  473. "${MSVC_MFCLOC_DIR}/mfc${v}enu.dll"
  474. "${MSVC_MFCLOC_DIR}/mfc${v}esn.dll"
  475. "${MSVC_MFCLOC_DIR}/mfc${v}fra.dll"
  476. "${MSVC_MFCLOC_DIR}/mfc${v}ita.dll"
  477. "${MSVC_MFCLOC_DIR}/mfc${v}jpn.dll"
  478. "${MSVC_MFCLOC_DIR}/mfc${v}kor.dll"
  479. "${MSVC_MFCLOC_DIR}/mfc${v}rus.dll"
  480. )
  481. endif()
  482. endif()
  483. # MSVC 8 was the first version with OpenMP
  484. # Furthermore, there is no debug version of this
  485. if(CMAKE_INSTALL_OPENMP_LIBRARIES AND _IRSL_HAVE_MSVC)
  486. set(_MSOMP_DLL_VERSION ${_MSVC_DLL_VERSION})
  487. set(_MSOMP_IDE_VERSION ${_MSVC_IDE_VERSION})
  488. if(_MSOMP_DLL_VERSION)
  489. set(v "${_MSOMP_DLL_VERSION}")
  490. set(vs "${_MSOMP_IDE_VERSION}")
  491. set(MSVC_OPENMP_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.OPENMP")
  492. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
  493. set(__install__libs ${__install__libs}
  494. "${MSVC_OPENMP_DIR}/vcomp${v}.dll")
  495. endif()
  496. endif()
  497. endif()
  498. foreach(lib
  499. ${__install__libs}
  500. )
  501. if(EXISTS ${lib})
  502. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  503. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  504. else()
  505. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  506. message(WARNING "system runtime library file does not exist: '${lib}'")
  507. # This warning indicates an incomplete Visual Studio installation
  508. # or a bug somewhere above here in this file.
  509. # If you would like to avoid this warning, fix the real problem, or
  510. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  511. # this file.
  512. endif()
  513. endif()
  514. endforeach()
  515. endif()
  516. if(_IRSL_HAVE_Intel)
  517. unset(__install_libs)
  518. if(CMAKE_INSTALL_OPENMP_LIBRARIES)
  519. if(WIN32)
  520. list(APPEND __install_libs "${_Intel_redistdir}/libiomp5md.dll" "${_Intel_redistdir}/libiompstubs5md.dll")
  521. elseif(APPLE)
  522. list(APPEND __install_libs "${_Intel_redistdir}/libiomp5.dylib" "${_Intel_redistdir}/libiompstubs5.dylib")
  523. else()
  524. list(APPEND __install_libs "${_Intel_redistdir}/libiomp5.so" "${_Intel_redistdir}/libiompstubs5.so")
  525. if(_Intel_compiler_ver VERSION_LESS 17)
  526. list(APPEND __install_libs "${_Intel_redistdir}/libomp_db.so")
  527. endif()
  528. if(_Intel_compiler_ver VERSION_LESS 13)
  529. list(APPEND __install_libs "${_Intel_redistdir}/libiompprof5.so")
  530. endif()
  531. endif()
  532. endif()
  533. if(WIN32)
  534. set(__install_dirs "${_Intel_redistdir}/1033")
  535. if(EXISTS "${_Intel_redistdir}/1041")
  536. list(APPEND __install_dirs "${_Intel_redistdir}/1041")
  537. endif()
  538. if(_Intel_compiler_ver VERSION_LESS 18)
  539. list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c")
  540. endif()
  541. foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libioffload_host.dll libirngmd.dll
  542. libmmd.dll libmmdd.dll libmpx.dll liboffload.dll svml_dispmd.dll)
  543. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  544. endforeach()
  545. if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
  546. list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.dll")
  547. endif()
  548. if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
  549. foreach(__Intel_lib IN ITEMS ifdlg100.dll libicaf.dll libifcoremd.dll libifcoremdd.dll libifcorert.dll libifcorertd.dll libifportmd.dll)
  550. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  551. endforeach()
  552. endif()
  553. elseif(APPLE)
  554. foreach(__Intel_lib IN ITEMS libchkp.dylib libcilkrts.5.dylib libcilkrts.dylib libimf.dylib libintlc.dylib libirc.dylib libirng.dylib libsvml.dylib)
  555. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  556. endforeach()
  557. if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
  558. if(_Intel_compiler_ver VERSION_LESS 17)
  559. list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.dylib")
  560. endif()
  561. endif()
  562. if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
  563. foreach(__Intel_lib IN ITEMS libifcore.dylib libifcoremt.dylib libifport.dylib libifportmt.dylib)
  564. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  565. endforeach()
  566. endif()
  567. else()
  568. 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)
  569. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  570. endforeach()
  571. if(_Intel_compiler_ver VERSION_GREATER_EQUAL 13)
  572. foreach(__Intel_lib IN ITEMS libirng.so liboffload.so liboffload.so.5)
  573. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  574. endforeach()
  575. endif()
  576. if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
  577. set(__install_dirs "${_Intel_redistdir}/irml")
  578. list(APPEND __install_libs "${_Intel_redistdir}/cilk_db.so")
  579. if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15)
  580. list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.so" "${_Intel_redistdir}/libgfxoffload.so")
  581. endif()
  582. endif()
  583. if(_Intel_compiler_ver VERSION_GREATER_EQUAL 16)
  584. foreach(__Intel_lib IN ITEMS libioffload_host.so libioffload_host.so.5 libioffload_target.so libioffload_target.so.5 libmpx.so offload_main)
  585. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  586. endforeach()
  587. endif()
  588. if(_Intel_compiler_ver VERSION_LESS 15)
  589. foreach(__Intel_lib IN ITEMS libcxaguard.so libcxaguard.so.5)
  590. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  591. endforeach()
  592. endif()
  593. if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
  594. foreach(__Intel_lib IN ITEMS libicaf.so libifcore.so libifcore.so.5 libifcoremt.so libifcoremt.so.5 libifport.so libifport.so.5)
  595. list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
  596. endforeach()
  597. endif()
  598. endif()
  599. foreach(lib IN LISTS __install_libs)
  600. if(EXISTS ${lib})
  601. list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
  602. else()
  603. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  604. message(WARNING "system runtime library file does not exist: '${lib}'")
  605. endif()
  606. endif()
  607. endforeach()
  608. foreach(dir IN LISTS __install_dirs)
  609. if(EXISTS ${dir})
  610. list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_DIRECTORIES ${dir})
  611. else()
  612. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  613. message(WARNING "system runtime library file does not exist: '${dir}'")
  614. endif()
  615. endif()
  616. endforeach()
  617. endif()
  618. if(WATCOM)
  619. get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
  620. if(CMAKE_C_COMPILER_VERSION)
  621. set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
  622. else()
  623. set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
  624. endif()
  625. string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
  626. list(GET _watcom_version_list 0 _watcom_major)
  627. list(GET _watcom_version_list 1 _watcom_minor)
  628. set( __install__libs
  629. ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
  630. ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
  631. ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
  632. foreach(lib
  633. ${__install__libs}
  634. )
  635. if(EXISTS ${lib})
  636. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
  637. ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
  638. else()
  639. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  640. message(WARNING "system runtime library file does not exist: '${lib}'")
  641. # This warning indicates an incomplete Watcom installation
  642. # or a bug somewhere above here in this file.
  643. # If you would like to avoid this warning, fix the real problem, or
  644. # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
  645. # this file.
  646. endif()
  647. endif()
  648. endforeach()
  649. endif()
  650. # Include system runtime libraries in the installation if any are
  651. # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
  652. if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
  653. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
  654. if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
  655. if(WIN32)
  656. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
  657. else()
  658. set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
  659. endif()
  660. endif()
  661. if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
  662. set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT
  663. COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
  664. endif()
  665. install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
  666. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  667. ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
  668. )
  669. install(DIRECTORY ${CMAKE_INSTALL_SYSTEM_RUNTIME_DIRECTORIES}
  670. DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
  671. ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
  672. )
  673. endif()
  674. endif()
  675. cmake_policy(POP)