Avoid building docs if cross-compiling or not top level.

This commit is contained in:
Antonio Sánchez 2023-10-23 17:55:01 +00:00 committed by Rasmus Munk Larsen
parent aa6964bf3a
commit 176821f2f7

View File

@ -491,7 +491,15 @@ endif()
install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
option(EIGEN_BUILD_DOC "Enable creation of Eigen documentation" ON) # Avoid building docs if included from another project.
# Building documentation requires creating and running executables on the host
# platform. We shouldn't do this if cross-compiling.
if (${PROJECT_IS_TOP_LEVEL} AND NOT ${CMAKE_CROSSCOMPILING})
set(EIGEN_BUILD_DOC_DEFAULT ON)
else()
set(EIGEN_BUILD_DOC_DEFAULT OFF)
endif()
option(EIGEN_BUILD_DOC "Enable creation of Eigen documentation" ${EIGEN_BUILD_DOC_DEFAULT})
if(EIGEN_BUILD_DOC) if(EIGEN_BUILD_DOC)
add_subdirectory(doc EXCLUDE_FROM_ALL) add_subdirectory(doc EXCLUDE_FROM_ALL)
endif() endif()