Skip to content

Commit

Permalink
BLD: Improve finding Armadillo by the installed library (#132)
Browse files Browse the repository at this point in the history
* improve finding armadillo

* fix condition

* Fix if/else/endif style

* remove checks, fix interface target

* revert some inconsistent if style
  • Loading branch information
tamaskenez authored Nov 9, 2024
1 parent 3bb34be commit 9c45ef3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmake/carmaDependencyTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

Expand Down

0 comments on commit 9c45ef3

Please sign in to comment.