[CMake] Forcing a reload of Visual Studio

Iman Brouwer iman.brouwer at gmail.com
Thu Jun 25 14:04:25 EDT 2009


On Fri, Jun 19, 2009 at 3:04 PM, Tyler Roscoe <tyler at cryptio.net> wrote:

> On Fri, Jun 19, 2009 at 02:07:30PM -0400, Iman Brouwer wrote:
> > ADD_CUSTOM_TARGET( addTargets ${CMAKE_COMMAND} -DBUILD_EXTRA_TARGETS=ON
> > ${CMAKE_SOURCE_DIR} )
> > ADD_CUSTOM_TARGET( removeTargets ${CMAKE_COMMAND}
> -DBUILD_EXTRA_TARGETS=OFF
> > ${CMAKE_SOURCE_DIR} )
> >
> > The 'extra targets' are all added in IF( BUILD_EXTRA_TARGETS ) blocks.
> >
> > Both targets work in the sense that they seem to remove/add targets in
> > visual studio after I close/open the IDE.
> >
> > But the automatic reloading of the IDE seems to happen only the first
> time:
> > - If i build addTargets when the extra targets are not part of the
> solution,
> > the IDE will reload, but if i then build removeTargets, the targets will
> not
> > be removed until i close/open the IDE.
>
> Does CMake delete the generated extra_targets.vcproj when you rerun
> cmake with -DBUILD_EXTRA_TARGETS=OFF? I would not be surprised if the
> .vcproj are left lying around.


Thanks Tyler. I looked into this, and you're right, the *.vcproj files of
the 'removed' targets are still there. However, the references to the
.vcproj files are removed from the .sln file.

I'm not really sure what triggers the reload to happen correctly sometimes
and not other times. For now, we just close/open visual studio. It's not
that elegant but it's not a big problem either.

Iman

Perhaps VS is smart enough to notice when new files appear but not when
> existing files disappear?
>
> I tend to close/reopen VS when making CMake changes anyway because the
> reload macros are quite unreliable for me.
>
> tyler
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090625/a821bf13/attachment.htm>


More information about the CMake mailing list