[CMake] Compiling header files

David Doria daviddoria at gmail.com
Tue Nov 16 14:24:34 EST 2010


Ryan,

The issue is that these headers are only used internally to this
collection of files, so I don't want to have to include them in my
code. Here is a skeleton:

The files I've been given
----------
External.h
External.cpp
Internal.h (used by External)
Internal.cpp

My files
------------
MyCode.cpp

So I wanted to

ADD_LIBRARY(TheLibrary External.cpp Internal.cpp)

Then

ADD_EXECUTABLE(MyCode MyCode.cpp)
target_link_libraries(MyCode TheLibrary)

where MyCode.cpp has only an #include "External.h"

See what I mean?

David


More information about the CMake mailing list