<div dir="ltr"><div><div><div>Hi all,<br><br></div>Porting a collection of IAR Embedded Workbench projects to CMake/GCC.  <br><br>The
 IAR projects make use of "preinclude headers" (header files that are 
automatically included in every source file in the project without being
 explicitly pulled in with a #include statement - not to be confused 
with precompiled headers).  These map nicely to the GCC "-include 
<filename>" directive and I can manually implement it in my 
CMakeList.txt file as follows<br><br><br>    set(PREINCLUDE_FILE "${PROJ_BASE_DIR}/some-path/preinclude.h")<br><br>    ...<br><br>    if (PREINCLUDE_FILE)<br>        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${PREINCLUDE_FILE}")<br>    endif()<br><br></div>and
 generate a makefile that builds OK.  However when I use CMake to 
generate an Eclipse project there is no consideration given to the 
preinclude header file(s).<br><br>In my case the preinclude contains several 
preprocessor definitions that effectively drive the configuration of the
 rest of the system during compilation - without them the Eclipse CDT 
Indexer does not get all the definitions required to make sense of the 
codebase and requires additional manual configuration before it will do 
anything useful.<br><br></div>Is there any way to automate this from the CMakeList.txt file?</div>