Skip to content

Commit 91b921b

Browse files
jamesobutlerjcfr
andcommitted
COMP: Include system runtime libraries
This avoids a termination fault when running the CLI executable when it was built with a newer MSVC relative to another computer with an older runtime. Including the runtime libraries will make sure compatibility is correct instead of falling back to the system version. Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
1 parent 0e28e41 commit 91b921b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

CMake/SEMMacroBuildCLI.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,26 @@ macro(SEMMacroBuildCLI)
259259
COMPONENT RuntimeLibraries
260260
)
261261

262+
# Save current values if any
263+
if(DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
264+
set(_saved_CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION})
265+
endif()
266+
if(DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
267+
set(_saved_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
268+
endif()
269+
270+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${LOCAL_SEM_INSTALL_RUNTIME_DESTINATION})
271+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT "RuntimeLibraries")
272+
include(InstallRequiredSystemLibraries)
273+
274+
# Restore values
275+
if(DEFINED _saved_CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
276+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${_saved_CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION})
277+
endif()
278+
if(DEFINED _saved_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT)
279+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT ${_saved_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT})
280+
endif()
281+
262282
endif()
263283

264284
# Folder

0 commit comments

Comments
 (0)