# CMake Generator Error for Unix Makefiles - Would like a Solution.

**URL:** https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385
**Category:** Usage
**Created:** [June 12, 2020, 8:50pm UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385 "2020-06-12T20:50:01Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Garry\_Anderson1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@Garry\_Anderson1](https://discourse.cmake.org/u/Garry_Anderson1)
#### Post date: [June 12, 2020, 8:50pm UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/1 "2020-06-12T20:50:01Z")

</div>

Hi CMake Discourse Gurus”

When the CMake Generator (cmake -G “Eclipse CDT4 - Unix Makefiles”) process the following command line found in CMakeLists.txt:

```auto
include_directories($(MACRO_UTILS_INC_FOLDER))

```

a Generated readme.md file states the following:

---

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [June 12, 2020, 10:47pm UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/2 "2020-06-12T22:47:00Z")

</div>

```cmake
include_directories(${MACRO_UTILS_INC_FOLDER})

```

---

<div class="post-metadata">

### Author: ![Garry\_Anderson1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@Garry\_Anderson1](https://discourse.cmake.org/u/Garry_Anderson1)
#### Post date: [June 12, 2020, 10:54pm UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/3 "2020-06-12T22:54:32Z")

</div>

Hi Jim:

Thanks for the reply.

I do not see this “include\_directories” in the generated makefile.

Do I have to add “include\_directories" manually to each “makefile” that has been generated in the solution (over a dozen places)?

Thanks,  
Garry.

---

<div class="post-metadata">

### Author: ![Garry\_Anderson1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@Garry\_Anderson1](https://discourse.cmake.org/u/Garry_Anderson1)
#### Post date: [June 12, 2020, 11:17pm UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/4 "2020-06-12T23:17:52Z")

</div>

Hi Jim:

I tried adding this suggestion into the generated makefile (which has a warning - do not edit), but when I run command-line “make” I get an error about “missing separator” for the added line.

Is something wrong with the syntax, or is “include\_directories” not recognized as a valid command by “make”?

Thanks,  
Garry.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 13, 2020, 1:22am UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/5 "2020-06-13T01:22:27Z")

</div>

You cannot add custom `make` snippets to the generated Makefiles. Tell CMake what you want so that it generates the desired effects.

---

<div class="post-metadata">

### Author: ![Garry\_Anderson1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@Garry\_Anderson1](https://discourse.cmake.org/u/Garry_Anderson1)
#### Post date: [June 14, 2020, 1:20am UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/6 "2020-06-14T01:20:21Z")

</div>

Hi Ben:

Thanks for your support. What you say is what I thought. A generated makefile should not be modified.

But, when the Generator does not create commands in makefile to “include\_directories” that are required for correct compilation, then perhaps the Generator needs to be instructed to process the “include\_directories” command and explicitly put the correct directory paths into the generated makefile.

Do you know how to get CMake Generator to put those “include\_directories” into the resulting makefile. If you don’t know, then were can I go to get the solution.

Thanks,  
Garry.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 14, 2020, 2:18am UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/7 "2020-06-14T02:18:53Z")

</div>

CMake’s `include_directories()` command does that (as does `target_include_directories` which is the preferred one). However, the value must be known when CMake runs; you cannot defer expansion of the variable until build time.

---

<div class="post-metadata">

### Author: ![Garry\_Anderson1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@Garry\_Anderson1](https://discourse.cmake.org/u/Garry_Anderson1)
#### Post date: [June 14, 2020, 9:03am UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/8 "2020-06-14T09:03:18Z")

</div>

Hi Ben:

Perhaps I was not clear about the problem. CMake include\_directories works fine wiht CMake.

BUT, I need to have “make makefile” work running “make” not running “cmake”.

The Generator is supposed to create a Unix Makefile, but the created makefile has lost the directories. It looks like they were not included in the Generation process.

The objective is to have “make makefile” run on a different target machine which only supports “make” but does not support “cmake”

So, how can I get the Generator to process the “include\_directories” correctly and put something in the generated “makefile” ?

Thanks,  
Garry.

---

<div class="post-metadata">

### Author: ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)
#### Post date: [June 14, 2020, 10:00am UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/9 "2020-06-14T10:00:15Z")

</div>

> [@Garry\_Anderson1](#):
>
> The objective is to have “make makefile” run on a different target machine which only supports “make” but does not support “cmake”

This is not possible. The Makefile that CMake generates is not relocatable.

---

<div class="post-metadata">

### Author: ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)
#### Post date: [June 14, 2020, 10:10am UTC](https://discourse.cmake.org/t/cmake-generator-error-for-unix-makefiles-would-like-a-solution/1385/10 "2020-06-14T10:10:39Z")

</div>

Ben Boeckel already told you that 2 months ago in [Disable compiler checks](https://discourse.cmake.org/t/disable-compiler-checks/735/7).
