Skip to content

Commit 3c2bfb5

Browse files
committed
[CMAKE] Add DLL_EXPORT_VERSION config option
Set this to e.g. 0x600 to build with Vista exports
1 parent a970c50 commit 3c2bfb5

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
232232
-D_WIN32_WINNT=0x502
233233
-D_WIN32_WINDOWS=0x502
234234
-D_SETUPAPI_VER=0x502
235-
-DMINGW_HAS_SECURE_API=1)
235+
-DMINGW_HAS_SECURE_API=1
236+
-DDLL_EXPORT_VERSION=${DLL_EXPORT_VERSION})
236237

237238
# Arch Options
238239
if(ARCH STREQUAL "i386")

sdk/cmake/config.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,6 @@ endif()
114114

115115
set(USE_DUMMY_PSEH FALSE CACHE BOOL
116116
"Whether to disable PSEH support.")
117+
118+
set(DLL_EXPORT_VERSION "0x502" CACHE STRING
119+
"The NT version the user mode DLLs target.")

sdk/cmake/gcc.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ function(fixup_load_config _target)
345345
DEPENDS native-pefixup)
346346
endfunction()
347347

348-
function(generate_import_lib _libname _dllname _spec_file)
348+
function(generate_import_lib _libname _dllname _spec_file __version_arg)
349349
# Generate the def for the import lib
350350
add_custom_command(
351351
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def
352-
COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
352+
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}
353353
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
354354

355355
# With this, we let DLLTOOL create an import library
@@ -415,6 +415,8 @@ function(spec2def _dllname _spec_file)
415415

416416
if(__spec2def_VERSION)
417417
set(__version_arg "--version=0x${__spec2def_VERSION}")
418+
else()
419+
set(__version_arg "--version=${DLL_EXPORT_VERSION}")
418420
endif()
419421

420422
# Generate exports def and C stubs file for the DLL
@@ -429,7 +431,7 @@ function(spec2def _dllname _spec_file)
429431
set(_extraflags --no-private-warnings)
430432
endif()
431433

432-
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags})
434+
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags} "${__version_arg}")
433435
endif()
434436
endfunction()
435437

sdk/cmake/msvc.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,15 @@ function(fixup_load_config _target)
312312
# msvc knows how to generate a load_config so no hacks here
313313
endfunction()
314314

315-
function(generate_import_lib _libname _dllname _spec_file)
315+
function(generate_import_lib _libname _dllname _spec_file __version_arg)
316316

317317
set(_def_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def)
318318
set(_asm_stubs_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_stubs.asm)
319319

320320
# Generate the def and asm stub files
321321
add_custom_command(
322322
OUTPUT ${_asm_stubs_file} ${_def_file}
323-
COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
323+
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}
324324
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
325325

326326
# Compile the generated asm stub file
@@ -386,6 +386,8 @@ function(spec2def _dllname _spec_file)
386386

387387
if(__spec2def_VERSION)
388388
set(__version_arg "--version=0x${__spec2def_VERSION}")
389+
else()
390+
set(__version_arg "--version=${DLL_EXPORT_VERSION}")
389391
endif()
390392

391393
# Generate exports def and C stubs file for the DLL
@@ -395,7 +397,7 @@ function(spec2def _dllname _spec_file)
395397
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
396398

397399
if(__spec2def_ADD_IMPORTLIB)
398-
generate_import_lib(lib${_file} ${_dllname} ${_spec_file})
400+
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} "${__version_arg}")
399401
if(__spec2def_NO_PRIVATE_WARNINGS)
400402
set_property(TARGET lib${_file} APPEND PROPERTY STATIC_LIBRARY_OPTIONS /ignore:4104)
401403
endif()

0 commit comments

Comments
 (0)