0

我有这个 CMakeLists.txt 文件,我尝试添加 clutter-gtk 但我不能,它基于所有基本项目 cmake 文件

    project(Project)
cmake_minimum_required (VERSION 2.8)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)

#
# Base bits
#
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
set (PKGDATADIR "${DATADIR}/project")
set (GETTEXT_PACKAGE "project")
set (RELEASE_NAME "Project")
set (VERSION "0.1")
set (VERSION_INFO "Release")


#
# Niceties
#
set (ARCHIVE_NAME project-${VERSION})
add_custom_target (dist
    COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )

add_custom_target (distcheck
    COMMAND cd ${CMAKE_BINARY_DIR}
    && rm -rf ${ARCHIVE_NAME}
    && tar xf ${ARCHIVE_NAME}.tar.bz2
    && mkdir ${ARCHIVE_NAME}/build
    && cd ${ARCHIVE_NAME}/build
    && cmake -DCMAKE_INSTALL_PREFIX=../install -DGSETTINGS_LOCALINSTALL=ON .. -DCMAKE_MODULE_PATH=/usr/share/cmake
    && make -j8
    && make -j8 install
    && make check
    )
add_dependencies(distcheck dist)

add_custom_target (uninstall "${CMAKE_COMMAND}" -P
  "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake")


#
# config.h
#

configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
add_definitions(-include config.h)


#
# Data
#

file (GLOB _imagefiles "${CMAKE_CURRENT_SOURCE_DIR}/data/images/*")
install (FILES ${_imagefiles} DESTINATION ${PKGDATADIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/project.desktop DESTINATION /usr/share/applications)

#
# i18n
#

add_subdirectory(po)

#
# SRC
#

set (PROJECT_DEPS "gobject-2.0;glib-2.0;gio-2.0;gtk+-3.0;granite;gee-1.0;sqlite3;clutter-gtk-1.0;clutter-1.0;")

find_package(PkgConfig)
pkg_check_modules(CLUTTERGTK REQUIRED "clutter-gtk-1.0 >= 1.0.0")
pkg_check_modules(CLUTTER REQUIRED "clutter-1.0 >= 1.0.0")
pkg_check_modules(SQLITE3 REQUIRED "sqlite3")
pkg_check_modules(GLIB REQUIRED "glib-2.0 >= 2.26.0")
pkg_check_modules(GOBJECT REQUIRED "gobject-2.0 >= 2.26.0")
pkg_check_modules(GIO REQUIRED "gio-2.0 >= 2.26.0")
pkg_check_modules(GTK+ REQUIRED "gtk+-3.0 >= 3.0.8")
pkg_check_modules(GEE REQUIRED "gee-1.0 >= 0.5.0") 
pkg_check_modules(LIBGRANITE REQUIRED "granite")
pkg_check_modules(DEPS REQUIRED ${PROJECT_DEPS} gthread-2.0)

add_definitions(${DEPS_CFLAGS})

link_libraries(${DEPS_LIBRARIES})

link_directories(${DEPS_LIBRARY_DIRS})

find_package(Vala REQUIRED)
include(ValaVersion)
ensure_vala_version("0.18.0" MINIMUM)

include(ValaPrecompile)
vala_precompile(VALA_C

etc etc...

PACKAGES
    gtk+-3.0
    sqlite3
    granite
    gio-2.0 
    gee-1.0
    clutter-1.0
    clutter-gtk-1.0
CUSTOM_VAPIS
    vapi/config.vapi
OPTIONS
    --thread
    -g
    )

add_definitions(${CFLAGS}-Wall -Winit-self -Wwrite-strings -Wunreachable-code -Wstrict-prototypes)
add_executable(project ${VALA_C})
target_link_libraries(project ${SQLITE_LIBRARIES})
install(TARGETS project RUNTIME DESTINATION bin)


#
# GSettings Schema
#
include(GSettings)
add_schema("org.pantheon.Project.gschema.xml")

我做错了什么?

我试过:

target_link_libraries(project ${SQLITE_LIBRARIES} ${CLUTTERGTK_LIBRARIES})

但什么都没有:(

谢谢!

4

1 回答 1

0

好的,问题是 CMake 缓存,当您添加一个新库时,您必须在编译之前删除任何构建文件夹...:facepalm:

于 2012-10-01T21:05:13.627 回答