Problem with a simple framework target on OS X

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with a simple framework target on OS X

Nat!
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)

---
How to reproduce. Save above CMakeLists.txt. Now execute:

    #!/bin/sh

    echo "int version = 1;" > foo.c
    touch foo.h
    touch foo.md
    ( mkdir build ; cd build ; cmake .. ; make)
    ls -R build/Foo.framework/


Ciao
   Nat!

P.S. Asked this on stackoverflow too
(https://stackoverflow.com/posts/41597860) a few days ago.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Problem with a simple framework target on OS X

Nils Gladitz-2
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
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake