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
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 Set to TRUE to install the Windows Universal CRT libraries for
31 app-local deployment (e.g. to Windows XP). This is meaningful
32 only with MSVC from Visual Studio 2015 or higher.
34 One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable*
35 to an absolute path to tell CMake to look for Windows 10 SDKs in
36 a custom location. The specified directory is expected to contain
37 ``Redist/ucrt/DLLs/*`` directories.
39 ``CMAKE_INSTALL_MFC_LIBRARIES``
40 Set to TRUE to install the MSVC MFC runtime libraries.
42 ``CMAKE_INSTALL_OPENMP_LIBRARIES``
43 Set to TRUE to install the MSVC OpenMP runtime libraries
45 ``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION``
46 Specify the :command:`install(PROGRAMS)` command ``DESTINATION``
47 option. If not specified, the default is ``bin`` on Windows
48 and ``lib`` elsewhere.
50 ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS``
51 Set to TRUE to disable warnings about required library files that
52 do not exist. (For example, Visual Studio Express editions may
53 not provide the redistributable files.)
55 ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT``
56 Specify the :command:`install(PROGRAMS)` command ``COMPONENT``
57 option. If not specified, no such option will be used.
58 #]=======================================================================]
61 cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
63 set(_IRSL_HAVE_Intel FALSE)
64 set(_IRSL_HAVE_MSVC FALSE)
65 foreach(LANG IN ITEMS C CXX Fortran)
66 if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Intel")
67 if(NOT _IRSL_HAVE_Intel)
68 get_filename_component(_Intel_basedir "${CMAKE_${LANG}_COMPILER}" PATH)
69 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
70 set(_Intel_archdir intel64)
72 set(_Intel_archdir ia32)
74 set(_Intel_compiler_ver ${CMAKE_${LANG}_COMPILER_VERSION})
76 get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../redist/${_Intel_archdir}/compiler" ABSOLUTE)
78 get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../compiler/lib" ABSOLUTE)
80 if(EXISTS "${_Intel_basedir}/../lib/${_Intel_archdir}_lin")
81 get_filename_component(_Intel_redistdir "${_Intel_basedir}/../lib/${_Intel_archdir}" ABSOLUTE)
83 get_filename_component(_Intel_redistdir "${_Intel_basedir}/../../compiler/lib/${_Intel_archdir}_lin" ABSOLUTE)
86 set(_IRSL_HAVE_Intel TRUE)
88 elseif("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "MSVC")
89 set(_IRSL_HAVE_MSVC TRUE)
94 file(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
97 if(MSVC_VERSION GREATER 1599)
99 set(CMAKE_MSVC_ARCH x64)
102 set(CMAKE_MSVC_ARCH amd64)
105 set(CMAKE_MSVC_ARCH x86)
108 get_filename_component(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
109 get_filename_component(base_dir "${devenv_dir}/../.." ABSOLUTE)
111 if(MSVC_VERSION EQUAL 1300)
113 "${SYSTEMROOT}/system32/msvcp70.dll"
114 "${SYSTEMROOT}/system32/msvcr70.dll"
118 if(MSVC_VERSION EQUAL 1310)
120 "${SYSTEMROOT}/system32/msvcp71.dll"
121 "${SYSTEMROOT}/system32/msvcr71.dll"
125 if(MSVC_TOOLSET_VERSION EQUAL 80)
126 # Find the runtime library redistribution directory.
127 get_filename_component(msvc_install_dir
128 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
129 if(DEFINED MSVC80_REDIST_DIR AND EXISTS "${MSVC80_REDIST_DIR}")
130 set(MSVC_REDIST_DIR "${MSVC80_REDIST_DIR}") # use old cache entry
132 find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
134 "${msvc_install_dir}/../../VC/redist"
135 "${base_dir}/VC/redist"
137 mark_as_advanced(MSVC_REDIST_DIR)
138 set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT")
140 # Install the manifest that allows DLLs to be loaded from the
141 # directory containing the executable.
142 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
144 "${MSVC_CRT_DIR}/Microsoft.VC80.CRT.manifest"
145 "${MSVC_CRT_DIR}/msvcm80.dll"
146 "${MSVC_CRT_DIR}/msvcp80.dll"
147 "${MSVC_CRT_DIR}/msvcr80.dll"
153 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
155 "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugCRT")
156 set(__install__libs ${__install__libs}
157 "${MSVC_CRT_DIR}/Microsoft.VC80.DebugCRT.manifest"
158 "${MSVC_CRT_DIR}/msvcm80d.dll"
159 "${MSVC_CRT_DIR}/msvcp80d.dll"
160 "${MSVC_CRT_DIR}/msvcr80d.dll"
165 if(MSVC_TOOLSET_VERSION EQUAL 90)
166 # Find the runtime library redistribution directory.
167 get_filename_component(msvc_install_dir
168 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
169 get_filename_component(msvc_express_install_dir
170 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
171 if(DEFINED MSVC90_REDIST_DIR AND EXISTS "${MSVC90_REDIST_DIR}")
172 set(MSVC_REDIST_DIR "${MSVC90_REDIST_DIR}") # use old cache entry
174 find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
176 "${msvc_install_dir}/../../VC/redist"
177 "${msvc_express_install_dir}/../../VC/redist"
178 "${base_dir}/VC/redist"
180 mark_as_advanced(MSVC_REDIST_DIR)
181 set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT")
183 # Install the manifest that allows DLLs to be loaded from the
184 # directory containing the executable.
185 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
187 "${MSVC_CRT_DIR}/Microsoft.VC90.CRT.manifest"
188 "${MSVC_CRT_DIR}/msvcm90.dll"
189 "${MSVC_CRT_DIR}/msvcp90.dll"
190 "${MSVC_CRT_DIR}/msvcr90.dll"
196 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
198 "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
199 set(__install__libs ${__install__libs}
200 "${MSVC_CRT_DIR}/Microsoft.VC90.DebugCRT.manifest"
201 "${MSVC_CRT_DIR}/msvcm90d.dll"
202 "${MSVC_CRT_DIR}/msvcp90d.dll"
203 "${MSVC_CRT_DIR}/msvcr90d.dll"
208 set(MSVC_REDIST_NAME "")
209 set(_MSVC_DLL_VERSION "")
210 set(_MSVC_IDE_VERSION "")
211 if(MSVC_VERSION GREATER_EQUAL 2000)
212 message(WARNING "MSVC ${MSVC_VERSION} not yet supported.")
213 elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 143)
214 message(WARNING "MSVC toolset v${MSVC_TOOLSET_VERSION} not yet supported.")
215 elseif(MSVC_TOOLSET_VERSION EQUAL 142)
216 set(MSVC_REDIST_NAME VC142)
217 set(_MSVC_DLL_VERSION 140)
218 set(_MSVC_IDE_VERSION 16)
219 if(MSVC_VERSION EQUAL 1920)
220 # VS2019 named this differently prior to update 1.
221 set(MSVC_REDIST_NAME VC141)
223 elseif(MSVC_TOOLSET_VERSION EQUAL 141)
224 set(MSVC_REDIST_NAME VC141)
225 set(_MSVC_DLL_VERSION 140)
226 set(_MSVC_IDE_VERSION 15)
227 if(MSVC_VERSION EQUAL 1910)
228 # VS2017 named this differently prior to update 3.
229 set(MSVC_REDIST_NAME VC150)
231 elseif(MSVC_TOOLSET_VERSION)
232 set(MSVC_REDIST_NAME VC${MSVC_TOOLSET_VERSION})
233 math(EXPR _MSVC_DLL_VERSION "${MSVC_TOOLSET_VERSION} / 10 * 10")
234 math(EXPR _MSVC_IDE_VERSION "${MSVC_TOOLSET_VERSION} / 10")
237 set(_MSVCRT_DLL_VERSION "")
238 set(_MSVCRT_IDE_VERSION "")
239 if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
240 set(_MSVCRT_DLL_VERSION "${_MSVC_DLL_VERSION}")
241 set(_MSVCRT_IDE_VERSION "${_MSVC_IDE_VERSION}")
244 if(_MSVCRT_DLL_VERSION)
245 set(v "${_MSVCRT_DLL_VERSION}")
246 set(vs "${_MSVCRT_IDE_VERSION}")
248 # Find the runtime library redistribution directory.
249 if(vs VERSION_LESS 15 AND DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
250 set(MSVC_REDIST_DIR "${MSVC${vs}_REDIST_DIR}") # use old cache entry
252 if(NOT vs VERSION_LESS 15)
253 set(_vs_redist_paths "")
254 # The toolset and its redistributables may come with any VS version 15 or newer.
255 set(_MSVC_IDE_VERSIONS 16 15)
256 foreach(_vs_ver ${_MSVC_IDE_VERSIONS})
257 set(_vs_glob_redist_paths "")
258 cmake_host_system_information(RESULT _vs_dir QUERY VS_${_vs_ver}_DIR) # undocumented query
259 if(IS_DIRECTORY "${_vs_dir}")
260 file(GLOB _vs_glob_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
261 list(REVERSE _vs_glob_redist_paths)
262 list(APPEND _vs_redist_paths ${_vs_glob_redist_paths})
264 unset(_vs_glob_redist_paths)
266 unset(_MSVC_IDE_VERSIONS)
269 get_filename_component(_vs_dir
270 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
271 set(programfilesx86 "ProgramFiles(x86)")
273 "${_vs_dir}/../../VC/redist"
274 "${base_dir}/VC/redist"
275 "$ENV{ProgramFiles}/Microsoft Visual Studio ${vs}.0/VC/redist"
276 "$ENV{${programfilesx86}}/Microsoft Visual Studio ${vs}.0/VC/redist"
279 unset(programfilesx86)
281 find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.CRT PATHS ${_vs_redist_paths})
282 unset(_vs_redist_paths)
283 mark_as_advanced(MSVC_REDIST_DIR)
284 set(MSVC_CRT_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.CRT")
286 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
288 "${MSVC_CRT_DIR}/msvcp${v}.dll"
290 if(NOT vs VERSION_LESS 14)
292 "${MSVC_CRT_DIR}/msvcp${v}_1.dll"
293 "${MSVC_CRT_DIR}/msvcp${v}_2.dll"
294 "${MSVC_CRT_DIR}/msvcp${v}_codecvt_ids.dll"
295 "${MSVC_CRT_DIR}/vcruntime${v}_1.dll"
298 list(APPEND __install__libs "${crt}")
301 list(APPEND __install__libs
302 "${MSVC_CRT_DIR}/vcruntime${v}.dll"
303 "${MSVC_CRT_DIR}/concrt${v}.dll"
306 list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}.dll")
312 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
314 "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugCRT")
315 set(__install__libs ${__install__libs}
316 "${MSVC_CRT_DIR}/msvcp${v}d.dll"
318 if(NOT vs VERSION_LESS 14)
320 "${MSVC_CRT_DIR}/msvcp${v}_1d.dll"
321 "${MSVC_CRT_DIR}/msvcp${v}_2d.dll"
322 "${MSVC_CRT_DIR}/msvcp${v}d_codecvt_ids.dll"
323 "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll"
326 list(APPEND __install__libs "${crt}")
329 list(APPEND __install__libs
330 "${MSVC_CRT_DIR}/vcruntime${v}d.dll"
331 "${MSVC_CRT_DIR}/concrt${v}d.dll"
334 list(APPEND __install__libs "${MSVC_CRT_DIR}/msvcr${v}d.dll")
338 if(CMAKE_INSTALL_UCRT_LIBRARIES AND NOT vs VERSION_LESS 14)
339 # Find the Windows Kits directory.
340 get_filename_component(windows_kits_dir
341 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
342 set(programfilesx86 "ProgramFiles(x86)")
343 if(";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;(10\.[0-9.]+)[;\]]=])
344 set(__ucrt_version "${CMAKE_MATCH_1}/")
346 set(__ucrt_version "")
348 find_path(WINDOWS_KITS_DIR
350 Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
351 Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
353 $ENV{CMAKE_WINDOWS_KITS_10_DIR}
354 "${windows_kits_dir}"
355 "$ENV{ProgramFiles}/Windows Kits/10"
356 "$ENV{${programfilesx86}}/Windows Kits/10"
358 mark_as_advanced(WINDOWS_KITS_DIR)
360 # Glob the list of UCRT DLLs.
361 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
362 if(EXISTS "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll")
363 file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
365 file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
367 list(APPEND __install__libs ${__ucrt_dlls})
369 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
370 if(EXISTS "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/ucrtbased.dll")
371 file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/*.dll")
373 file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll")
375 list(APPEND __install__libs ${__ucrt_dlls})
380 if(CMAKE_INSTALL_MFC_LIBRARIES)
381 if(MSVC_VERSION EQUAL 1300)
382 set(__install__libs ${__install__libs}
383 "${SYSTEMROOT}/system32/mfc70.dll"
387 if(MSVC_VERSION EQUAL 1310)
388 set(__install__libs ${__install__libs}
389 "${SYSTEMROOT}/system32/mfc71.dll"
393 if(MSVC_VERSION EQUAL 1400)
394 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
396 "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC80.DebugMFC")
397 set(__install__libs ${__install__libs}
398 "${MSVC_MFC_DIR}/Microsoft.VC80.DebugMFC.manifest"
399 "${MSVC_MFC_DIR}/mfc80d.dll"
400 "${MSVC_MFC_DIR}/mfc80ud.dll"
401 "${MSVC_MFC_DIR}/mfcm80d.dll"
402 "${MSVC_MFC_DIR}/mfcm80ud.dll"
406 set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC")
407 # Install the manifest that allows DLLs to be loaded from the
408 # directory containing the executable.
409 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
410 set(__install__libs ${__install__libs}
411 "${MSVC_MFC_DIR}/Microsoft.VC80.MFC.manifest"
412 "${MSVC_MFC_DIR}/mfc80.dll"
413 "${MSVC_MFC_DIR}/mfc80u.dll"
414 "${MSVC_MFC_DIR}/mfcm80.dll"
415 "${MSVC_MFC_DIR}/mfcm80u.dll"
419 # include the language dll's for vs8 as well as the actual dll's
420 set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC")
421 # Install the manifest that allows DLLs to be loaded from the
422 # directory containing the executable.
423 set(__install__libs ${__install__libs}
424 "${MSVC_MFCLOC_DIR}/Microsoft.VC80.MFCLOC.manifest"
425 "${MSVC_MFCLOC_DIR}/mfc80chs.dll"
426 "${MSVC_MFCLOC_DIR}/mfc80cht.dll"
427 "${MSVC_MFCLOC_DIR}/mfc80enu.dll"
428 "${MSVC_MFCLOC_DIR}/mfc80esp.dll"
429 "${MSVC_MFCLOC_DIR}/mfc80deu.dll"
430 "${MSVC_MFCLOC_DIR}/mfc80fra.dll"
431 "${MSVC_MFCLOC_DIR}/mfc80ita.dll"
432 "${MSVC_MFCLOC_DIR}/mfc80jpn.dll"
433 "${MSVC_MFCLOC_DIR}/mfc80kor.dll"
437 if(MSVC_VERSION EQUAL 1500)
438 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
440 "${MSVC_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugMFC")
441 set(__install__libs ${__install__libs}
442 "${MSVC_MFC_DIR}/Microsoft.VC90.DebugMFC.manifest"
443 "${MSVC_MFC_DIR}/mfc90d.dll"
444 "${MSVC_MFC_DIR}/mfc90ud.dll"
445 "${MSVC_MFC_DIR}/mfcm90d.dll"
446 "${MSVC_MFC_DIR}/mfcm90ud.dll"
450 set(MSVC_MFC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC")
451 # Install the manifest that allows DLLs to be loaded from the
452 # directory containing the executable.
453 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
454 set(__install__libs ${__install__libs}
455 "${MSVC_MFC_DIR}/Microsoft.VC90.MFC.manifest"
456 "${MSVC_MFC_DIR}/mfc90.dll"
457 "${MSVC_MFC_DIR}/mfc90u.dll"
458 "${MSVC_MFC_DIR}/mfcm90.dll"
459 "${MSVC_MFC_DIR}/mfcm90u.dll"
463 # include the language dll's for vs9 as well as the actual dll's
464 set(MSVC_MFCLOC_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC")
465 # Install the manifest that allows DLLs to be loaded from the
466 # directory containing the executable.
467 set(__install__libs ${__install__libs}
468 "${MSVC_MFCLOC_DIR}/Microsoft.VC90.MFCLOC.manifest"
469 "${MSVC_MFCLOC_DIR}/mfc90chs.dll"
470 "${MSVC_MFCLOC_DIR}/mfc90cht.dll"
471 "${MSVC_MFCLOC_DIR}/mfc90enu.dll"
472 "${MSVC_MFCLOC_DIR}/mfc90esp.dll"
473 "${MSVC_MFCLOC_DIR}/mfc90deu.dll"
474 "${MSVC_MFCLOC_DIR}/mfc90fra.dll"
475 "${MSVC_MFCLOC_DIR}/mfc90ita.dll"
476 "${MSVC_MFCLOC_DIR}/mfc90jpn.dll"
477 "${MSVC_MFCLOC_DIR}/mfc90kor.dll"
481 set(_MFC_DLL_VERSION "")
482 set(_MFC_IDE_VERSION "")
483 if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
484 set(_MFC_DLL_VERSION ${_MSVC_DLL_VERSION})
485 set(_MFC_IDE_VERSION ${_MSVC_IDE_VERSION})
489 set(v "${_MFC_DLL_VERSION}")
490 set(vs "${_MFC_IDE_VERSION}")
492 # Starting with VS 15 the MFC DLLs may be in a different directory.
493 if (NOT vs VERSION_LESS 15)
494 file(GLOB _MSVC_REDIST_DIRS "${MSVC_REDIST_DIR}/../*")
495 find_path(MSVC_REDIST_MFC_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC
496 PATHS ${_MSVC_REDIST_DIRS} NO_DEFAULT_PATH)
497 mark_as_advanced(MSVC_REDIST_MFC_DIR)
498 unset(_MSVC_REDIST_DIRS)
500 set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
503 # Multi-Byte Character Set versions of MFC are available as optional
504 # addon since Visual Studio 12. So for version 12 or higher, check
505 # whether they are available and exclude them if they are not.
507 if(CMAKE_INSTALL_DEBUG_LIBRARIES)
509 "${MSVC_REDIST_MFC_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.DebugMFC")
510 set(__install__libs ${__install__libs}
511 "${MSVC_MFC_DIR}/mfc${v}ud.dll"
512 "${MSVC_MFC_DIR}/mfcm${v}ud.dll"
514 if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}d.dll")
515 set(__install__libs ${__install__libs}
516 "${MSVC_MFC_DIR}/mfc${v}d.dll"
519 if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfcm${v}d.dll")
520 set(__install__libs ${__install__libs}
521 "${MSVC_MFC_DIR}/mfcm${v}d.dll"
526 set(MSVC_MFC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFC")
527 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
528 set(__install__libs ${__install__libs}
529 "${MSVC_MFC_DIR}/mfc${v}u.dll"
530 "${MSVC_MFC_DIR}/mfcm${v}u.dll"
532 if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfc${v}.dll")
533 set(__install__libs ${__install__libs}
534 "${MSVC_MFC_DIR}/mfc${v}.dll"
537 if("${v}" LESS 12 OR EXISTS "${MSVC_MFC_DIR}/mfcm${v}.dll")
538 set(__install__libs ${__install__libs}
539 "${MSVC_MFC_DIR}/mfcm${v}.dll"
544 # include the language dll's as well as the actual dll's
545 set(MSVC_MFCLOC_DIR "${MSVC_REDIST_MFC_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.MFCLOC")
546 set(__install__libs ${__install__libs}
547 "${MSVC_MFCLOC_DIR}/mfc${v}chs.dll"
548 "${MSVC_MFCLOC_DIR}/mfc${v}cht.dll"
549 "${MSVC_MFCLOC_DIR}/mfc${v}deu.dll"
550 "${MSVC_MFCLOC_DIR}/mfc${v}enu.dll"
551 "${MSVC_MFCLOC_DIR}/mfc${v}esn.dll"
552 "${MSVC_MFCLOC_DIR}/mfc${v}fra.dll"
553 "${MSVC_MFCLOC_DIR}/mfc${v}ita.dll"
554 "${MSVC_MFCLOC_DIR}/mfc${v}jpn.dll"
555 "${MSVC_MFCLOC_DIR}/mfc${v}kor.dll"
556 "${MSVC_MFCLOC_DIR}/mfc${v}rus.dll"
561 # MSVC 8 was the first version with OpenMP
562 # Furthermore, there is no debug version of this
563 if(CMAKE_INSTALL_OPENMP_LIBRARIES AND _IRSL_HAVE_MSVC)
564 set(_MSOMP_DLL_VERSION ${_MSVC_DLL_VERSION})
565 set(_MSOMP_IDE_VERSION ${_MSVC_IDE_VERSION})
567 if(_MSOMP_DLL_VERSION)
568 set(v "${_MSOMP_DLL_VERSION}")
569 set(vs "${_MSOMP_IDE_VERSION}")
570 set(MSVC_OPENMP_DIR "${MSVC_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.${MSVC_REDIST_NAME}.OPENMP")
572 if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
573 set(__install__libs ${__install__libs}
574 "${MSVC_OPENMP_DIR}/vcomp${v}.dll")
583 set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
584 ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
586 if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
587 message(WARNING "system runtime library file does not exist: '${lib}'")
588 # This warning indicates an incomplete Visual Studio installation
589 # or a bug somewhere above here in this file.
590 # If you would like to avoid this warning, fix the real problem, or
591 # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
599 unset(__install_libs)
600 if(CMAKE_INSTALL_OPENMP_LIBRARIES)
602 list(APPEND __install_libs "${_Intel_redistdir}/libiomp5md.dll" "${_Intel_redistdir}/libiompstubs5md.dll")
604 list(APPEND __install_libs "${_Intel_redistdir}/libiomp5.dylib" "${_Intel_redistdir}/libiompstubs5.dylib")
606 list(APPEND __install_libs "${_Intel_redistdir}/libiomp5.so" "${_Intel_redistdir}/libiompstubs5.so")
607 if(_Intel_compiler_ver VERSION_LESS 17)
608 list(APPEND __install_libs "${_Intel_redistdir}/libomp_db.so")
610 if(_Intel_compiler_ver VERSION_LESS 13)
611 list(APPEND __install_libs "${_Intel_redistdir}/libiompprof5.so")
616 set(__install_dirs "${_Intel_redistdir}/1033")
617 if(EXISTS "${_Intel_redistdir}/1041")
618 list(APPEND __install_dirs "${_Intel_redistdir}/1041")
620 if(_Intel_compiler_ver VERSION_LESS 18)
621 list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c")
623 foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libioffload_host.dll libirngmd.dll
624 libmmd.dll libmmdd.dll libmpx.dll liboffload.dll svml_dispmd.dll)
626 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
628 if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
629 list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.dll")
631 if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
632 foreach(__Intel_lib IN ITEMS ifdlg100.dll libicaf.dll libifcoremd.dll libifcoremdd.dll libifcorert.dll libifcorertd.dll libifportmd.dll)
634 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
638 foreach(__Intel_lib IN ITEMS libchkp.dylib libcilkrts.5.dylib libcilkrts.dylib libimf.dylib libintlc.dylib libirc.dylib libirng.dylib libsvml.dylib)
639 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
641 if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
642 if(_Intel_compiler_ver VERSION_LESS 17)
643 list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.dylib")
646 if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
647 foreach(__Intel_lib IN ITEMS libifcore.dylib libifcoremt.dylib libifport.dylib libifportmt.dylib)
649 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
653 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)
655 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
657 if(_Intel_compiler_ver VERSION_GREATER_EQUAL 13)
658 foreach(__Intel_lib IN ITEMS libirng.so liboffload.so liboffload.so.5)
660 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
663 if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel)
664 set(__install_dirs "${_Intel_redistdir}/irml")
665 list(APPEND __install_libs "${_Intel_redistdir}/cilk_db.so")
666 if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15)
667 list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.so" "${_Intel_redistdir}/libgfxoffload.so")
670 if(_Intel_compiler_ver VERSION_GREATER_EQUAL 16)
671 foreach(__Intel_lib IN ITEMS libioffload_host.so libioffload_host.so.5 libioffload_target.so libioffload_target.so.5 libmpx.so offload_main)
673 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
676 if(_Intel_compiler_ver VERSION_LESS 15)
677 foreach(__Intel_lib IN ITEMS libcxaguard.so libcxaguard.so.5)
679 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
682 if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
683 foreach(__Intel_lib IN ITEMS libicaf.so libifcore.so libifcore.so.5 libifcoremt.so libifcoremt.so.5 libifport.so libifport.so.5)
685 list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}")
690 foreach(lib IN LISTS __install_libs)
692 list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
694 if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
695 message(WARNING "system runtime library file does not exist: '${lib}'")
700 foreach(dir IN LISTS __install_dirs)
702 list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_DIRECTORIES ${dir})
704 if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
705 message(WARNING "system runtime library file does not exist: '${dir}'")
712 get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
713 if(CMAKE_C_COMPILER_VERSION)
714 set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
716 set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
718 string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
719 list(GET _watcom_version_list 0 _watcom_major)
720 list(GET _watcom_version_list 1 _watcom_minor)
722 ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
723 ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
724 ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
729 set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
730 ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
732 if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
733 message(WARNING "system runtime library file does not exist: '${lib}'")
734 # This warning indicates an incomplete Watcom installation
735 # or a bug somewhere above here in this file.
736 # If you would like to avoid this warning, fix the real problem, or
737 # set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
745 # Include system runtime libraries in the installation if any are
746 # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
747 if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
748 if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
749 if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
751 set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
753 set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
756 if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
757 set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT
758 COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
760 install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
761 DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
762 ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}
765 install(DIRECTORY ${CMAKE_INSTALL_SYSTEM_RUNTIME_DIRECTORIES}
766 DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
767 ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}