[CMake] MODULE_LIBRARY targets not copied to RUNTIME_OUTPUT_DIRECTORY (on 2.6.0 RC9)

Brad King brad.king at kitware.com
Wed Apr 30 09:27:21 EDT 2008


Philip Lowman wrote:
> I noticed testing tonight with CMake 2.6.0 RC9 that MODULE_LIBRARY 
> targets (i.e. DLL plugins under Windows) are NOT copied to the 
> RUNTIME_OUTPUT_DIRECTORY.  Is this a bug?
> 
> I thought the impetus for the CMAKE_RUNTIME_OUTPUT_DIRECTORY feature was 
> to get all DLLs dumped into a single directory so developers wouldn't 
> have to concoct custom POST BUILD rules or modify PATH environment 
> variables prior to runtime?

This was the reason, but the behavior is also not a bug.  On Windows the 
LIBRARY_OUTPUT_DIRECTORY is not actually used for anything except MODULE 
libraries.  The .lib part of a SHARED library goes to the 
ARCHIVE_OUTPUT_DIRECTORY and the .dll part goes to the 
RUNTIME_OUTPUT_DIRECTORY.  In the case of a MODULE library there is no 
.lib part because nothing is supposed to link to it.  Therefore to 
provide more granularity we decided to use LIBRARY_OUTPUT_DIRECTORY for 
modules.

In many cases the .dll for a module is stand-alone and meant for loading 
only by an executable via LoadLibrary.  In these cases it would go to a 
separate plugins directory or something like that.  If you want the .dll 
for a MODULE library to go to the RUNTIME_OUTPUT_DIRECTORY, just set the 
LIBRARY_OUTPUT_DIRECTORY to point at the same place.

-Brad


More information about the CMake mailing list