# \[RFC\] Cross-platform CMake support

**URL:** <https://discourse.libcinder.org/t/rfc-cross-platform-cmake-support/102>\
**Category:** Developing Cinder\
**Created:** [June 21, 2016, 1:29am UTC](https://discourse.libcinder.org/t/rfc-cross-platform-cmake-support/102 "2016-06-21T01:29:13Z")\
**Posts on this page:** 1\
**Showing post:** 30

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [August 25, 2016, 7:09am UTC](https://discourse.libcinder.org/t/rfc-cross-platform-cmake-support/102/30 "2016-08-25T07:09:59Z")

</div>

I’m trying to implement some post build action like supporting `make run` and post build copy.

This is what I managed to do for `make run`. It should use `CMAKE_RUNTIME_OUTPUT_DIRECTORY` instead of the `CMAKE_BUILD_TYPE` hack, but I could not access that variable.

```auto
add_custom_target( run
    COMMAND open ${CMAKE_BUILD_TYPE}/${APP_NAME}.app
    DEPENDS ${CMAKE_BUILD_TYPE}/${APP_NAME}.app/Contents/MacOS/${APP_NAME}
    WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
)

```

I also have to define `CMAKE_BUILD_TYPE` in my CMake file to make this work.

It is also often necessary to copy a shared library from a block next to the application executable. It would be more elegant to do this from the block config cmake than hacking it into the application cmake. This is what I have for a block with Leap Motion dynamic libraries in the app cmake. I’m not sure if it is possible to put this in the block cmake.

```auto
if( CINDER_MAC )
    add_custom_command( TARGET ${APP_NAME} POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy
            ${APP_DIR}/blocks/Cinder-Leap/lib/macosx/libLeap.dylib
            ${CMAKE_BUILD_TYPE}/${APP_NAME}.app/Contents/MacOS/
    )
elseif( CINDER_LINUX )
  ...
elseif( CINDER_MSW )
  ...
endif()

```

Do you have any suggestions to make these solutions simpler, more elegant? Or is it not possible to do this with the current cinder cmake system?

---

_[View the full topic](https://discourse.libcinder.org/t/rfc-cross-platform-cmake-support/102)._
