The issue is hopefully pretty easy to resolve. When you do this...
set(ARMADILLO_LIBRARY "C:\\Program Files (x86)\\armadillo\\lib")
set(ARMADILLO_INCLUDE_DIR "C:\\Program Files (x86)\\armadillo\\include")
you're effectively short-circuiting the find_package(Armadillo 2.4.2 REQUIRED)
call, since it expects to have to do the work to find these paths. However, when find_package
does the work, the variable ARMADILLO_LIBRARY
gets set to the path to the library itself - not the path to the lib's directory.
So the problem boils down to setting ARMADILLO_LIBRARY
to the path to the lib's directory rather than the lib itself. This ultimately yields a linker error since the target gmm
(added in src\mlpack\methods\gmm\CMakeLists.txt) links to mlpack
, and mlpack
has been set to link to ${ARMADILLO_LIBRARIES}
, which isn't set correctly.
It turns out that find_package(Armadillo ...)
already checks in "$ENV{ProgramFiles}/Armadillo/lib"
and "$ENV{ProgramFiles}/Armadillo/include"
, and I expect these resolve to "C:\\Program Files (x86)\\armadillo\\lib"
and "C:\\Program Files (x86)\\armadillo\\include"
on your machine.
So to fix this, you should delete the lines setting ARMADILLO_LIBRARY
and ARMADILLO_INCLUDE_DIR
, and revert your change in src\mlpack\CMakeLists.txt (using link_directories
is generally a bad idea anyway).
After making these changes, you should delete at least your CMakeCache.txt (in the root of your build tree), or even your entire build tree before re-running CMake to avoid the possibility of using bad cached values from previous failed attempts.