[CMAKE] Add DLL_EXPORT_VERSION config option

Set this to e.g. 0x600 to build with Vista exports
This commit is contained in:
Timo Kreuzer 2023-08-05 14:56:11 +03:00
parent a970c50a83
commit 3c2bfb570f
4 changed files with 15 additions and 7 deletions

View file

@ -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()