Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions BackwardConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,27 @@ if(WIN32)
if(SUPPORT_WINDOWS_DEBUG_INFO)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--pdb= ")
add_compile_options(-gcodeview)
else()
set(MINGW_MSVCR_LIBRARY "msvcr90$<$<CONFIG:DEBUG>:d>" CACHE STRING "Mingw MSVC runtime import library")
list(APPEND _BACKWARD_LIBRARIES ${MINGW_MSVCR_LIBRARY})
endif()
endif()
# Look for _set_abort_behavior in a few msvcr implementations starting from most recent one
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
set(src_set_abort_behavior "#include <stdlib.h>\nint main(int argc, char* argv[]) { _set_abort_behavior(0, 0); return 0;}\n")
set(_MSVCR_LIBRARIES ucrtbase msvcr140 msvcr120 msvcr110 msvcr100 msvcr90)
foreach(_MSVCR_LIBRARY ${_MSVCR_LIBRARIES})
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_LIBRARIES ${_MSVCR_LIBRARY})
check_cxx_source_compiles("${src_set_abort_behavior}" _MSVCR_FOUND_LIBRARY)
if(_MSVCR_FOUND_LIBRARY)
set(MINGW_MSVCR_LIBRARY ${_MSVCR_LIBRARY} CACHE STRING "Mingw MSVC runtime import library")
list(APPEND _BACKWARD_LIBRARIES ${MINGW_MSVCR_LIBRARY})
break()
endif()
cmake_pop_check_state()
endforeach()
if(NOT _MSVCR_FOUND_LIBRARY)
message(FATAL_ERROR "At least one of the import libraries ${_MSVCR_LIBRARIES} should be available ")
endif()
endif()
endif()

set(BACKWARD_INCLUDE_DIR
Expand Down