[cmake-developers] [CMake 0016096]: FindCUDA requires dynamic runtime even if building statically

2016-05-06 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://cmake.org/Bug/view.php?id=16096 
== 
Reported By:Ryan Desmond
Assigned To:
== 
Project:CMake
Issue ID:   16096
Category:   CMake
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2016-05-06 15:03 EDT
Last Modified:  2016-05-06 15:03 EDT
== 
Summary:FindCUDA requires dynamic runtime even if building
statically
Description: 
In
https://gitlab.kitware.com/cmake/cmake/commit/7fea2b77df2d70283f4918a8ff52836dbc68db6b,
support was added to use the static CUDA libraries.  The script still checks for
and requires that the dynamic libraries are installed in order to build
successfully, though they are not needed for a static build.

Steps to Reproduce: 
 - Setup a machine on which to use build CUDA, which has the static libraries
available
 - Remove or delete cudart.so
 - Create a cmake script with `find_package(CUDA REQUIRED)`
 - When run, the script will fail with:

CMake Error at
/usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148
(message):
  Could NOT find CUDA (missing: CUDA_CUDART_LIBRARY) (found version "7.5")
Call Stack (most recent call first):
  /usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388
(_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.5/Modules/FindCUDA.cmake:949
(find_package_handle_standard_args)
  imagery/CMakeLists.txt:43 (find_package)


Additional Information: 

The dynamic library is located at:

 725 cuda_find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\"
library")

The static library is located at:

 734   cuda_find_library_local_first(CUDA_cudart_static_LIBRARY cudart_static
"static CUDA runtime library")

Later in the script, the variable for the dynamic library is required, even if
the library itself is not required for a successful build.

 950 find_package_handle_standard_args(CUDA
 951   REQUIRED_VARS
 952 CUDA_TOOLKIT_ROOT_DIR
 953 CUDA_NVCC_EXECUTABLE
 954 CUDA_INCLUDE_DIRS
 955 CUDA_CUDART_LIBRARY
 956   VERSION_VAR
 957 CUDA_VERSION
 958   )
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-05-06 15:03 Ryan Desmond   New 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


Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-06 Thread Rolf Eike Beer
Am Freitag, 6. Mai 2016, 17:09:14 schrieb Harry Mallon:
> According to Fedora documentation the "Release:" variable in RPM files
> should be set to 1%{?dist}.
> https://fedoraproject.org/wiki/How_to_create_an_RPM_package
> https://fedoraproject.org/wiki/Packaging:DistTag
> 
> This means it should be set to a string which looks like "1.el7.centos" on
> my CentOS7 machine. CPack sets this to "1" by default, but can be changed
> with the CPACK_RPM_PACKAGE_RELEASE variable. I propose a change as follows:
> https://github.com/hm1992/CMake/commit/94c611d5710a51072e15855ed96a225def97
> 5c38
> 
> * Adds CPACK_RPM_DIST which defaults to the output of "rpmbuild -E %{dist}
> 2>/dev/null". * Makes CPACK_RPM_PACKAGE_RELEASE default to
> "1${CPACK_RPM_DIST}"

Instead of "2>/dev/null" you should use the ERROR_QUIET option.

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

[cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-06 Thread Harry Mallon
According to Fedora documentation the "Release:" variable in RPM files should 
be set to 1%{?dist}.
https://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://fedoraproject.org/wiki/Packaging:DistTag

This means it should be set to a string which looks like "1.el7.centos" on my 
CentOS7 machine. CPack sets this to "1" by default, but can be changed with the 
CPACK_RPM_PACKAGE_RELEASE variable. I propose a change as follows:
https://github.com/hm1992/CMake/commit/94c611d5710a51072e15855ed96a225def975c38

* Adds CPACK_RPM_DIST which defaults to the output of "rpmbuild -E %{dist} 
2>/dev/null".
* Makes CPACK_RPM_PACKAGE_RELEASE default to "1${CPACK_RPM_DIST}"

I think I am right in saying this would not change behaviour on distributions 
that did not use the %{dist} option as "rpmbuild -E %{dist}" should return 
nothing.

Harry

Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E ha...@codexdigital.com | T +44 203 7000 
989

Website | Facebook 
| Twitter

[http://www.codexdigital.com/?action=asset&id=E55D8A6F-AF62-4978-8FF1-435A85AFADBF]
-- 

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] proposal of fix for FindLua

2016-05-06 Thread ivan Ivanov
Fix for https://cmake.org/Bug/view.php?id=15756
I also attached patch direct to the bug but there was no activity after
that.


fft
From e3cd296931774dd0eded52aee1ecbf3af1f6b108 Mon Sep 17 00:00:00 2001
From: fft
Date: Mon, 28 Dec 2015 01:02:15 +0300
Subject: [PATCH] FindLua works with several lua installed

---
 Modules/FindLua.cmake | 95 ---
 1 file changed, 59 insertions(+), 36 deletions(-)

diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index 731f5f2..a7cc46a 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -49,6 +49,7 @@
 
 unset(_lua_include_subdirs)
 unset(_lua_library_names)
+unset(_lua_append_versions)
 
 # this is a function only to have all the variables inside go away automatically
 function(set_lua_version_vars)
@@ -89,26 +90,72 @@ function(set_lua_version_vars)
  lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
 )
 endforeach ()
+list(APPEND _lua_include_subdirs include/lua include)
 
 set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
 set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
+set(_lua_append_versions "${lua_append_versions}" PARENT_SCOPE)
 endfunction(set_lua_version_vars)
 
+
+function(check_header_version _hdr_file)
+# At least 5.[012] have different ways to express the version
+# so all of them need to be tested. Lua 5.2 defines LUA_VERSION
+# and LUA_RELEASE as joined by the C preprocessor, so avoid those.
+file(STRINGS "${_hdr_file}" lua_version_strings
+ REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
+string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
+if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
+string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
+string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
+set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+else ()
+string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
+string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+endif ()
+string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
+string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
+string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
+endif ()
+foreach (ver IN LISTS _lua_append_versions)
+if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
+set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
+set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
+set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
+set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+return()
+endif ()
+endforeach()
+unset(LUA_VERSION_STRING)
+endfunction(check_header_version)
+
+
 set_lua_version_vars()
 
-find_path(LUA_INCLUDE_DIR lua.h
-  HINTS
-ENV LUA_DIR
-  PATH_SUFFIXES ${_lua_include_subdirs} include/lua include
-  PATHS
-  ~/Library/Frameworks
-  /Library/Frameworks
-  /sw # Fink
-  /opt/local # DarwinPorts
-  /opt/csw # Blastwave
-  /opt
-)
+foreach (subdir IN LISTS _lua_include_subdirs)
+unset(LUA_INCLUDE_PREFIX CACHE)
+find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h
+  HINTS
+ENV LUA_DIR
+  PATHS
+  ~/Library/Frameworks
+  /Library/Frameworks
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+  /opt
+)
+if (LUA_INCLUDE_PREFIX)
+check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h")
+if (LUA_VERSION_STRING)
+set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}")
+break()
+endif ()
+endif ()
+endforeach ()
 unset(_lua_include_subdirs)
