[CMake] Please critique my "hello world" CMakeLists.txt and Config.cmake
Chris Stankevitz
chrisstankevitz at gmail.com
Sun Feb 24 14:39:40 EST 2013
On Sun, Feb 24, 2013 at 2:20 AM, Alexander Neundorf <neundorf at kde.org> wrote:
> * "export" the target (use the EXPORT option in install(TARGETS))
> * the install this "export", using install(EXPORT ...), this will install a
> cmake script file
> * include() this export-file in the Config.cmake file
> * use configure_package_config_file() instead of the plain configure_file() to
> configure the file. This will help with absolute and relative paths etc.
Alexander,
First, thank you for your reply. This was exactly the kind of help I
was looking for.
Second, I attempted to follow your instructions. I am a big proponent
of cmake at work. I love how simple it is to create a "hello world"
project (particularly when compared to autotools). However, my head
is spinning with the new jargon needed to properly install a simple
"hello world" package. Even after reading the docs and wiki I don't
really understand what I am doing, I more or less just tried to copy
it. Most of the EXPORT and CONFIGURE_PACKAGE docs seem to be geared
toward someone who already knows the "old" way of installing and just
needs a refresher to the new style. I hope my "hello" project, once
it meets your approval, can be used to assist other new packagers in
the future.
Third, would you please take a look at my updated "hello" project and
the new "hello-client" project? As you might imagine, hello-client is
an executable that uses the hello library. I have done something
wrong in hello, hello-client, or both as hello-client fails to
compile. I suspect that among other mistakes, I should have some
SET_AND_CHECKs in my Config.cmake.in file. I also suspect that my
hello-client is missing a FIND_PACKAGE reference.
github links:
https://github.com/chrisstankevitz/hello
https://github.com/chrisstankevitz/hello-client
git clone links:
git://github.com/chrisstankevitz/hello.git
git://github.com/chrisstankevitz/hello-client.git
Thank you again for your help,
Chris
More information about the CMake
mailing list