[CMake] Question about install()

Robert Dailey rcdailey at gmail.com
Tue Dec 9 17:42:22 EST 2008


On Tue, Dec 9, 2008 at 4:33 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> On Tue, Dec 9, 2008 at 4:25 PM, Bill Hoffman <bill.hoffman at kitware.com>wrote:
>
>> Robert Dailey wrote:
>>
>>
>>> After much research, I've found out that CMake cannot provide a custom
>>> command (Post build event) to a specific configuration in the case where
>>> CMake is used to generate a multi-configuration target, such as a visual
>>> studio project. This is a HUGE problem for me. Are there any work-arounds
>>> for this issue? Does this issue plan to be addressed in a future release
>>> (Hopefully soon)?
>>>
>>>
>> Exactly what are you trying to copy?  I might be able to figure out a
>> workaround if I had a better idea of what you were doing.
>>
>> (please keep the example  small... :)  )
>
>
> Sure. Sorry for the lack of details.
>
> I have a directory that contains DLL files that I need to copy to the
> directory at which my executable is built. However, the DLL files that I
> copy over are different depending on the configuration that was used to
> build the executable. For example, if I've built my executable using the
> DEBUG configuration, I need to copy over DLL files named foo_d.dll,
> bar_d.dll. If RELEASE was used to build the executable, then I need to copy
> over foo.dll and bar.dll. Since the debug/release executables are placed in
> different directories by CMake when they are built, the destination location
> for the DLLs also changes across configurations as well.
>

I actually did a little thinking and I came up with this:

        add_custom_command( TARGET ${component_project_name}
            POST_BUILD
            COMMAND "depends.py" ARGS "$(ConfigurationName)"
            )

Of course this only works for visual studio projects, but it does accomplish
what I want. The only downside is that I have to put the DLL copy logic in
the python script instead of keeping it centralized within CMake.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081209/06da084d/attachment.htm>


More information about the CMake mailing list