Skip to content

Commit dc3156d

Browse files
authored
[OpenMP] Don't hardcode _WIN32_WINNT for MinGW targets (#115708)
Instead respect what the toolchain default is (or what the user sets via CMAKE_CXX_FLAGS). This fixes builds with libcxx, with mingw toolchains targeting msvcrt.dll, after 5d8be4c; after that commit, the libcxx public headers reference symbols such as iswspace_l, which are unavailable when targeting msvcrt.dll on older versions of Windows (it's only available in msvcrt.dll since Windows Vista).
1 parent db115ba commit dc3156d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

openmp/runtime/cmake/LibompDefinitions.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ function(libomp_get_definitions_flags cppflags)
1616
libomp_append(cppflags_local "-D _CRT_SECURE_NO_DEPRECATE")
1717
libomp_append(cppflags_local "-D _WINDOWS")
1818
libomp_append(cppflags_local "-D _WINNT")
19-
libomp_append(cppflags_local "-D _WIN32_WINNT=0x0501")
19+
if (MSVC)
20+
# Force a default target OS version with MSVC based toolchains.
21+
# (For MinGW based ones, use the toolchain's default target or what
22+
# the user set in CMake flags.)
23+
libomp_append(cppflags_local "-D _WIN32_WINNT=0x0501")
24+
endif()
2025
libomp_append(cppflags_local "-D _USRDLL")
2126
libomp_append(cppflags_local "-D _ITERATOR_DEBUG_LEVEL=0" IF_TRUE DEBUG_BUILD)
2227
libomp_append(cppflags_local "-D _DEBUG" IF_TRUE DEBUG_BUILD)

0 commit comments

Comments
 (0)