[CMake] Forcing a reload of Visual Studio

Tyler Roscoe tyler at cryptio.net
Fri Jun 19 15:04:26 EDT 2009


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.

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


More information about the CMake mailing list