Question: i'm working on a project requiring cmake. i'd like to add some custom rules to my makefile, but can't quite get my head around how to do it.

both c source files and header files are in the same directory. also in this same directory are a number of `.def` files, which are the sources for some of the header files #included in the source during compilation.

if i were to do this in a makefile, i'd use a simple rule like

```
.SUFFIXES: .def

.def.h:
    $(PREPROC) $< > $@

```

how can i do this with cmake ??

i've tried various permutations of the following, both with and without cmake working directory specifications :

```
add_custom_command(
    OUTPUT vvr_const.h
    PRE_BUILD
    COMMAND preproc vvr_const.def > vvr_const.h
    DEPENDS vvr_const.def
)

add_custom_target(vvr_const.h DEPENDS vvr_const.def)

```

but the header file isn't generated by the time the c source file is compiled, so the compile fails. i've also tried a variation where i replace the last line above with

```
set_property(SOURCE main.c APPEND PROPERTY OBJECT_DEPENDS vvr_const.h)

```

in this case, the header file is correctly generated in advance, but `make` can't find it, and complains that there's no rule to make the target `.h`.

ideally this would be a general rule, like the `make` rule above, but i'm not opposed to making a separate rule for each of the `.def` files if that's what it takes.

cheers.

Answer: 
It's not an issue but it's recommended to split your app routes. Let's say you have an AppModule that contains 3 big modules. It's better having the main app-routing.module and a route module for each big module then having it in the same app-routing.module.

remove artists/:artistID, create artists.routes.ts, import it from your screenOneModule, and put your children in the created route

**app-routing.module.ts**

```
...
const routes: Routes = [
  {
    path: 'artists',
    loadChildren: () => import('./screens/screen-one/screen-one.module').then(mod => mod.ScreenOneModule),
  }
];
...

```

**artists.routes.ts**

```
...
export const routes: Routes = [
    path: 'artists',
    children: [
        {
            path: ':artistID',
            pathMatch: 'full',
            component: ArtistsComponent
        }
];
@NgModule({
    imports: [RouterModule.forChild(routes)],
    declarations: [],
    exports: [RouterModule],
    providers: []
})
export class ArtistRoutes{}

```

**screen-one.module.ts**

```
...
imports: [
    ...
    ArtistRoutes,
    ...
]
...

```
**Hey, what you suggested isn't an issue**. You could also map an array of routes:

```
const artistPaths: string[] = ['artist', 'artists/:artistID'];
const artistRoutes: Route[] = artistPaths.map((path) => ({path, loadChildren: () => null}));

```

Then either:

1. Push this into the routes array:

```
routes.push(artistRoutes);

```

2. Add it in the array definition directly:

```
const routes: Routes = [
  artistRoutes  
];

```