Avoid building user-driven-interop example on non-LRTS layers
[charm.git] / contrib / charmc.cmake
1 macro(CHARMC_TARGET Name CharmInput CharmOutputDirectory CharmModules CharmTarget)
2     set(CHARMC_TARGET_modules ${${CharmModules}})
3
4     set(CHARMC_TARGET_output )
5
6     foreach(module ${CHARMC_TARGET_modules})
7       set(MODULE_DECL "${module}.decl.h")
8       set(MODULE_DEF  "${module}.def.h")
9       list(
10         APPEND
11         CHARMC_TARGET_output
12         "${CharmOutputDirectory}/${MODULE_DECL}"
13       )
14       list(APPEND
15         CHARMC_TARGET_output
16         "${CharmOutputDirectory}/${MODULE_DEF}"
17       )
18     endforeach(module)
19
20     set(${CharmTarget} ${CHARMC_TARGET_output})
21
22     set(
23       BuildCommand
24       "[charmc] Compiling Charm++ Interface file: ${CharmInput}, Modules=[${${CharmModules}}]"
25     )
26
27     # DEPENDS on "Charm++" assumes that the top-level CMake wrapper for Charm++ is used via add_subdirectory
28     add_custom_command(
29       OUTPUT ${CHARMC_TARGET_output}
30       COMMAND ${CHARMC_EXECUTABLE} ${CharmInput}
31       VERBATIM
32       DEPENDS ${CharmInput} Charm++
33       COMMENT ${BuildCommand}
34       WORKING_DIRECTORY ${CharmOutputDirectory}
35     )
36 endmacro()