diff --git a/cmake/carmaDependencyTargets.cmake b/cmake/carmaDependencyTargets.cmake index 080f929..e2179cd 100644 --- a/cmake/carmaDependencyTargets.cmake +++ b/cmake/carmaDependencyTargets.cmake @@ -25,18 +25,24 @@ IF (NOT DEFINED PYTHON_EXECUTABLE) ENDIF () # Armadillo dependency -IF (NOT TARGET armadillo) +IF (NOT TARGET armadillo AND NOT TARGET armadillo::armadillo) IF (carma_FIND_REQUIRED) FIND_PACKAGE(Armadillo REQUIRED) ELSE () FIND_PACKAGE(Armadillo) ENDIF () - ADD_LIBRARY(armadillo INTERFACE) - TARGET_INCLUDE_DIRECTORIES(armadillo INTERFACE ${ARMADILLO_INCLUDE_DIRS}) - TARGET_LINK_LIBRARIES(armadillo INTERFACE ${ARMADILLO_LIBRARIES}) ENDIF () -IF (armadillo_FOUND OR ARMADILLO_FOUND OR TARGET armadillo) - ADD_LIBRARY(armadillo::armadillo ALIAS armadillo) +IF (NOT TARGET armadillo::armadillo) + IF (TARGET armadillo) + ADD_LIBRARY(armadillo::armadillo ALIAS armadillo) + ELSEIF (Armadillo_FOUND) + ADD_LIBRARY(armadillo INTERFACE) + TARGET_INCLUDE_DIRECTORIES(armadillo INTERFACE ${ARMADILLO_INCLUDE_DIRS}) + TARGET_LINK_LIBRARIES(armadillo INTERFACE ${ARMADILLO_LIBRARIES}) + ADD_LIBRARY(armadillo::armadillo ALIAS armadillo) + ENDIF () +ENDIF () +IF (TARGET armadillo::armadillo) LIST(APPEND carma_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIRS}) ENDIF ()