Merge branch 'org.openembedded.dev' of ssh+git://git@git.openembedded.net/openembedde...
[openembedded.git] / classes / cmake.bbclass
1 DEPENDS += " cmake-native "
2
3 # We want the staging and installing functions from autotools
4 inherit autotools_stage
5
6 # Use in-tree builds by default but allow this to be changed
7 # since some packages do not support them (e.g. llvm 2.5).
8 OECMAKE_SOURCEPATH ?= "."
9
10 # If declaring this, make sure you also set EXTRA_OEMAKE to
11 # "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles.
12 OECMAKE_BUILDPATH ?= ""
13
14 cmake_do_configure() {
15   if [ ${OECMAKE_BUILDPATH} ]
16   then
17     mkdir ${OECMAKE_BUILDPATH}
18     cd ${OECMAKE_BUILDPATH}
19   fi
20
21   cmake ${OECMAKE_SOURCEPATH} \
22     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
23     -DCMAKE_FIND_ROOT_PATH:PATH=${STAGING_DIR_HOST} \
24     -DCMAKE_INSTALL_SO_NO_EXE=0 \
25     ${EXTRA_OECMAKE} \
26     -Wno-dev
27 }
28
29 cmake_do_compile()  {
30   if [ ${OECMAKE_BUILDPATH} ]
31   then
32      cd ${OECMAKE_BUILDPATH}
33   fi
34   
35   base_do_compile
36 }
37
38 cmake_do_install() {
39   if [ ${OECMAKE_BUILDPATH} ];
40   then
41      cd ${OECMAKE_BUILDPATH}
42   fi
43   
44   autotools_do_install
45 }
46
47 EXPORT_FUNCTIONS do_configure do_compile do_install