[CMake] CMake, CUDA, VS build issues

James Bigler jamesbigler at gmail.com
Wed Jan 19 17:14:32 EST 2011


On Fri, Jan 14, 2011 at 11:05 AM, Patrick Charrier <
patrick.charrier at igd.fraunhofer.de> wrote:

> Hi all,
>
> I am experiencing some (random) reloading of VS-project files and
> rebuilding when using the combination of CMake, Visual Studio and CUDA.
>
> Particularly when performing the following steps.
> 1. Project has been built before.
> 2. Perform an SVN update.
> 3. Start CMake. Configure and Generate.
> 4. Open the generated VS Solution.
> 5. Build in Debug Mode. (Or Rebuild All.)
> 6. Build in Release Mode. (Or Rebuild All.)
>
> After Point 6 the fun part starts.
> 7. At this point VS runs CMake Configuration and Generation. Why this in
> the first place?
> 8. VS will then ask to reload the newly generated VS-project files for all
> the CUDA VS-projects (libraries) in the solution.
> 9. I hit yes and the project is being built.
> 10. When trying to start the application, VS will prompt me to reload the
> VS-project files again, as in step 8.
> 11. I hit yes again, but this time VS just says:
> 1>------ Skipped Build: Project: PACKAGE, Configuration: Release Win32
> ------
> 1>Project not selected to build for this solution configuration
> 2>------ Skipped Build: Project: INSTALL, Configuration: Release Win32
> ------
> 2>Project not selected to build for this solution configuration
> ========== Build: 0 succeeded, 0 failed, 7 up-to-date, 2 skipped ==========
>
> The problem only occurs with CUDA and VS from what I know.
> My main question is, why is there a Reconfiguration and Regeneration in
> step 7, and how can I avoid it? There should be no need for it, since step
> 3 should assure that the project files are fresh. Also why did it build
> smoothly in Debug (step 5), but not Release (step 6)?
> Also, what does the second Regenerate in step 11 mean?
>
> My guess is, that step 7 is somehow caused by Debug and Release sharing
> the same CUDA ".depend" and ".cmake" files in the CMakeFiles subdirectory
> of
> each CUDA VS-project. But how exactly, and how could I fix that?
>
> Thank you and Best Regards,
>  Patrick
>
>
This is the expected behavior and is a product of the FindCUDA script's
ability to generate the file level dependencies.  Here's what happens.

1. Start with fresh build directory.  Configure with CMake.  At this point
we don't know that file.cu depends on header.h.  We generate the VS project
file anyway with not dependencies for file.cu.
2. Build your project.  At this point when file.cu is compiled it generates
file.cu.obj.depend which is created with nvcc -M similarly to how gcc -M is
run.  At this point, your configuration is stale, because file.cu.obj.depend
has changed.
3. If you click build or run CMake will want to reconfigure, because
file.cu.obj.depend has changed.
4. When CMake configures again it will generate a new vcproj file listing
header.h as a dependency for file.cu.  If you change header.h, then
file.cuwill automatically be recompiled just as if
file.cu were a C file.
5. Whenever the dependencies of file.cu change, file.cu.obj.depend will
change signaling CMake that it needs to reconfigure the VS project.

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110119/8dba06f1/attachment.htm>


More information about the CMake mailing list