[CMake] Problem with circular dependencies
Dmytro Ovdiienko
dmitriy.ovdienko at gmail.com
Thu May 28 13:56:04 EDT 2009
Hello All,
Let's suppose following
1. We have two projects A and B.
2. Project A is stored to <root>/A
3. Project B is stored to <root>/B
4. Project A depends on B.
5. Project B depends on A. (please don't ask me why:) )
6. There is CMakeLists.txt in the <root>
Following is a code of this projects (sample is attached).
#####################################
# Project A
#####################################
SET (PROJECT_NAME A )
PROJECT (${PROJECT_NAME})
INCLUDE_DIRECTORIES(
${B_SOURCE_DIR}
)
FILE (GLOB ${PROJECT_NAME}_SOURCE_LIST
*.cpp
)
ADD_LIBRARY (${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE_LIST})
#####################################
# Project B
#####################################
SET (PROJECT_NAME B )
PROJECT (${PROJECT_NAME})
INCLUDE_DIRECTORIES(
${A_SOURCE_DIR}
)
FILE (GLOB ${PROJECT_NAME}_SOURCE_LIST
*.cpp
)
ADD_LIBRARY (${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE_LIST})
And now we generate the project files and check Additional Includes
Directories of the A project.
Expected it is equal to <root>/B.
But in fact it is empty.
Suppose CMake processes INCLUDE_DIRECTORIES before all projects are loaded.
The other side of this problem is you have to write ADD_SUBDIRECTORY
commands in specific order. IMHO it is inconvenient.
What do you think?
Regards,
Dima
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090528/99bf44ed/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.zip
Type: application/zip
Size: 1214 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090528/99bf44ed/attachment.zip>
More information about the CMake
mailing list