exports: Fix module definition file for MinGW/MSYS
GNU linkers expect it to be passed as an object file. This is
described in the ld man page [1]:
> In addition, the linker fully supports the standard "*.def" files,
> which may be specified on the linker command line like an object
> file (in fact, it should precede archives it exports symbols from,
> to ensure that they get linked in, just like a normal object file).
I've verified this to be the case in the MSYS2 CLANG64, UCRT64 and
MINGW32 flavors.
Alternatively, one could modify the version script generator to output a
GNU-format version script if AOM_TARGET_SYSTEM=Windows and
AOM_MSVC=FALSE, but this was the smaller approach.
[1]: https://linux.die.net/man/1/ld
Change-Id: I51d24fb623419647929470474fee591579795b57
diff --git a/build/cmake/exports.cmake b/build/cmake/exports.cmake
index 3fcdd0c..1cea2b5 100644
--- a/build/cmake/exports.cmake
+++ b/build/cmake/exports.cmake
@@ -61,11 +61,13 @@
APPEND_STRING
PROPERTY LINK_FLAGS "/DEF:${aom_sym_file}")
else()
- target_sources(aom PRIVATE "${aom_sym_file}")
+ # For MinGW and MSYS compilers, you can use either version scripts or
+ # module definition files. If the latter, it must be supplied as an
+ # "object".
+ set_property(TARGET aom
+ APPEND_STRING
+ PROPERTY LINK_FLAGS "${aom_sym_file}")
endif()
-
- # TODO(tomfinegan): Sort out the import lib situation and flags for MSVC.
-
else()
set_property(TARGET aom
APPEND_STRING