Hello All,<br><br>Let's suppose following<br><br>1. We have two projects A and B. <br>2. Project A is stored to <root>/A<br>3. Project B is stored to <root>/B<br>4. Project A depends on B. <br>5. Project B depends on A. (please don't ask me why:) )<br>
6. There is CMakeLists.txt in the <root><br><br><br>Following is a code of this projects (sample is attached).<br><br>#####################################<br># Project A<br>#####################################<br>
SET (PROJECT_NAME A )<br>PROJECT (${PROJECT_NAME})<br><br>INCLUDE_DIRECTORIES(<br> ${B_SOURCE_DIR}<br>)<br><br>FILE (GLOB ${PROJECT_NAME}_SOURCE_LIST<br> *.cpp<br>)<br><br>ADD_LIBRARY (${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE_LIST})<br>
<br>#####################################<br># Project B<br>#####################################<br>SET (PROJECT_NAME B )<br>PROJECT (${PROJECT_NAME})<br><br>INCLUDE_DIRECTORIES(<br> ${A_SOURCE_DIR}<br>)<br><br>FILE (GLOB ${PROJECT_NAME}_SOURCE_LIST<br>
*.cpp<br>)<br><br>ADD_LIBRARY (${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE_LIST})<br><br><br>And now we generate the project files and check Additional Includes Directories of the A project.<br><br>Expected it is equal to <root>/B. <br>
But in fact it is empty.<br><br>Suppose CMake processes INCLUDE_DIRECTORIES before all projects are loaded.<br><br>The other side of this problem is you have to write ADD_SUBDIRECTORY commands in specific order. IMHO it is inconvenient.<br>
<br><br>What do you think?<br><br><br><br>Regards,<br><br>Dima<br>