FindArmadillo

Finds the Armadillo C++ library:

find_package(Armadillo [<version>] [...])

Armadillo is a library for linear algebra and scientific computing.

Added in version 3.18: Support for linking wrapped libraries directly (see the ARMA_DONT_USE_WRAPPER preprocessor macro that needs to be defined before including the <armadillo> header).

Result Variables

This module defines the following variables:

Armadillo_FOUND

Boolean indicating whether the (requested version of) Armadillo library is found. For backward compatibility, the ARMADILLO_FOUND variable is also set to the same value.

Armadillo_VERSION

Added in version 4.2.

The version of Armadillo found (e.g., 14.90.0).

Armadillo_VERSION_NAME

Added in version 4.2.

The version name of Armadillo found (e.g., Antipodean Antileech).

ARMADILLO_INCLUDE_DIRS

List of required include directories.

ARMADILLO_LIBRARIES

List of libraries to be linked.

Deprecated Variables

The following variables are provided for backward compatibility:

ARMADILLO_VERSION_STRING

Deprecated since version 4.2: Superseded by the Armadillo_VERSION.

The version of Armadillo found.

ARMADILLO_VERSION_MAJOR

Deprecated since version 4.2: Superseded by the Armadillo_VERSION.

Major version number.

ARMADILLO_VERSION_MINOR

Deprecated since version 4.2: Superseded by the Armadillo_VERSION.

Minor version number.

ARMADILLO_VERSION_PATCH

Deprecated since version 4.2: Superseded by the Armadillo_VERSION.

Patch version number.

ARMADILLO_VERSION_NAME

Deprecated since version 4.2: Superseded by the Armadillo_VERSION_NAME.

The version name of Armadillo found (e.g., Antipodean Antileech).

Examples

Finding Armadillo and creating an imported target:

find_package(Armadillo REQUIRED)

if(Armadillo_FOUND AND NOT TARGET Armadillo::Armadillo)
  add_library(Armadillo::Armadillo INTERFACE IMPORTED)
  set_target_properties(
    Armadillo::Armadillo
    PROPERTIES
      INTERFACE_LINK_LIBRARIES "${ARMADILLO_LIBRARIES}"
      INTERFACE_INCLUDE_DIRECTORIES "${ARMADILLO_INCLUDE_DIRS}"
  )
endif()

add_executable(foo foo.cc)
target_link_libraries(foo PRIVATE Armadillo::Armadillo)