Since version 3.15 CMake provides a command-line signature to install an
already-generated project binary tree. This may be used after building a
project to run installation without using the generated build system or
the native build tool.

This is a small improvement, for regular bitbake calls. CMake does not
check the dependencies again which is expected to be faster.

The main motivation for this change is using CMake from an SDK context.
With this change it is possible to initiate the compile step from an
IDE and later on initiating the install step via bitbake which runs the
install step on pseudo.

This is also what the meson.bbclass already does with the --no-rebuild
option.

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/classes-recipe/cmake.bbclass | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/cmake.bbclass 
b/meta/classes-recipe/cmake.bbclass
index d978b889440..ff96f61c0eb 100644
--- a/meta/classes-recipe/cmake.bbclass
+++ b/meta/classes-recipe/cmake.bbclass
@@ -222,12 +222,24 @@ cmake_runcmake_build() {
        eval ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --build 
'${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
 }
 
+# Install an already-generated project binary tree. Not checking the compile
+# dependencies again is particularly important for SDK use cases.
+cmake_runcmake_install() {
+       bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --install 
'${B}'
+       eval ${DESTDIR:+DESTDIR=${DESTDIR} }${CMAKE_VERBOSE} cmake --install 
'${B}'
+}
+
 cmake_do_compile()  {
        cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
 }
 
 cmake_do_install() {
-       DESTDIR='${D}' cmake_runcmake_build --target ${OECMAKE_TARGET_INSTALL}
+       if [ "${OECMAKE_TARGET_INSTALL}" = "install" ]; then
+               DESTDIR='${D}' cmake_runcmake_install
+       else
+               # Legacy path which supports also custom install targets
+               DESTDIR='${D}' cmake_runcmake_build --target 
${OECMAKE_TARGET_INSTALL}
+       fi
 }
 
 EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193619): 
https://lists.openembedded.org/g/openembedded-core/message/193619
Mute This Topic: https://lists.openembedded.org/mt/103727319/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to