]> code.ossystems Code Review - openembedded-core.git/commitdiff
cmake: allow target names to be overridden
authorRoss Burton <ross.burton@intel.com>
Tue, 16 Jan 2018 13:25:15 +0000 (13:25 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Jan 2018 16:32:41 +0000 (16:32 +0000)
Don't hardcode the targets used in do_compile and do_install, instead build
"all" and "install" by default but respect OECMAKE_TARGET_COMPILE and
OECMAKE_TARGET_INSTALL variables.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/cmake.bbclass

index a4079dab0d7b90046b77d582de60b7e6602a6fea..10c4edcf1a585131ff6967ccf6ed473818f209e0 100644 (file)
@@ -34,6 +34,9 @@ EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}"
 EXTRA_OECMAKE_BUILD_prepend_task-compile = "${PARALLEL_MAKE} "
 EXTRA_OECMAKE_BUILD_prepend_task-install = "${PARALLEL_MAKEINST} "
 
+OECMAKE_TARGET_COMPILE ?= "all"
+OECMAKE_TARGET_INSTALL ?= "install"
+
 FILES_${PN}-dev += "${libdir}/cmake ${datadir}/cmake"
 
 # CMake expects target architectures in the format of uname(2),
@@ -140,13 +143,13 @@ cmake_do_configure() {
 
 do_compile[progress] = "percent"
 cmake_do_compile()  {
-       bbnote VERBOSE=1 cmake --build '${B}' -- ${EXTRA_OECMAKE_BUILD}
-       VERBOSE=1 cmake --build '${B}' -- ${EXTRA_OECMAKE_BUILD}
+       bbnote VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD}
+       VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD}
 }
 
 cmake_do_install() {
-       bbnote DESTDIR='${D}' cmake --build '${B}' --target install -- ${EXTRA_OECMAKE_BUILD}
-       DESTDIR='${D}' cmake --build '${B}' --target install -- ${EXTRA_OECMAKE_BUILD}
+       bbnote DESTDIR='${D}' cmake --build '${B}' --target ${OECMAKE_TARGET_INSTALL} -- ${EXTRA_OECMAKE_BUILD}
+       DESTDIR='${D}' cmake --build '${B}' --target ${OECMAKE_TARGET_INSTALL} -- ${EXTRA_OECMAKE_BUILD}
 }
 
 EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file