[CMake] Creating a XXXConfigYYY.cmake file

Torri, Stephen CIV NSWCDD, W15 stephen.torri at navy.mil
Wed Nov 17 10:13:46 EST 2010


I have been reading email posts on goggle that says if you create a library then produce a <name>Config<version>cmake file rather than a Find<name>.cmake file. That is fine but what confuses me is:
 
1. What do I put in it? 
 
2. How do I install it? (e.g. Linux and Windows)
 
3. What google search terms should I use to find more information on this topic?
 
I have a large project is broken up into three separate projects each with their own CMakeLists.txt. For the sake of discussion lets call them Larry, Curly and Mo. Now Larry is the base library. Supposing I knew what I was doing I would create a LarryConfig1.0.cmake file and install it. I would do the same for the others. Do I just use find_package in the CMakeLists.txt of Curly and Mo to find the Larry library?
 
Is there a tutorial on how to do this? One full example (e.g. create config file, installing config file, using config file) would be sufficient to help me. Right now I can build the large project fine on Linux but on Windows I am having trouble of telling Curly where Larry is installed.
 
Stephen


More information about the CMake mailing list