[CMake] Help including dylib into cmake build for xcode

Andreas Mohr andi at lisas.de
Sat Jun 1 14:26:28 EDT 2013


Hi,

On Fri, May 31, 2013 at 10:53:38AM -0400, cmake-request at cmake.org wrote:
> Date: Fri, 31 May 2013 10:44:07 -0400
> From: Frankie Chan <frankie.chan at ubisoft.com>

> Hi,
> I am trying to build an xcode project using cmake, but I am having some problems including dylib (libsqlite3.dylib).
> 
> Was using:
> target_link_libraries(${Target} libsqlite3.dylib)
> 
> but i think i am going about it the wrong way.
> 
> Any help would be appreciated

There are varying degrees of dynamic handling of the things to be used:

a) plain specific library filenames [easiest but most hard-coded/wrong]
b) using results (variables) of a manual find_library() supplied with
   potential names of the library to be found [much better]
c) using find_package() with either a related Find*.cmake module
   or (in Config mode) the Config file as provided by the installed
   (or in-tree) library package [best?]

Since the code currently is using a), I'm somewhat less astonished
that it does not work ;)

So I'd recommend at least using b), or possibly c) if it can be achieved
easily (existing package with its configuration exported, or Find module
sufficiently easily available).
But I'm sure some people would say "always use c)".

HTH - anything else?

Andreas Mohr


More information about the CMake mailing list