2014-04-28 59 views
0

我正在嘗試爲正在處理的庫執行CMake文件。 「項目」非常簡單:2個類,並使用Boost庫。使用CMake構建庫時的錯誤

我已經做了CMakeLists這樣:

project("TFTP Server") 

cmake_minimum_required(VERSION 2.8) 

set(Boost_DEFAULT_VERSION 1.53) 
set(Boost_COMPONENTS "system") 
include(FindBoostHelper.cmake) 

include_directories(${INCLUDE_DIRECTORIES} ${Boost_INCLUDE_DIRS}) 

add_library(
    bin/tftp_server 
    SHARED 
    src/tftp_server.cpp 
) 

# set up the main project 
set(tftp_server_SOURCES 
    ${tftp_server_SOURCES} 
    src/tftp_server.h 
    src/tftp_server.cpp 
    src/tftp_connection.h 
    src/tftp_connection.cpp 
    ) 

它發現Boost庫,然後我得到的:

> cmake .. -G "Xcode" 
-- Boost version: 1.53.0 
-- Found the following Boost libraries: 
-- system 
-- Found boost in /usr/local/include/boost-1_53, using libraries /usr/local/lib/libboost_system-clang-darwin42-mt-1_53.a 
-- Configuring done 
-- Generating done 
CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_SONAME_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_LINKER_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_SONAME_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_LINKER_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_SONAME_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_LINKER_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_SONAME_FILE:bin/tftp_server> 

    Expression syntax not recognized. 


CMake Error: 
    Error evaluating generator expression: 

    $<TARGET_LINKER_FILE:bin/tftp_server> 

    Expression syntax not recognized. 

沒有 「分享」 選項,它生成項目(但我沒有任何圖書館目標)。

任何關於我在做什麼錯的想法? 我在OSX下使用CMake 2.8.12.2並嘗試構建一個xcode項目。

謝謝!

回答

1

name的參數add_library用於創建一個共享庫的名字

的對應於邏輯對象名稱,並且必須是在項目中全球唯一的。構建的庫的實際文件名是基於本地平臺的約定(如lib.a或.lib)構建的。

所以它不應該包含字符/

+0

謝謝!這是問題所在。 –