From d3ae0fff7dea00775f8c6e8bed59a494f102999c Mon Sep 17 00:00:00 2001
From: Alex Neundorf <neundorf@kde.org>
Date: Wed, 10 Aug 2011 02:05:33 +0200
Subject: Improve documentation for --find-package mode

Alex
---
 Modules/CMakeFindPackageMode.cmake | 16 ++++++++++------
 Source/cmakemain.cxx               |  4 +++-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 3e7376c..2ce4fe6 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -1,8 +1,12 @@
-# COMPILER_ID = GNU/Intel/Clang/MSVC, etc.
-# LANGUAGE = C/CXX/Fortan/ASM
-# MODE = EXIST/COMPILE/LINK
-# NAME = name of the package
-# QUIET = if TRUE, don't print anything
+# This file is executed by cmake when invoked with --find-package.
+# It expects that the following variables are set using -D:
+#   NAME = name of the package
+#   COMPILER_ID = the CMake compiler ID for which the result is, i.e. GNU/Intel/Clang/MSVC, etc.
+#   LANGUAGE = language for which the result will be used, i.e. C/CXX/Fortan/ASM
+#   MODE = EXIST : only check for existance of the given package
+#          COMPILE : print the flags needed for compiling an object file which uses the given package
+#          LINK : print the flags needed for linking when using the given package
+#   QUIET = if TRUE, don't print anything
 
 #=============================================================================
 # Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org>
@@ -18,7 +22,7 @@
 #  License text for the above reference.)
 
 if(NOT NAME)
-  message(FATAL_ERROR "NAME argument not specified.")
+  message(FATAL_ERROR "Name of the package to be searched not specified. Set the CMake variable NAME, e.g. -DNAME=JPEG .")
 endif()
 
 if(NOT COMPILER_ID)
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index c744dcd..828d2aa 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -104,7 +104,9 @@ static const char * cmDocumentationOptions[][3] =
    "before the -P argument."},
   {"--find-package", "Run in pkg-config like mode.",
    "Search a package using find_package() and print the resulting flags "
-   "to stdout. "},
+   "to stdout. This can be used to use cmake instead of pkg-config to find "
+   "installed libraries in plain Makefile-based projects or in "
+   "autoconf-based projects (via share/aclocal/cmake.m4)."},
   {"--graphviz=[file]", "Generate graphviz of dependencies.",
    "Generate a graphviz input file that will contain all the library and "
    "executable dependencies in the project."},
-- 
cgit v0.12