2

我想用 CMake 编译一个依赖 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 有问题吗?

此命令有效:

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
4

1 回答 1

2

这样就可以了:

[...]
###########
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
)
[...]
于 2013-04-14T13:03:25.320 回答