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