[cmake-developers] [PATCH] FindCUDA: Wrap keyword in if() string comparison

Rolf Eike Beer eike at sf-mail.de
Wed Sep 17 08:37:30 EDT 2014


Am 17.09.2014 13:54, schrieb Adam Strzelecki:
> This silents possible CMP0054 related warnings.
> ---
>  Modules/FindCUDA.cmake          | 14 +++++++-------
>  Modules/FindCUDA/run_nvcc.cmake |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
> index 9348aa5..2e2b21c 100644
> --- a/Modules/FindCUDA.cmake
> +++ b/Modules/FindCUDA.cmake
> @@ -894,15 +894,15 @@ macro(CUDA_GET_SOURCES_AND_OPTIONS _sources
> _cmake_options _options)
>    set( ${_options} )
>    set( _found_options FALSE )
>    foreach(arg ${ARGN})
> -    if(arg STREQUAL "OPTIONS")
> +    if("x${arg}" STREQUAL "xOPTIONS")

[...]

Wait, what? This is actually the opposite of what that policy is for, 
no? Adam, I don't blame you, just to get that said first. The question 
is: does this policy warning trigger far too often?

What one actually wants is to write

   if(arg STREQUAL "OPTIONS")

i.e. arg will get expanded, "OPTIONS" not. Changing everything away from 
that pattern will in fact make things worse, and will not help you if I 
introduce an xOPTION variable now. So, is this warning too noisy or are 
we doing something fundamentally wrong?

Eike



More information about the cmake-developers mailing list