# Help for integrating an CppTranspiler

**URL:** <https://discourse.cmake.org/t/help-for-integrating-an-cpptranspiler/527>\
**Category:** Code\
**Created:** [January 20, 2020, 1:54pm UTC](https://discourse.cmake.org/t/help-for-integrating-an-cpptranspiler/527 "2020-01-20T13:54:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![freylax](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/77aa72/32.png) [@freylax](https://discourse.cmake.org/u/freylax)\
**Post date:** [January 20, 2020, 1:54pm UTC](https://discourse.cmake.org/t/help-for-integrating-an-cpptranspiler/527/1 "2020-01-20T13:54:52Z")

</div>

I need Help for integrating an Cpp Transpiler (Purescript to cpp see [purescript-native-build](http://github.com/freylax/purescript-native-build). The custom command has the characteristics that it works on a set of input files and will produce an set of output files. If only one input file has changed then at least the associated output file will be updated.  
My problem is how I could tell this to cmake, especially the dependency mapping.  
I created a minimal example for illustration:

```
cmake_minimum_required(VERSION 3.10)
project(foo)
set( BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} )

set( A ${BUILD_DIR}/a.t )
set( B ${BUILD_DIR}/b.t )
set( AA ${BUILD_DIR}/aa.t )
set( BB ${BUILD_DIR}/bb.t )

set( UPDATE
  cp -u ${A} ${AA} $<SEMICOLON>
  cp -u ${B} ${BB}
  )

add_custom_command(
  OUTPUT ${AA}
  COMMAND ${UPDATE}
  DEPENDS ${A}
  COMMENT "update ${AA}"
  )

add_custom_command(
  OUTPUT ${BB}
  COMMAND ${UPDATE}
  DEPENDS ${B}
  COMMENT "update ${BB}"
  )

add_custom_target(zoo ALL
  DEPENDS ${AA} ${BB}
  )

```

This will mimic the desired behviour for A-\>AA and B-\>BB . But I have to write  
the custom command twice to get the right mappings, exists there a more preferable  
way which also will not infere with parallel builds.

Thank you for your time,  
Regards,  
Robert

---

<div class="post-metadata">

**Author:** ![freylax](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/77aa72/32.png) [@freylax](https://discourse.cmake.org/u/freylax)\
**Post date:** [January 20, 2020, 4:54pm UTC](https://discourse.cmake.org/t/help-for-integrating-an-cpptranspiler/527/2 "2020-01-20T16:54:28Z")

</div>

The real world CMakeList file is here:  
[CMakeList.txt](https://github.com/freylax/purescript-native-build/blob/master/CMakeLists.txt)