+unset(_lua_append_versions)
 
 find_library(LUA_LIBRARY
   NAMES ${_lua_library_names} lua
@@ -136,30 +183,6 @@ if (LUA_LIBRARY)
 endif ()
 endif ()
 
-if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
-# At least 5.[012] have different ways to express the version
-# so all of them need to be tested. Lua 5.2 defines LUA_VERSION
-# and LUA_RELEASE as joined by the C preprocessor, so avoid those.
-file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings
- REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
-
-string(REGEX REPLACE

Re: [cmake-developers] CMake API for warnings

2016-05-06 Thread Ruslan Baratov via cmake-developers
Here is the case when such feature might be useful: 
stackoverflow.com/questions/37036690


Ruslo

On 25-Apr-16 21:58, Brad King wrote:

On 04/23/2016 12:11 AM, Ruslan Baratov wrote:

It means ignoring directory properties. So by default we will inherit settings.

[snip]

To disable inheriting we need to add extra argument (?) to *_compile_warnings:

  add_compile_warnings(DISABLE warn-A)
  target_compile_warnings(foo DISABLE warn-B IGNORE DIRECTORY)

We don't have such a feature for any of the other build settings so
there is no precedent for how to represent this or its exact semantics.

We may not need the capability at all.  For other properties like
COMPILE_OPTIONS and INCLUDE_DIRECTORIES the target-level property
is initialized from the directory-level property when the target
is created.  After that the directory-level property has no meaning
to the target.  One may then set the target-level property to
erase any content previously taken from the directory-level
property.  This allows specific targets to ignore the directory-level
property in special cases.

-Brad



--

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