Could someone please explain to me why we need to change all the if statements to look super ugly?
Expanding "WIN32" to dereference the value is just a recipe for confusion. Honestly I would prefer if there was a policy to never deference variables in if statements and replace the if's with: if ("${arg}" STREQAL "WIN32") This way there isn't any trickery involved with whether "WIN32" is string or a variable. By the way creating a variable that has the same string as arguments to command (see add_executable) is an unfortunate dirtying of the language ("WIN32" is a variable here, but over here it's an argument e.g. string). James On Wed, Sep 17, 2014 at 5:54 AM, Adam Strzelecki <o...@java.pl> wrote: > 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") > set( _found_options TRUE ) > elseif( > - arg STREQUAL "WIN32" OR > - arg STREQUAL "MACOSX_BUNDLE" OR > - arg STREQUAL "EXCLUDE_FROM_ALL" OR > - arg STREQUAL "STATIC" OR > - arg STREQUAL "SHARED" OR > - arg STREQUAL "MODULE" > + "x${arg}" STREQUAL "xWIN32" OR > + "x${arg}" STREQUAL "xMACOSX_BUNDLE" OR > + "x${arg}" STREQUAL "xEXCLUDE_FROM_ALL" OR > + "x${arg}" STREQUAL "xSTATIC" OR > + "x${arg}" STREQUAL "xSHARED" OR > + "x${arg}" STREQUAL "xMODULE" > ) > list(APPEND ${_cmake_options} ${arg}) > else() > diff --git a/Modules/FindCUDA/run_nvcc.cmake > b/Modules/FindCUDA/run_nvcc.cmake > index 58e0d31..abdd307 100644 > --- a/Modules/FindCUDA/run_nvcc.cmake > +++ b/Modules/FindCUDA/run_nvcc.cmake > @@ -126,7 +126,7 @@ endif() > # and other return variables are present after executing the process. > macro(cuda_execute_process status command) > set(_command ${command}) > - if(NOT _command STREQUAL "COMMAND") > + if(NOT "x${_command}" STREQUAL "xCOMMAND") > message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing > COMMAND as second argument. (command = ${command})") > endif() > if(verbose) > -- > 1.9.3 (Apple Git-50) > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake-developers >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers