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