[CMake] Help including dylib into cmake build for xcode

Andreas Mohr andi at lisas.de
Sat Jun 1 14:35:24 EDT 2013


Hi,

On Sat, Jun 01, 2013 at 12:00:04PM -0400, cmake-request at cmake.org wrote:
> Date: Fri, 31 May 2013 15:12:10 -0400
> From: Frankie Chan <frankie.chan at ubisoft.com>

Ah, I just realized that I failed to reply to the most current mail ;)


> I get the following error, i am kinda stumped right now since I am not exactly sure if this is the right approach in linking my project.
> 
>   Cannot specify link libraries for target "/usr/lib/libsqlite3.dylib" which
>   is not built by this project.
> 
>   CMake does not support this but it used to work accidentally and is being
>   allowed for compatibility.
> 
>   Policy CMP0016 is not set: target_link_libraries() reports error if only
>   argument is not a target.  Run "cmake --help-policy CMP0016" for policy
>   details.  Use the cmake_policy command to set the policy and suppress this
>   warning.
> This warning is for project developers.  Use -Wno-dev to suppress it.

This can mean (with deadly precision) nothing other than ${Target} having
ended up as an empty expression, thus the sqlite3 argument
(/usr/lib/libsqlite3.dylib) ends up being the *first* argument of the
call which is supposed to be the candidate target instead.
IOW, FUBAR.

Perhaps ${Target} variable has a case sensitivity issue? Scope issue? (perhaps
some outer scope defined it yet now we're in a foreign unrelated scope?
Different directory, different function, ...).

Anyway, always use
message(FATAL_ERROR "exact_same_cmake_line_content_as_executed")
(or, IOW,
message(FATAL_ERROR "target_link_libraries(${Target} ${SQLITE3_LIBRARIES})")
)
whenever needing to analyze why things fail.

Andreas Mohr


More information about the CMake mailing list