[cmake-developers] patch for FindCUDA.cmake
Hi, The FindCUDA.cmake module since v3.0 has had a bug because it assumes that when cross compiling that CMAKE_SYSTEM_PROCESSOR will be defined. That definition is documented as optional at http://www.vtk.org/Wiki/CMake_Cross_Compiling, and the module can't work if it happens to be undefined. Attached patch wraps the uses of CMAKE_SYSTEM_PROCESSOR in quotes so that interpolation will lead to the intended behaviour in all cases. I haven't filed a bug report, per http://www.cmake.org/Wiki/CMake_FAQ#I_found_a_Bug.21_What_should_I_do.3F Thanks, Mark From ff32fca999767e57b48ec68c30b093207c560a2f Mon Sep 17 00:00:00 2001 From: Mark Abraham mark.j.abra...@gmail.com Date: Sun, 4 Jan 2015 14:37:51 +0100 Subject: [PATCH] Fix FindCUDA.cmake assumption about cross-compiling CMAKE_SYSTEM_PROCESSOR is not guaranteed to be defined (per http://www.vtk.org/Wiki/CMake_Cross_Compiling), and when cross compiling where it happens to be undefined, this module was broken. --- Modules/FindCUDA.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 29bb875..55b868e 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -613,7 +613,7 @@ endif() set(CUDA_VERSION_STRING ${CUDA_VERSION}) # Support for arm cross compilation with CUDA 5.5 -if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm AND EXISTS ${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf) +if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm AND EXISTS ${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf) set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf CACHE PATH Toolkit target location.) else() set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH Toolkit target location.) @@ -621,7 +621,7 @@ endif() mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR) # Target CPU architecture -if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm) +if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm) set(_cuda_target_cpu_arch_initial ARM) else() set(_cuda_target_cpu_arch_initial ) -- 2.2.1 -- 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
Re: [cmake-developers] patch for FindCUDA.cmake
Mark Abraham wrote: Hi, The FindCUDA.cmake module since v3.0 has had a bug because it assumes that when cross compiling that CMAKE_SYSTEM_PROCESSOR will be defined. That definition is documented as optional at http://www.vtk.org/Wiki/CMake_Cross_Compiling, and the module can't work if it happens to be undefined. Attached patch wraps the uses of CMAKE_SYSTEM_PROCESSOR in quotes so that interpolation will lead to the intended behaviour in all cases. The easier and better fix would be to just remove the dereference, i.e. if (… CMAKE_SYSTEM_PROCESSOR MATCHES arm …) Eike -- signature.asc Description: This is a digitally signed message part. -- 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
Re: [cmake-developers] patch for FindCUDA.cmake
On Sun, Jan 4, 2015 at 3:02 PM, Rolf Eike Beer e...@sf-mail.de wrote: Mark Abraham wrote: Hi, The FindCUDA.cmake module since v3.0 has had a bug because it assumes that when cross compiling that CMAKE_SYSTEM_PROCESSOR will be defined. That definition is documented as optional at http://www.vtk.org/Wiki/CMake_Cross_Compiling, and the module can't work if it happens to be undefined. Attached patch wraps the uses of CMAKE_SYSTEM_PROCESSOR in quotes so that interpolation will lead to the intended behaviour in all cases. The easier and better fix would be to just remove the dereference, i.e. if (… CMAKE_SYSTEM_PROCESSOR MATCHES arm …) Hi, True, once you look at the minutae of if(... MATCHES ...) :-) Updated patch attached. Mark Eike -- From cc313f608775d4c3f68c0a106a3054aa3f7a7075 Mon Sep 17 00:00:00 2001 From: Mark Abraham mark.j.abra...@gmail.com Date: Sun, 4 Jan 2015 14:37:51 +0100 Subject: [PATCH] Fix FindCUDA.cmake assumption about cross-compiling CMAKE_SYSTEM_PROCESSOR is not guaranteed to be defined (per http://www.vtk.org/Wiki/CMake_Cross_Compiling), and when cross compiling where it happens to be undefined, this module was broken. --- Modules/FindCUDA.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 29bb875..ecfc781 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -613,7 +613,7 @@ endif() set(CUDA_VERSION_STRING ${CUDA_VERSION}) # Support for arm cross compilation with CUDA 5.5 -if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm AND EXISTS ${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf) +if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES arm AND EXISTS ${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf) set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf CACHE PATH Toolkit target location.) else() set(CUDA_TOOLKIT_TARGET_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH Toolkit target location.) @@ -621,7 +621,7 @@ endif() mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR) # Target CPU architecture -if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm) +if(CUDA_VERSION VERSION_GREATER 5.0 AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES arm) set(_cuda_target_cpu_arch_initial ARM) else() set(_cuda_target_cpu_arch_initial ) -- 2.2.1 -- 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
[cmake-developers] [CMake 0015335]: if () evaluates to FALSE for quoted constants/variables where the contents are non-null and not defined constants
The following issue has been SUBMITTED. == http://public.kitware.com/Bug/view.php?id=15335 == Reported By:Brian Chojnowski Assigned To: == Project:CMake Issue ID: 15335 Category: CMake Reproducibility:always Severity: major Priority: normal Status: new == Date Submitted: 2015-01-04 21:19 EST Last Modified: 2015-01-04 21:19 EST == Summary:if () evaluates to FALSE for quoted constants/variables where the contents are non-null and not defined constants Description: An if statement should evaluate to TRUE if the variable is not-null and is not a defined false constant. From the documentation: if(constant) True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND. Named boolean constants are case-insensitive. If the argument is not one of these constants, it is treated as a variable. if(variable) True if the variable is defined to a value that is not a false constant. False otherwise. (Note macro arguments are not variables.) Steps to Reproduce: set(myvar not a false constant) message(STATUS myvar=${myvar}) if(myvar) message(STATUS un quoted variable name = TRUE) endif() if(${myvar}) message(STATUS un quoted variable contents = TRUE) endif() if(${myvar}) message(STATUS quoted variable = TRUE) endif() Output: Eclipse version is set to 4.4 (). Adjust CMAKE_ECLIPSE_VERSION if this is wrong. myvar=test string un quoted variable name = TRUE Configuring done == Issue History Date ModifiedUsername FieldChange == 2015-01-04 21:19 Brian ChojnowskiNew Issue == -- 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