[CMake] FindCUDA ignores project dependencies when separable compilation is on
James Bigler
jamesbigler at gmail.com
Tue Jan 6 12:22:40 EST 2015
I meant putting messages into FindCUDA.cmake itself.
Only certain flags are propagated for the intermediate link file
compilation, because I've had a lot of trouble over the years for
propagating all the host flags. This set of flags is filtered by the
function _cuda_get_important_host_flags. Right now only the
CMAKE_CXX_FLAGS_*CONFIG* are being processed. None of the flags in the
configuration free variable are passed. That was the "patch" I wanted you
to try. Why -fPIC in the configuration specific CMAKE_CXX_FLAGS wasn't
working, I'm not sure. The code is there to do it.
On Tue, Jan 6, 2015 at 10:05 AM, Irwin Zaid <irwin.zaid at physics.ox.ac.uk>
wrote:
> Right, when I modify FindCUDA.cmake as you describe everything works. So
> that's good.
>
> Without doing that, I still don't see CMAKE_CXX_FLAGS_DEBUG propagating
> its flags to the intermediate link file. Did you mean to put message
> commands into CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS itself? When I put
> them into my main CMakeLists.txt, nothing is printed for ${nvcc_flags} or
> the other variables.
>
> James Bigler wrote:
>
>> On Tue, Jan 6, 2015 at 8:54 AM, Irwin Zaid <irwin.zaid at physics.ox.ac.uk
>> <mailto:irwin.zaid at physics.ox.ac.uk>> wrote:
>>
>> Okay, an update on this.
>>
>> 2) This is trickier and, unfortunately, still not working. We are
>> already adding -fPIC to CMAKE_CXX_FLAGS, should that not be
>> enough? I also tried adding it to both CMAKE_CXX_FLAGS_DEBUG and
>> CMAKE_CXX_FLAGS_RELEASE, with no effect.
>>
>> Looking into FindCUDA.CMake at
>> CUDA_LINK_SEPARABLE___COMPILATION_OBJECTS, I find code very
>> similar to what you are describing. Are you saying that in
>> addition to what is below, we need to add what you proposed? This
>> is what I see.
>>
>> --
>>
>>
>> It can be put here (before this foreach).
>>
>> foreach(config ${CUDA_configuration_types})
>> string(TOUPPER ${config} config_upper)
>> # Add config specific flags
>> foreach(f ${CUDA_NVCC_FLAGS_${config___upper}})
>> list(APPEND config_specific_flags $<$<CONFIG:${config}>:${f}>)
>> endforeach()
>> set(important_host_flags)
>> _cuda_get_important_host___flags(important_host_flags
>> ${CMAKE_${CUDA_C_OR_CXX}___FLAGS_${config_upper}})
>> foreach(f ${important_host_flags})
>> list(APPEND flags $<$<CONFIG:${config}>:-__Xcompiler>
>> $<$<CONFIG:${config}>:${f}>)
>> endforeach()
>> endforeach()
>>
>>
>> Or it can be put here (or after the foreach).
>>
>> I'm concerned that the flag didn't show up after adding it to the _DEBUG
>> or _RELEASE variants. If you could add a few message commands around that
>> might help see what is going on. The flag needs to be propagated.
>>
>> You could sprinkle a few commands like this:
>> message("going to run COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags}
>> -dlink ${object_files} -o ${output_file}
>> ${flags}")
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150106/4989ddf5/attachment-0001.html>
More information about the CMake
mailing list