InstallRequiredSystemLibraries.cmake 28 KB

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