[CMake] Setting compile defs with: Cuda, add_subdirectory, and set_target_properties (COMPILE_DEFINITIONS)

Brian Davis bitminer at gmail.com
Tue Aug 17 11:08:44 EDT 2010


> You are getting the correct output.  Look at the flags and target files
> more closely:
>

Yes I know it is working.  It was working in the prior email where I
exclaimed "Yippie".  I was just wondering if there was anything else I
should be aware of and I was not sure if I was clear in conveying in my use
of CUDA_ATTACH_VS_BUILD_RULE_TO_
CUDA_FILE.  I have to turn it off and it works with it off.

--snip--
Anyway, you should be turning that off if you are reusing the same file in
muliple projects in the same directory like you are doing.
--endsnip--

I am and it is working.  It is not clear to me still why it would be a
problem with parallel builds due to the target object naming convention you
have used as stated in:

--snip --
Yup, I just build file names by appending/prepending things:
<target>_generated_<filename>.<target_type>.depend.tmp.  The .depend file is
the dependency file used to track dependencies, and the tmp version is what
nvcc generates.  I then use a copy_if_different command, so that the
dependency file only gets its timestamp updated if it actually changes.  GCC
-M only writes to the dependency file if it changes, but nvcc -M always
write to it, so I have to emulate this behavior myself.
  --end snip--

--snip--
This is probably historical reasons.  It's been that way as long as I've
been using CMake (since v. 1.6).
--end snip--

A case in point that humanity never learns from past mistakes :-).  I realy
wish CMake would break from this convention.

--snip--



OK, specify the same flags for all the configurations isn't wrong, per se,
but it is overly verbose.  Any flags you want applied to all configurations
can be placed directly after the OPTIONS flag and before any configuration
specific options.  CMake has CMAKE_CXX_FLAGS that get applied to all CXX
files, and CMAKE_CXX_FLAGS_<CONFIG> that get applied only in the specified
configuration.  This is mirrored in the options:

OPTIONS <all config options>
DEBUG <debug config options>
RELEASE <release config options>
...
--end snip

Ok I will switch to less verbose.  Thanks again for the help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100817/2345dacd/attachment-0001.htm>


More information about the CMake mailing list