Skip to content

Commit 65ef8ec

Browse files
committed
MDEV-12207 Include windows compatibility manifest into executable to make GetVersionEx work correctly
1 parent f65c9f8 commit 65ef8ec

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

cmake/mysql_add_executable.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
3838

3939
SET(sources ${ARG_DEFAULT_ARGS})
4040
ADD_VERSION_INFO(${target} EXECUTABLE sources)
41+
42+
IF(MSVC)
43+
# Add compatibility manifest, to fix GetVersionEx on Windows 8.1 and later
44+
IF (CMAKE_VERSION VERSION_GREATER 3.3)
45+
SET(sources ${sources} ${PROJECT_SOURCE_DIR}/cmake/win_compatibility.manifest)
46+
ENDIF()
47+
ENDIF()
48+
4149
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
4250
# tell CPack where to install
4351
IF(NOT ARG_EXCLUDE_FROM_ALL)

cmake/win_compatibility.manifest

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
4+
<application>
5+
<!-- Windows Vista and Windows Server 2008 -->
6+
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
7+
8+
<!-- Windows 7 and Windows Server 2008 R2 -->
9+
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
10+
11+
<!-- Windows 8 and Windows Server 2012 -->
12+
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
13+
14+
<!-- Windows 8.1 and Windows Server 2012 R2 -->
15+
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
16+
17+
<!-- Windows 10 -->
18+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
19+
20+
</application>
21+
</compatibility>
22+
</asmv1:assembly>

0 commit comments

Comments
 (0)