Cannot switch modules of Learning group seperately for native build

Description

I tried to enable only LibSVM and OpenCV for the learning module in a native build with:

-DOTB_USE_OPENCV=ON
-DOTB_USE_LIBSVM=ON
-DOTB_USE_SHARK=OFF 

However, the cmake config summary shows:

OTB_USE_LIBSVM            = OFF
OTB_USE_OPENCV            = OFF
OTB_USE_SHARK             = OFF

And the learning module will miss lots of algorithms

Screenshot_20240410_224115

If I set

-DOTBGroup_Learning=ON
-DOTB_USE_OPENCV=ON
-DOTB_USE_LIBSVM=ON
-DOTB_USE_SHARK=OFF 

Then it will complain not finding SHARK library

Steps to reproduce

Use this CMAKE command:

  mkdir build

  cd build

  cmake ../ \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/usr \
  -DBUILD_EXAMPLES=OFF \
  -DBUILD_TESTING=OFF \
  -DOTB_USE_CURL=ON \
  -DOTB_WRAP_PYTHON=ON \
  -DBUILD_SHARED_LIBS=ON \
  -DOTBGroup_FeaturesExtraction=ON \
  -DOTBGroup_Hyperspectral=ON \
  -DOTBGroup_Miscellaneous=ON \
  -DOTBGroup_Remote=ON \
  -DOTBGroup_SAR=ON \
  -DOTBGroup_Segmentation=ON \
  -DOTBGroup_StereoProcessing=ON \
  -DOTB_USE_OPENCV=ON \
  -DOTB_USE_MUPARSER=ON \
  -DOTB_USE_MUPARSERX=OFF \
  -DOTB_USE_LIBKML=ON \
  -DOTB_USE_LIBSVM=ON \
  -DOTB_USE_OPENMP=ON \
  -DOTB_USE_6S=ON \
  -DOTB_DATA_USE_LARGEINPUT=ON \
  -DOTB_USE_SHARK=OFF \
  -DITK_DIR=/opt/insight-toolkit4 \
  -DCMAKE_PREFIX_PATH=/opt/insight-toolkit4 \
  -DCMAKE_CXX_STANDARD=17 \
  -DBoost_USE_STATIC_LIBS=ON
         
  make

The OTB cmake summary will be:

======================= Begin of OTB cmake summary =======================

CMAKE_SOURCE_DIR          = /home/o0331dobe/Downloads/orfeo-toolbox/src
CMAKE_BINARY_DIR          = /home/o0331dobe/Downloads/orfeo-toolbox/src/build
CMAKE_INSTALL_PREFIX      = /usr
CMAKE_COMMAND             = /usr/bin/cmake
CMAKE_C_COMPILER          = /usr/bin/cc
CMAKE_CXX_COMPILER        = /usr/bin/c++
CMAKE_MAKE_PROGRAM        = /usr/bin/make
CMAKE_GENERATOR           = Unix Makefiles
CMAKE_BUILD_TYPE          = Release
CMAKE_C_FLAGS             =   -Wno-uninitialized -Wno-unused-parameter -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto 
CMAKE_CXX_FLAGS           =  -fopenmp -msse2 -mfpmath=sse  -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto 
OTB_USE_6S                = ON
OTB_USE_CURL              = ON
OTB_USE_GSL               = OFF
OTB_USE_LIBKML            = ON
OTB_USE_LIBSVM            = OFF
OTB_USE_MUPARSER          = ON
OTB_USE_MUPARSERX         = ON
OTB_USE_OPENCV            = OFF
OTB_USE_SHARK             = OFF
OTB_USE_SIFTFAST          = ON
OTB_WRAP_PYTHON           = ON
OTB_WRAP_QGIS             = ON
OTB_DATA_ROOT             = /home/o0331dobe/Downloads/orfeo-toolbox/src/Data
OTB_USE_OPENMP            = ON
OTB_USE_SSE_FLAGS         = ON
Boost                     = 1.83.0
Boost_DIR                 = /usr/lib/cmake/Boost-1.83.0
GDAL                      = 3.8.4
GDAL_INCLUDE_DIR          = /usr/include
GDAL_LIBRARY              = /usr/lib/libgdal.so
GEOTIFF                   = 
ITK                       = 4.13.3
ITK_DIR                   = /opt/insight-toolkit4/lib/cmake/ITK-4.13
TINYXML                   = 2.6.2
TINYXML_INCLUDE_DIR       = /usr/include
TINYXML_LIBRARY           = /usr/lib/libtinyxml.so

CMake 3.28.3 successfully configured OTB using Unix Makefiles generator

Reproducibility: Always

Configuration information

Native build
OS: Manjaro Linux stable branch
OTB version: 9.0.0
OpenCV version: 4.9.0
LibSVM version: 3.32