使用CMake编译Vala项目

时间:2013-04-14 02:31:26

标签: cmake vala

我想编译一个依赖于CMapp的libappindicator的Vala项目。

但是,请使用此输出中止:

Linking C executable calm
CMakeFiles/calm.dir/src/CalmWindow.c.o: In function `__lambda6_':
CalmWindow.c:(.text+0x5b8): undefined reference to `app_indicator_set_status'
CMakeFiles/calm.dir/src/CalmWindow.c.o: In function `calm_calm_indicator_construct':
CalmWindow.c:(.text+0x6ee): undefined reference to `app_indicator_new'
CalmWindow.c:(.text+0x746): undefined reference to `app_indicator_set_status'
CalmWindow.c:(.text+0x76c): undefined reference to `app_indicator_set_attention_icon'
CalmWindow.c:(.text+0xe87): undefined reference to `app_indicator_set_menu'
collect2: ld gab 1 als Ende-Status zurück
make[2]: *** [calm] Fehler 1
make[1]: *** [CMakeFiles/calm.dir/all] Fehler 2
make: *** [all] Fehler 2

我的CMakeLists.txt出了什么问题?代码托管在此处:https://code.launchpad.net/~alexander-wilms/calm/calm

此命令有效:

valac -g --pkg gtk+-3.0 --pkg gstreamer-0.10 --pkg gstreamer-audio-0.10 --pkg granite --pkg appindicator3-0.1 CalmApp.vala Calm.vala CalmWindow.vala

1 个答案:

答案 0 :(得分:1)

这样可行:

[...]
###########
set(COMPILE_OPTIONS_VALA ${COMPILE_OPTIONS_VALA} -D USE_APPINDICATOR)
set(PACKAGES_VALA ${PACKAGES_VALA} "appindicator3-0.1")
###########

include(ValaPrecompile)
vala_precompile(VALA_C
        src/Calm.vala
        src/CalmApp.vala
        src/CalmWindow.vala
PACKAGES
        gtk+-3.0
        gstreamer-0.10
        gstreamer-audio-0.10
        appindicator3-0.1
CUSTOM_VAPIS
        vapi/config.vapi
OPTIONS
        --thread
)
[...]