[CMAKE]: Correctly set valid PE image version numbers for the OS subsystem (GCC build...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 13 Jul 2017 20:50:49 +0000 (20:50 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 13 Jul 2017 20:50:49 +0000 (20:50 +0000)
svn path=/trunk/; revision=75333

reactos/sdk/cmake/CMakeMacros.cmake
reactos/sdk/cmake/gcc.cmake

index 8af76ea..850bb7f 100644 (file)
@@ -581,12 +581,20 @@ function(set_module_type MODULE TYPE)
         set_subsystem(${MODULE} ${__subsystem})
     endif()
 
-    #set unicode definitions
+    # Set the PE image version numbers from the NT OS version ReactOS is based on
+    if (MSVC)
+        add_target_link_flags(${MODULE} "/VERSION:5.01")
+    else()
+        add_target_link_flags(${MODULE} "-Wl,--major-image-version,5 -Wl,--minor-image-version,01")
+        add_target_link_flags(${MODULE} "-Wl,--major-os-version,5 -Wl,--minor-os-version,01")
+    endif()
+
+    # Set unicode definitions
     if(__module_UNICODE)
         add_target_compile_definitions(${MODULE} UNICODE _UNICODE)
     endif()
 
-    # set entry point
+    # Set entry point
     if(__module_ENTRYPOINT OR (__module_ENTRYPOINT STREQUAL "0"))
         list(GET __module_ENTRYPOINT 0 __entrypoint)
         list(LENGTH __module_ENTRYPOINT __length)
@@ -633,7 +641,7 @@ function(set_module_type MODULE TYPE)
         endif()
     endif()
 
-    #set base address
+    # Set base address
     if(__module_IMAGEBASE)
         set_image_base(${MODULE} ${__module_IMAGEBASE})
     elseif(${TYPE} STREQUAL win32dll)
@@ -662,7 +670,7 @@ function(set_module_type MODULE TYPE)
         set_target_properties(${MODULE} PROPERTIES SUFFIX ".cpl")
     endif()
 
-    # do compiler specific stuff
+    # Do compiler specific stuff
     set_module_type_toolchain(${MODULE} ${TYPE})
 endfunction()
 
index 375405a..41d6a72 100644 (file)
@@ -289,7 +289,7 @@ function(set_entrypoint MODULE ENTRYPOINT)
 endfunction()
 
 function(set_subsystem MODULE SUBSYSTEM)
-    add_target_link_flags(${MODULE} "-Wl,--subsystem,${SUBSYSTEM}")
+    add_target_link_flags(${MODULE} "-Wl,--subsystem,${SUBSYSTEM}:5.01")
 endfunction()
 
 function(set_image_base MODULE IMAGE_BASE)