Skip to contentSkip to conversation

render cmake search path stricter

PATCH In review Valentin Longchamp 2 participants 4 messages Jun 18, 2009 – Jun 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 render cmake search path stricter

The search is only done in the STAGING directy: all the needed tools should be there (already built) and all the libs and header are there too. With this, we are sure that we do not mix with the host libs, headers or tools.

---
 classes/cmake.bbclass |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
classes/cmake.bbclass +3 -0
index b5b7b86..af8f3a9 100644
@@ -21,6 +21,9 @@ cmake_do_configure() {
   cmake ${OECMAKE_SOURCEPATH} \
     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
     -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
     ${EXTRA_OECMAKE} \
     -Wno-dev
 }
Signature · 1 line
1.6.0.4
#1 lore raw

Any particular reason not to include CMAKE_FIND_ROOT_PATH_MODE_PACKAGE?

Normally this won't have any effect, as CMake will look in the CMake installation for FindSomething.cmake ("module" mode). But if a package installs a SomethingConfig.cmake in /usr/share/cmake (the "config" mode of find_package) we should be looking only in staging, not trawling around on the host PC.

Douglas.

Quoted 16 lines · Valentin Longchamp

The search is only done in the STAGING directy: all the needed tools should be there (already built) and all the libs and header are there too. With this, we are sure that we do not mix with the host libs, headers or tools.

---
 classes/cmake.bbclass |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
classes/cmake.bbclass +0 -0
index b5b7b86..af8f3a9 100644

classes/cmake.bbclass cmake_do_configure() { · line 29

Quoted 9 lines
classes/cmake.bbclass +3 -0
@@ -21,6 +21,9 @@ cmake_do_configure() {
   cmake ${OECMAKE_SOURCEPATH} \
     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
     -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
     ${EXTRA_OECMAKE} \
     -Wno-dev
 }

=======================================================================
This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email.
Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission.
=======================================================================

#2 lore raw
Quoted 1 line · Douglas Royds

Any particular reason not to include CMAKE_FIND_ROOT_PATH_MODE_PACKAGE?

Simply because I did not know about it as I based myself on the this doc: http://www.cmake.org/Wiki/CMake_Cross_Compiling and they never talk about this variable. I do not see a lot of references to that variable so I don't think we should set it here.

Quoted 2 lines

Normally this won't have any effect, as CMake will look in the CMake installation for FindSomething.cmake ("module" mode). But if a package installs a SomethingConfig.cmake in /usr/share/cmake (the "config" mode of find_package) we should be looking only in staging, not trawling around on the host PC.

I agree with you, we should be looking only in staging. But the problem is that with the below proposed option DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY, the OE buids do not work well. You certainly need a few tools from the host PC. That's why I now have CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH. But the default behaviour with cmake is that the directories listed in CMAKE_FIND_ROOT_PATH are searched for, which is what we want.

Val

Quoted 30 lines

Douglas.

Quoted 25 lines · Valentin Longchamp

The search is only done in the STAGING directy: all the needed tools should be there (already built) and all the libs and header are there too. With this, we are sure that we do not mix with the host libs, headers or tools.

---
 classes/cmake.bbclass |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
classes/cmake.bbclass +3 -0
index b5b7b86..af8f3a9 100644
@@ -21,6 +21,9 @@ cmake_do_configure() {
   cmake ${OECMAKE_SOURCEPATH} \
     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
     -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
     ${EXTRA_OECMAKE} \
     -Wno-dev
 }
Signature · 4 lines
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
[email protected], Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEA3485, Station 9, CH-1015 Lausanne
#3 lore raw
Quoted 4 lines · Valentin Longchamp
Quoted 1 line · Douglas Royds

Any particular reason not to include CMAKE_FIND_ROOT_PATH_MODE_PACKAGE?

Simply because I did not know about it as I based myself on the this doc: http://www.cmake.org/Wiki/CMake_Cross_Compiling and they never talk about this variable. I do not see a lot of references to that variable so I don't think we should set it here.

It's documented at the bottom of the find_package() section of the CMake documentation, along with the documentation of CMAKE_FIND_ROOT_PATH:

http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package

I think we should set this one, so long as it doesn't break any existing packages. I haven't tested this.

Quoted 3 lines
Quoted 1 line

Normally this won't have any effect, as CMake will look in the CMake installation for FindSomething.cmake ("module" mode). But if a package installs a SomethingConfig.cmake in /usr/share/cmake (the "config" mode of find_package) we should be looking only in staging, not trawling around on the host PC.

I agree with you, we should be looking only in staging. But the problem is that with the below proposed option DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY, the OE buids do not work well. You certainly need a few tools from the host PC. That's why I now have CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH. But the default behaviour with cmake is that the directories listed in CMAKE_FIND_ROOT_PATH are searched for, which is what we want.

True. I suggest that we remove CMAKE_FIND_ROOT_PATH_MODE_PROGRAM from your patch below.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines · Valentin Longchamp

The search is only done in the STAGING directy: all the needed tools should be there (already built) and all the libs and header are there too. With this, we are sure that we do not mix with the host libs, headers or tools.

---
 classes/cmake.bbclass |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
classes/cmake.bbclass +0 -0
index b5b7b86..af8f3a9 100644
@@ -21,6 +21,9 @@ cmake_do_configure() {
   cmake ${OECMAKE_SOURCEPATH} \
     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
Quoted 8 lines

classes/cmake.bbclass cmake_do_configure() { · line 29

Quoted 8 lines
classes/cmake.bbclass +3 -0
     -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
     ${EXTRA_OECMAKE} \
     -Wno-dev
 }

=======================================================================
This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email.
Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission.
=======================================================================