[CMake] Problem with a simple framework target on OS X

Nils Gladitz nilsgladitz at gmail.com
Mon Jan 16 05:23:03 EST 2017


On 01/16/2017 11:02 AM, Nat! wrote:

> Hi
>
> I am trying to create an OS X framework with resources and headers using
> cmake. This is my `CMakeLists.txt` file:
>
>      project( Foo)
>
>      cmake_minimum_required (VERSION 3.7)
>
>      add_library( Foo SHARED
>      foo.c
>      )
>
>      set_target_properties( Foo PROPERTIES
>      FRAMEWORK TRUE
>      RESOURCE "foo.md"
>      PUBLIC_HEADER "foo.h"
>      )
>
>
> When I run `( mkdir build ; cd build ; cmake .. ; make)` a
> `Foo.framework` is generated, but the header and the resource do not
> appear in it. What am I missing ? (cmake version 3.7.1)

Try add_library( Foo SHARED foo.c foo.h foo.md).
 From what I remember the target properties in this case only apply to 
sources that are associated with the target.

Unrelated but cmake_minimum_required() should come before project().

Nils


More information about the CMake mailing list