[CMake] hear hear

Alexander Neundorf a.neundorf-work at gmx.net
Tue Dec 20 12:29:25 EST 2011


On Tuesday 20 December 2011, Benjamin Eikel wrote:
> Hello Alexander,
> 
> Am Montag, 19. Dezember 2011 um 21:19:04 schrieb Alexander Neundorf:
> > On Monday 19 December 2011, Benjamin Eikel wrote:
> > > Hello Alexander,
> > > 
> > > Am Montag, 12. Dezember 2011, 21:51:54 schrieb Alexander Neundorf:
> > > > Here is an example which shows just that:
> > > > https://projects.kde.org/projects/kde/kdeexamples/repository/revision
> > > > s/ ma st er/show/buildsystem/HowToInstallALibrary
> > > > 
> > > > It's not "final" yet, i.e. I'll work on improving it in the next
> > > > weeks.
> > > 
> > > thank you very much for this example project. It helped me a lot to
> > > understand especially the EXPORT usage.
> > > 
> > > I know that you wrote that the project is not finished yet, but allow
> > > me to ask a question:
> > > 
> > > In the "example/CMakeLists.txt": Is line 5, which calls
> > > "include(FindPackageHandleStandardArgs)", really needed? I think if
> > > BAR_FOUND would be checked, it should be called.
> > 
> > Line 6 is commented out because it relies on a feature in cmake 2.8.3,
> > but when I committed the example I made it depend only on 2.6.4.
> > 
> > Does that answer your question ?
> 
> Yes, it's clear now.
> 
> > > I would greatly appreciate it if you could extend the example, or
> > > provide a second example, that uses an external library. So for
> > > example a library Foo depending on LibXml2. Some functionality of Foo
> > > depends on whether LibXml2 was found or not. Therefore it creates
> > > "Foo_Config.h" with
> > > "configure_file" defining something like LIB_XML2. I would like to see
> > > how this could be correctly installed and found by an application using
> > > Foo. Would it be simply adding the config header file to the set of
> > > exported header files?
> > 
> > I'd put that information into the installed FooConfig.cmake, something
> > like: set(FOO_HAS_LIBXML2_FEATURES TRUE)
> 
> Okay. Then it would be possible to set compile definitions depending on
> this variable. But it would only work for projects using CMake, too. The
> header file could be used by projects using any build system.

You can put the information of course in both places.

Alex


More information about the CMake mailing list