View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012313CMakeModulespublic2011-07-02 17:042011-07-06 16:08
ReporterMourad 
Assigned ToJames Bigler 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionnot fixable 
PlatformOSOS Version
Product VersionCMake 2.8.4 
Target VersionFixed in Version 
Summary0012313: SET_TARGET_PROPERTIES does not add DEFINE_SYMBOL to cuda files build rule
DescriptionI am trying to build a shared cuda library with MSVC and CMake. I want to use a custom DEFINE_SYMBOL, but it doesn't work. When looking into the generated *.cu.obj.cmake file, i can see only the default DEFINE_SYMBOL (-Dmycudalib_EXPORTS).
Steps To Reproduce* add a cuda library :
CUDA_ADD_LIBRARY(mycudalib SHARED file.cu)

* set a custom DEFINE_SYMBOL
SET_TARGET_PROPERTIES(mylib DEFINE_SYMBOL CUSTOM_DEFINE_SYMBOL)
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0027005)
Brad King (manager)
2011-07-04 09:03

As a sanity check on the steps to reproduce, you wrote:

  CUDA_ADD_LIBRARY(mycudalib SHARED file.cu)
  SET_TARGET_PROPERTIES(mylib DEFINE_SYMBOL CUSTOM_DEFINE_SYMBOL)

but the target names do not match: "mycudalib" v. "mylib". I assume you meant them to match?
(0027006)
Mourad (reporter)
2011-07-04 10:04

Yes you are right, the target names are meant to match.

CUDA_ADD_LIBRARY(mycudalib SHARED file.cu)
SET_TARGET_PROPERTIES(mycudalib DEFINE_SYMBOL CUSTOM_DEFINE_SYMBOL)
(0027009)
James Bigler (developer)
2011-07-05 12:25

This will never work with the current implementation.

1. FindCUDA doesn't support setting properties after calls to CUDA_ADD_*, because all the build commands are generated at the call site (configure time) of CUDA_ADD_* and not later (generation time).
2. As far as I know target properties can't be added on targets that don't exist yet, so this turns into a chicken and egg problem. If CMake supported generate time configure files, this might be able to be supported.

I would suggest you set the define as a flag.
CUDA_ADD_LIBRARY(mylib SHARED file.cu OPTIONS -DCUSTOM_DEFINE_SYMBOL)

Please let me know if this work around won't work for you.
(0027014)
Mourad (reporter)
2011-07-06 15:32

Thanks for looking into this. Yes the work around you suggested does work for me.
(0027015)
James Bigler (developer)
2011-07-06 16:08

Thanks for replying Mourad.

 Issue History
Date Modified Username Field Change
2011-07-02 17:04 Mourad New Issue
2011-07-04 09:02 Brad King Assigned To => James Bigler
2011-07-04 09:02 Brad King Status new => assigned
2011-07-04 09:03 Brad King Note Added: 0027005
2011-07-04 10:04 Mourad Note Added: 0027006
2011-07-05 12:25 James Bigler Note Added: 0027009
2011-07-06 15:32 Mourad Note Added: 0027014
2011-07-06 16:08 James Bigler Note Added: 0027015
2011-07-06 16:08 James Bigler Status assigned => closed
2011-07-06 16:08 James Bigler Resolution open => not fixable


Copyright © 2000 - 2018 MantisBT Team