[CMake] KDevelop file list contains duplicate header file entries for libraries

Jens Hannemann j.hannemann at ieee.org
Thu Dec 7 16:23:45 EST 2006


Hi folks,

I'm trying to build a library with the following directory structure:

foo
 |
 +--libfoo
 |    |
 |    +--foo.cpp
 |
 +--foo
      |
      +--foo.h

This keeps the header files containing the API separate and allows for 
inclusion in the #include <foo/foo.h> style.

The top-level CMakeLists.txt looks like this:

PROJECT(foo)
INCLUDE_DIRECTORIES(foo)
ADD_SUBDIRECTORY(libfoo)

and libfoo/CMakeLists.txt:

SET(LIBFOO_HEADERS ${PROJECT_SOURCE_DIR}/foo/foo.h)
SET(LIBFOO_SOURCES foo.cpp)
ADD_LIBRARY(foo SHARED ${LIBFOO_HEADERS} ${LIBFOO_SOURCES})
INSTALL(TARGETS foo DESTINATION lib)
INSTALL(FILES ${LIBFOO_HEADERS} DESTINATION include/foo)

This works fine with the usual Unix Makefiles generator (as a matter of fact, 
I can actually drop the LIBFOO_HEADERS dependency in ADD_LIBRARY, and the 
packages and dependencies are generated just fine). But when using the 
KDevelop3 generator, the file list generated contains a duplicate foo.h:

# KDevelop Custom Project File List
foo/foo.h
CMakeLists.txt
foo/foo.h
libfoo/CMakeLists.txt
libfoo/foo.cpp

When I drop the LIBFOO_HEADERS from ADD_LIBRARY, foo.h is not included in the 
file list at all. The question is:

Is this a bug? If so, what should be the correct behavior (I would guess not 
mentioning the headers in ADD_LIBRARY)? If not, what am I doing wrong?

Thanks for any help,

Jens

-- 
Dr.-Ing. Jens Hannemann --- j.hannemann at ieee.org --- GPG Key Available
University of Kentucky -- Dept. of Electrical and Computer Engineering
Center for Visualization and Virtual Environments


More information about the CMake mailing list