diff --git a/CMakeLists.txt b/CMakeLists.txt index 19b3c6b6931..12dd07e5085 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,7 +232,8 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to -D_WIN32_WINNT=0x502 -D_WIN32_WINDOWS=0x502 -D_SETUPAPI_VER=0x502 - -DMINGW_HAS_SECURE_API=1) + -DMINGW_HAS_SECURE_API=1 + -DDLL_EXPORT_VERSION=${DLL_EXPORT_VERSION}) # Arch Options if(ARCH STREQUAL "i386") diff --git a/sdk/cmake/config.cmake b/sdk/cmake/config.cmake index 5e6243dd35a..77b26a0383e 100644 --- a/sdk/cmake/config.cmake +++ b/sdk/cmake/config.cmake @@ -114,3 +114,6 @@ endif() set(USE_DUMMY_PSEH FALSE CACHE BOOL "Whether to disable PSEH support.") + +set(DLL_EXPORT_VERSION "0x502" CACHE STRING +"The NT version the user mode DLLs target.") diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake index 03b481b0140..a4a013ed6a0 100644 --- a/sdk/cmake/gcc.cmake +++ b/sdk/cmake/gcc.cmake @@ -345,11 +345,11 @@ function(fixup_load_config _target) DEPENDS native-pefixup) endfunction() -function(generate_import_lib _libname _dllname _spec_file) +function(generate_import_lib _libname _dllname _spec_file __version_arg) # Generate the def for the import lib add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def - COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + COMMAND native-spec2def ${__version_arg} -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) # With this, we let DLLTOOL create an import library @@ -415,6 +415,8 @@ function(spec2def _dllname _spec_file) if(__spec2def_VERSION) set(__version_arg "--version=0x${__spec2def_VERSION}") + else() + set(__version_arg "--version=${DLL_EXPORT_VERSION}") endif() # Generate exports def and C stubs file for the DLL @@ -429,7 +431,7 @@ function(spec2def _dllname _spec_file) set(_extraflags --no-private-warnings) endif() - generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags}) + generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags} "${__version_arg}") endif() endfunction() diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index 3981715190b..8dcfc8d43cc 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -312,7 +312,7 @@ function(fixup_load_config _target) # msvc knows how to generate a load_config so no hacks here endfunction() -function(generate_import_lib _libname _dllname _spec_file) +function(generate_import_lib _libname _dllname _spec_file __version_arg) set(_def_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def) set(_asm_stubs_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_stubs.asm) @@ -320,7 +320,7 @@ function(generate_import_lib _libname _dllname _spec_file) # Generate the def and asm stub files add_custom_command( OUTPUT ${_asm_stubs_file} ${_def_file} - COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + COMMAND native-spec2def --ms ${__version_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) # Compile the generated asm stub file @@ -386,6 +386,8 @@ function(spec2def _dllname _spec_file) if(__spec2def_VERSION) set(__version_arg "--version=0x${__spec2def_VERSION}") + else() + set(__version_arg "--version=${DLL_EXPORT_VERSION}") endif() # Generate exports def and C stubs file for the DLL @@ -395,7 +397,7 @@ function(spec2def _dllname _spec_file) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) if(__spec2def_ADD_IMPORTLIB) - generate_import_lib(lib${_file} ${_dllname} ${_spec_file}) + generate_import_lib(lib${_file} ${_dllname} ${_spec_file} "${__version_arg}") if(__spec2def_NO_PRIVATE_WARNINGS) set_property(TARGET lib${_file} APPEND PROPERTY STATIC_LIBRARY_OPTIONS /ignore:4104) endif()