[CMake] How can I compile and link modular code into a single DLL with MSVC?

Jason Heeris jason.heeris at gmail.com
Thu Jun 28 06:14:02 EDT 2018


On Thu, 28 Jun 2018 at 08:18, Jason Heeris <jason.heeris at gmail.com> wrote:
> > If those modules are not intended to be used outside of the final
shader library, then why not to make them static libraries?
> I'll test it on the real thing and see how that goes. The only problem I
encountered was that the final shared library complains about having "NO
SOURCES given to target: module3_dll". I can add "module3.c" as a source,
even though technically the static lib should already contain everything
from there. I'm not sure why that's an issue though.

So I went and tried this on the real project, and it seems like compiling
the static libs into a DLL doesn't give the same results as using the obj
files directly, as per my initial list of commands. Namely, some symbols
seem to not be getting exported, and some flags are mismatched between
compiler and linker. It *could* be due to certain compiler flags, which
I've raised in another thread. But I need to either add some test code to
my sample project that loads and uses the DLL to demonstrate what's wrong,
or identify what's different in the real project that's causing this.

It'd be nice if there were a way to get CMake to traverse the dependency
graph and just apply specific build commands to each module, even just to
debug exactly where this is going wrong, but I don't think I'm up for that
challenge just yet.

Cheers,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180628/cd06851f/attachment.html>


More information about the CMake mailing list