Skip to contentSkip to conversation

cmake: Use find_program if find_host_program is not available

PATCH Superseded Maxime Roussin-Bélanger 3 participants 4 messages Jun 27, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover cmake: Use find_program if find_host_program is not available

When building an application with android toolchain there is no problem, but using another toolchain that doesn't define the macro, cmake exit with en error.

The following changes since commit b8358bc61435ec996ecd6931fb6d6d41bb4f710b:

bitbake: bitbake-selftest: add bb.tests.event to bitbake-selftest (2017-06-23 14:14:17 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib mroussin/fix_cmake_find_cuda_not_android
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mroussin/fix_cmake_find_cuda_not_android

Maxime Roussin-Bélanger (1):
cmake: Use find_program if find_host_program is not available

 meta/recipes-devtools/cmake/cmake.inc              |  1 +
 ...e-find_program-if-find_host_program-is-no.patch | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/1 cmake: Use find_program if find_host_program is not available

CMake does not define the find_host_program command we've been using in the cross-compiling code path. It was provided by a widely used Android toolchain file. For compatibility, continue to use find_host_program if available, but otherwise use just find_program.

Upstream-Status: Accepted [https://gitlab.kitware.com/cmake/cmake/merge_requests/1009]
- Will be in 3.10

---
Changes in v2:
- Add upstream-status

 meta/recipes-devtools/cmake/cmake.inc              |  1 +
 ...e-find_program-if-find_host_program-is-no.patch | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch
meta/recipes-devtools/cmake/cmake.inc +1 -0
index dbd34f5..6aeb25f 100644
@@ -14,6 +14,7 @@ CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
 SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \
            file://support-oe-qt4-tools-names.patch \
            file://qt4-fail-silent.patch \
+           file://0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch \
            "
 
 SRC_URI[md5sum] = "b5dff61f6a7f1305271ab3f6ae261419"
meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch new file +36 -0
new file mode 100644
index 0000000..8a61f1f
@@ -0,0 +1,36 @@
+From 46d25e782ebd9b6c50771b6f30433c58fae03a51 Mon Sep 17 00:00:00 2001
+From: Maxime Roussin-Bélanger <[email protected]>
+Date: Mon, 26 Jun 2017 11:30:07 -0400
+Subject: [PATCH] cmake: Use find_program if find_host_program is not
+ available
+
+CMake does not define the `find_host_program` command we've been using
+in the cross-compiling code path.  It was provided by a widely used
+Android toolchain file.  For compatibility, continue to use
+`find_host_program` if available, but otherwise use just `find_program`.
+
+Signed-off-by: Maxime Roussin-Bélanger <[email protected]>
+---
+ Modules/FindCUDA.cmake | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
+index a4dca54..77ca351 100644
+--- a/Modules/FindCUDA.cmake
++++ b/Modules/FindCUDA.cmake
+@@ -679,7 +679,11 @@ if(CMAKE_CROSSCOMPILING)
+   # add known CUDA targetr root path to the set of directories we search for programs, libraries and headers
+   set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}")
+   macro( cuda_find_host_program )
+-    find_host_program( ${ARGN} )
++    if (COMMAND find_host_program)
++      find_host_program( ${ARGN} )
++    else()
++      find_program( ${ARGN} )
++    endif()
+   endmacro()
+ else()
+   # for non-cross-compile, find_host_program == find_program and CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR
+--
+2.1.4
+
Signature · 1 line
2.1.4
#2 lore raw
Quoted 9 lines · Maxime Roussin-Bélanger

CMake does not define the find_host_program command we've been using in the cross-compiling code path. It was provided by a widely used Android toolchain file. For compatibility, continue to use find_host_program if available, but otherwise use just find_program.

Upstream-Status: Accepted [https://gitlab.kitware.com/
cmake/cmake/merge_requests/1009]

- Will be in 3.10

Quoted 1 line

The upstream work is much appreciated, thanks. However, the Upstream-Status tag needs to be in the actual patch file commit message (the idea is that when cmake recipe version is next upgraded, it's easy to see from the patch file alone whether it's still needed or not). Sorry for not being explicit about that.

Thanks,
Jussi

Quoted 85 lines

---
Changes in v2:
- Add upstream-status

 meta/recipes-devtools/cmake/cmake.inc              |  1 +
 ...e-find_program-if-find_host_program-is-no.patch | 36
++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-devtools/cmake/

cmake/0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch

meta/recipes-devtools/cmake/cmake.inc +0 -0
index dbd34f5..6aeb25f 100644
@@ -14,6 +14,7 @@ CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').

split('.')[0:2])}"
SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${

PV}.tar.gz \
            file://support-oe-qt4-tools-names.patch \
            file://qt4-fail-silent.patch \
+           file://0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch
\
            "

SRC_URI[md5sum] = "b5dff61f6a7f1305271ab3f6ae261419"

(quoted diff) +0 -0

program-if-find_host_program-is-no.patch b/meta/recipes-devtools/cmake/ cmake/0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch new file mode 100644
index 0000000..8a61f1f

meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_ new file +0 -0

program-if-find_host_program-is-no.patch

meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_ new file +22 -0
@@ -0,0 +1,36 @@
+From 46d25e782ebd9b6c50771b6f30433c58fae03a51 Mon Sep 17 00:00:00 2001
+From: Maxime Roussin-Bélanger <[email protected]>
+Date: Mon, 26 Jun 2017 11:30:07 -0400
+Subject: [PATCH] cmake: Use find_program if find_host_program is not
+ available
+
+CMake does not define the `find_host_program` command we've been using
+in the cross-compiling code path.  It was provided by a widely used
+Android toolchain file.  For compatibility, continue to use
+`find_host_program` if available, but otherwise use just `find_program`.
+
+Signed-off-by: Maxime Roussin-Bélanger <[email protected]>
+---
+ Modules/FindCUDA.cmake | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
+index a4dca54..77ca351 100644
+--- a/Modules/FindCUDA.cmake
++++ b/Modules/FindCUDA.cmake
+@@ -679,7 +679,11 @@ if(CMAKE_CROSSCOMPILING)
+   # add known CUDA targetr root path to the set of directories we search

for programs, libraries and headers
+ set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${
CMAKE_FIND_ROOT_PATH}")

meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_ new file +10 -0
+   macro( cuda_find_host_program )
+-    find_host_program( ${ARGN} )
++    if (COMMAND find_host_program)
++      find_host_program( ${ARGN} )
++    else()
++      find_program( ${ARGN} )
++    endif()
+   endmacro()
+ else()
+   # for non-cross-compile, find_host_program == find_program and

CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR
+--
+2.1.4
+
--
2.1.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw

✗ patchtest: failure for cmake: Use find_program if find_host_program is not available (rev2)

In reply to Maxime Roussin-Bélanger

== Series Details ==

Series: cmake: Use find_program if find_host_program is not available (rev2)
Revision: 2
URL : https://patchwork.openembedded.org/series/7466/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Added patch file is missing Upstream-Status in the header [test_upstream_status_presence]
Suggested fix Add Upstream-Status: <status> to the header of meta/recipes-devtools/cmake/cmake/0001-FindCUDA-Use-find_program-if-find_host_program-is-no.patch (possible values: Pending, Submitted, Accepted, Backport, Denied, Inappropriate)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe