Question

I'm trying to do the CMake file for a library I'm working on. The "project" is quite simple : 2 classes, and the use of the Boost library.

I've done the CMakeLists this way:

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
    )

It finds the Boost library, then I got that:

> 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.

Without the "SHARE" option, it builds the project (but I don't have any library target).

Any idea about what I'm doing wrong ? I'm using CMake 2.8.12.2 under OSX and try to build an xcode project.

Thanks !

Was it helpful?

Solution

the name argument add_library is used to create the name of a shared library

The corresponds to the logical target name and must be globally unique within a project. The actual file name of the library built is constructed based on conventions of the native platform (such as lib.a or .lib).

So it should not contain the character /

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top