In my CMake-based project, I include another library as a subdir:
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(LIBIGL_INSTALL OFF)
include(libigl)
# cmake/libigl.cmake contains:
#include(FetchContent)
#FetchContent_Declare(
# libigl
# GIT_REPOSITORY https://github.com/libigl/libigl.git
# GIT_TAG v2.5.0
#)
#FetchContent_MakeAvailable(libigl)
then my CMake builds something using libigl, and installs it.
But libigl’s CMake is installing also some Eigen header files, which I do not want.
This is happening because in libigl/cmake/recipes/external/eigen.cmake install(...)
commands are added unconditionally.
Ideally I’d wrap those lines in if(EIGEN_INSTALL) ... endif()
, but I have no control over that. I have control only over my CMake project.
Can I instead remove all the previously created install rules (e.g. just before adding mine)?