Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use blasfeoConfig.cmake when building with BUILD_WITH_BLASFEO=OFF #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,7 @@ if (BUILD_WITH_BLASFEO)
add_subdirectory(blasfeo)

else()
set(BLASFEO_INSTALL_DIR "/opt/blasfeo" CACHE PATH "Path to blasfeo installation directory")
# find_library(blasfeo NAMES blasfeo PATHS ${BLASFEO_INSTALL_DIR}/lib)

find_path(BLASFEO_INCLUDE_DIR NAMES "blasfeo.h" PATHS ${BLASFEO_INSTALL_DIR}/include)
find_library(BLASFEO_LIBRARY NAMES blasfeo HINTS ${BLASFEO_INSTALL_DIR}/lib)

# Create an imported static target for blasfeo
add_library(blasfeo STATIC IMPORTED GLOBAL)
# Set the path to the library file
set_target_properties(blasfeo PROPERTIES IMPORTED_LOCATION ${BLASFEO_LIBRARY})

# Set the path to the include directory
set_target_properties(blasfeo PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${BLASFEO_INCLUDE_DIR})
find_package(blasfeo REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_package(blasfeo REQUIRED)
find_package(blasfeo REQUIRED CONFIG)

If the goal is to use blasfeoConfig.cmake, we can make that explicit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I am not a big fan of this, but this is mostly personal taste/bikeshedding. If someone wants to use fatrop in a bigger CMake project via add_subdirectory/FetchContent, they may want to override the logic happening in find_package(blasfeo REQUIRED) with something custom, for whatever reason. This can be done by adding a Findblasfeo.cmake in the CMAKE_MODULE_PATH, but this will not work if downstream projects manually add CONFIG in their find_package calls. However, I do not feel strongly about this, so if mantainers perfer to have it it is ok for me to have it.


endif()

Expand Down
Loading