Hi CMake Discourse Gurus”
When the CMake Generator (cmake -G “Eclipse CDT4 - Unix Makefiles”) process the following command line found in CMakeLists.txt:
a Generated readme.md file states the following:
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)?
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”?
You cannot add custom
make snippets to the generated Makefiles. Tell CMake what you want so that it generates the desired effects.
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.
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.
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” ?
This is not possible. The Makefile that CMake generates is not relocatable.
Ben Boeckel already told you that 2 months ago in Disable compiler checks.