[CMake] 3rd party modules

Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA artur.kedzierski at navy.mil
Thu Sep 21 16:34:18 EDT 2006


	Thanks Brad.
	Let's say for project Foo and project Bar, I've created
a FooConfig.cmake and BarConfig.cmake. Project Foo uses Cmake
but Bar doesn't. During the installation, where should Foo and Bar place
the Config.cmake so that another project's CMake can easily find it?
Consider these scenarios:
1) Foo (cmake based) is installed on a system that has cmake
	Is there CMakeConfig.cmake that would tell me where 
      to install the FooConfig.cmake?
2) Bar (not cmake based) is installed on a system that has cmake.
      Is there cmake-config that would tell me where to install 
      BarConfig.cmake?
3) Bar (not cmake based) is installed on a system that doesn't have cmake.

	Should I install BarConfig.cmake in 
	$(datarootdir)/CMake/Modules (if Bar is using autotools)
	so that when CMake is installed later, BarConfig.cmake will be
	available.

	Please consider that they would be installed under
a) Linux
b) Windows

	I apreciate your help.
	Thank You.

--
Artur Kedzierski


-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Tuesday, September 19, 2006 7:16
To: Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA
Cc: CMake Mailing List
Subject: Re: [CMake] 3rd party modules

Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA wrote:
> 	Some packages provide modules/programs that
> provide information where they were installed. For
> example, "FooLibrary" may provide
> FooLibrary.m4 for auto-tools,
> FooLibrary.pc for pkg-confing,
> or
> Foo-config for anything else.
> 	As an author of a library, should I start 
> providing anything for Cmake for easier integration 
> (that works on multiple platforms)? 

You should create a "FooConfig.cmake" file, where "Foo" is your project
name and "Config.cmake" is that exact string (capitalization and all).
The file should have information about the installed copy of Foo with
which it comes.

FIND_PACKAGE(Foo)

will look for FindFoo.cmake first and if not found then create a Foo_DIR
cache entry that asks the user to locate FooConfig.cmake.  In the future
there will be better support for locating FooConfig.cmake automatically:

http://www.cmake.org/Bug/bug.php?op=show&bugid=3659

If you can't wait until that bug is implemented, install FooConfig.cmake
anyway and then create a small FindFoo.cmake that just looks for this
file and loads it.  Then post FindFoo.cmake for your users to copy into
their projects or for inclusion into CMake.

The key is that the FindFoo.cmake file cannot be distributed as part of
Foo's distribution because by the time CMake finds it it must have
already found the project anyway.

-Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4670 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20060921/6905cfe5/smime.bin


More information about the CMake mailing list