[CMake] CMake and include only libraries

Johannes Zarl Johannes.Zarl at jku.at
Tue Apr 5 07:38:02 EDT 2011


>> Honestly, headers seem sometimes a second class citizen in cmake: there
>> are some properties related to headers but few header knowledgeable
>> commands...
> I really don't see how CMake could automate this any more, or what
> additional information it could generate for you. 

Well, since you asked: it *would* be nice if cmake would know about the 
headers needed by a target, or even support header-only targets. Currently 
it feels like an artificial divide between shared object files and header 
files:

# find required dependency which correctly sets up import targets:
find_package(BAR)
# additional step for headers (with side-effects for other targets)...
include_directories(${BAR_INCLUDE_DIRS})
# ... that is not needed (and in fact discouraged) for libs:
#NO: link_directories(${BAR_LIBRARY_DIRS})
target_link_libraries(foo bar)

To be fair though, most other build-systems are not any better at 
handling header files. And since this feature request has already been
discussed in http://public.kitware.com/Bug/view.php?id=115, I'm content 
with it only being deferred, not dismissed...




-- 
Johannes Zarl
Virtual Reality Services

Johannes Kepler University
Informationsmanagement

Altenbergerstrasze 69
4040 Linz, Austria
Phone: +43 732 2468-8321
johannes.zarl at jku.at
http://vrc.zid.jku.at












More information about the CMake mailing list