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