[CMake] Standard template for building and installing a library

Matthew Woehlke matthew.woehlke at kitware.com
Tue Sep 10 18:43:06 EDT 2013


On 2013-09-10 17:38, Littlefield, Tyler wrote:
> First, I can create a demo directory and from there I can have a
> cmakelists.txt per demo. Is there a way somehow to link to the generated
> static library?

Sounds like you are looking for 'target_link_libraries'?

> If I move the CXXFLAGS_DEBUG/etc to a higher level file, is there a way
> to insure that it promotes down?

I'm not sure there is such a thing as a non-inheriting variable in CMake 
:-). There are global properties, but they're, well, global...

IOW, anything (scoped) you set in one scope is visible to all 'child' 
scopes, be they directories, functions, etc. So you don't need to do 
anything; it will happen automatically.

> My final question is how to make the debug/release build work, as well
> as to allow to let this install. I need to install libxlog.a and the
> include directory
> as well to includedir/xlog/*. Is there a typical method to do this?

See the 'install' command.

-- 
Matthew



More information about the CMake mailing list