doc: mention the NO_MODULE option and target availability

(grafted from 65f09be8d2aaeda054cce574ea14a74b00507011
)
This commit is contained in:
Sergiu Deitsch 2016-11-30 15:41:38 +01:00
parent 5c516e4e0a
commit 3440b46e2f

View File

@ -16,7 +16,7 @@ using the `find_package` CMake command and used by calling
cmake_minimum_required (VERSION 3.0) cmake_minimum_required (VERSION 3.0)
project (myproject) project (myproject)
find_package (Eigen3 3.3 REQUIRED) find_package (Eigen3 3.3 REQUIRED NO_MODULE)
add_executable (example example.cpp) add_executable (example example.cpp)
target_link_libraries (example Eigen3::Eigen) 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 is the path to the directory that contains both `CMakeLists.txt` and
`example.cpp`. `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
*/ */