From 65f09be8d2aaeda054cce574ea14a74b00507011 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Wed, 30 Nov 2016 15:41:38 +0100 Subject: [PATCH] doc: mention the NO_MODULE option and target availability --- doc/TopicCMakeGuide.dox | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/TopicCMakeGuide.dox b/doc/TopicCMakeGuide.dox index 5362413d6..a540db68e 100644 --- a/doc/TopicCMakeGuide.dox +++ b/doc/TopicCMakeGuide.dox @@ -16,7 +16,7 @@ using the `find_package` CMake command and used by calling cmake_minimum_required (VERSION 3.0) project (myproject) -find_package (Eigen3 3.3 REQUIRED) +find_package (Eigen3 3.3 REQUIRED NO_MODULE) add_executable (example example.cpp) target_link_libraries (example Eigen3::Eigen) @@ -32,6 +32,15 @@ which requires at least version 3.3 of %Eigen. Here, `path-to-example-directory` is the path to the directory that contains both `CMakeLists.txt` and `example.cpp`. +If the `REQUIRED` option is omitted when locating %Eigen using +`find_package`, one can check whether the package was found as follows: +\code{.cmake} +find_package (Eigen3 3.3 NO_MODULE) + +if (TARGET Eigen3::Eigen) + # Use the imported target +endif (TARGET Eigen3::Eigen) +\endcode */