InstallRequiredSystemLibraries.cmake 30 KB

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