[CMake] INCLUDE_DIRECTORIES with SUBDIRS

Stefan Kowski Stefan.Kowski at gmx.de
Tue Nov 29 10:48:38 EST 2005


Hi,

I am using CMake 2.0.6 on Windows and have a problem with the
INCLUDE_DIRECTORIES statement.

I try to compile two shared library (referred to as lib1 and lib2), each of
them using a component X, but in different versions. Each library has its 
own CMakeLists.txt that includes X's include directory. So lib1 includes 
X1/include, lib2 includes X2/include.

simplified directory structure:

  CMakeLists.txt         SUBDIRS(lib1 lib2)
  lib1/
     CMakeLists.txt      INCLUDE_DIRECTORIES(X1/include)
  lib2/
     CMakeLists.txt      INCLUDE_DIRECTORIES(X2/include)
  
In the generated .dsw files for Visual Studio 6, I see that lib1 includes
X1/include, but lib2 includes X1/include and X2/include, breaking the
build of lib2 as wrong headers are included.

As I checked the documentation, I found that the INCLUDE_DIRECTORIES 
expands a 'global' include path with each statement, even across sibling 
directories (link: http://www.cmake.org/HTML/WritingCMakeLists.html).

Is there another way to modify the include path locally in the lib1 and 
lib2 projects that does not propagate to the parent or sibling projects?

Best regards,
Stefan

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++


More information about the CMake mailing list