Skip to content

Commit

Permalink
improve finding armadillo
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaskenezlego authored and tamaskenez committed Nov 6, 2024
1 parent 3bb34be commit 010fbce
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions cmake/carmaDependencyTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,29 @@ 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)
if(NOT ARMADILLO_INCLUDE_DIRS OR NOT ARMADILLO_LIBRARIES)
message(FATAL_ERROR "Armadillo_FOUND is true but ARMADILLO_INCLUDE_DIRS or ARMADILLO_LIBRARIES are not set.")
ENDIF ()
ADD_LIBRARY(armadillo::armadillo INTERFACE)
TARGET_INCLUDE_DIRECTORIES(armadillo::armadillo INTERFACE ${ARMADILLO_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(armadillo::armadillo INTERFACE ${ARMADILLO_LIBRARIES})
ENDIF ()
ENDIF ()
IF (TARGET armadillo::armadillo)
if(NOT ARMADILLO_INCLUDE_DIRS OR NOT ARMADILLO_LIBRARIES)
message(FATAL_ERROR "armadillo::armadillo is a target but ARMADILLO_INCLUDE_DIRS is not set.")
ENDIF ()
LIST(APPEND carma_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIRS})
ENDIF ()

Expand Down

0 comments on commit 010fbce

Please sign in to comment.