MantisBT - CMake
View Issue Details
0014094CMakeModulespublic2013-04-17 04:082014-02-19 11:14
Marcel Loose 
Robert Maynard 
normalminoralways
closedfixed 
LinuxUbuntu 12.10
CMake 2.8.9 
CMake 2.8.12 
0014094: FindCUDA: Marco CUDA_WRAP_SRCS does not de-duplicate entries in CUDA_NVCC_INCLUDE_DIRECTORIES
As of CMake 2.8.8, the INCLUDE_DIRECTORIES() command does not de-duplicate entries. Failure to do so can lead to an extremely long and repetitive list of -I entries on the command line.
1. Make sure you're using cmake 2.8.8 or later
2. Deliberately add duplicate entries using INCLUDE_DIRECTORIES in your project.
3. Add a CUDA executable using CUDA_ADD_EXECUTABLE.
4. Run 'make' with verbose output and check the command line passed to nvcc.
The attached simple patch solves this issue and should not cause any problems with older cmake versions. The patch is against the cmake 2.8.9 release.
No tags attached.
related to 0012198closed James Bigler FindCUDA.cmake, INCLUDE_DIRECTORIES, The command line is too long. 
related to 0014758closed Kitware Robot Delayed de-duplication of include directories may cause huge memory usage 
patch FindCUDA.cmake.patch (668) 2013-04-17 04:08
https://public.kitware.com/Bug/file/4741/FindCUDA.cmake.patch
Issue History
2013-04-17 04:08Marcel LooseNew Issue
2013-04-17 04:08Marcel LooseFile Added: FindCUDA.cmake.patch
2013-04-17 04:10Marcel LooseSummaryMarco CUDA_WRAP_SRCS does not de-duplicate entries in CUDA_NVCC_INCLUDE_DIRECTORIES => FindCUDA: Marco CUDA_WRAP_SRCS does not de-duplicate entries in CUDA_NVCC_INCLUDE_DIRECTORIES
2013-04-17 04:11Marcel LooseRelationship addedrelated to 0012198
2013-04-17 08:25Brad KingNote Added: 0032857
2013-04-17 09:11Robert MaynardAssigned To => Robert Maynard
2013-04-17 09:11Robert MaynardStatusnew => assigned
2013-04-17 10:06Marcel LooseNote Added: 0032891
2013-04-17 10:20Brad KingNote Added: 0032894
2013-04-17 10:23Brad KingNote Added: 0032895
2013-04-18 15:12Robert MaynardStatusassigned => acknowledged
2013-05-24 09:37Robert MaynardStatusacknowledged => resolved
2013-05-24 09:37Robert MaynardFixed in Version => CMake 2.8.12
2013-05-24 09:37Robert MaynardResolutionopen => fixed
2013-10-07 10:09Robert MaynardNote Added: 0034061
2013-10-07 10:09Robert MaynardStatusresolved => closed
2014-02-19 11:14David ColeRelationship addedrelated to 0014758

Notes
(0032857)
Brad King   
2013-04-17 08:25   
Did CMake < 2.8.8 remove duplicate include directories automatically? The behavior may have changed when the per-target INCLUDE_DIRECTORIES property was added.
(0032891)
Marcel Loose   
2013-04-17 10:06   
Yes it did. See http://www.cmake.org/pipermail/cmake/2013-April/054398.html. [^]
It could be that per-target INCLUDE_DIRECTORIES changed that behaviour.
(0032894)
Brad King   
2013-04-17 10:20   
For reference:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/46307 [^]
(0032895)
Brad King   
2013-04-17 10:23   
Re 0014094:0032891: Okay, as discussed in that thread the de-duplication was moved to generate time. Now in 2.8.11 that is even more necessary because generator expressions can now appear in INCLUDE_DIRECTORIES so we do not even know the whole list of values until generate time.

I think the patch looks like a good solution for now. More work may be needed to support projects that make use of generator expressions in INCLUDE_DIRECTORIES.
(0034061)
Robert Maynard   
2013-10-07 10:09   
Closing resolved issues that have not been updated in more than 4 months.