Skip to content

Fix small bug in finding mlpack if downloaded as dependency#3900

Merged
shrit merged 2 commits intomlpack:masterfrom
shrit:cmake_fix
Feb 28, 2025
Merged

Fix small bug in finding mlpack if downloaded as dependency#3900
shrit merged 2 commits intomlpack:masterfrom
shrit:cmake_fix

Conversation

@shrit
Copy link
Copy Markdown
Member

@shrit shrit commented Feb 25, 2025

Since mlpack include is inside a src/ directory, this is make it more complicated for CMake to find mlpack path if it is pulled as a dependency by the user. Therefore, to fix this we are setting directly the INCLUDE_PATH as the SEARCH_PATH as long as mlpack.hpp is found.

Other minor fixes are related to if /else logic. This will allow to set the directories when we find the library in a second round.

Since mlpack include is inside a `src/` directory, this is make it more
complicated for CMake to find mlpack path if it is pulled as a dependency
by the user. Therefore, to fix this we are setting directly the
INCLUDE_PATH as the SEARCH_PATH as long as mlpack.hpp is found.

Other minor fixes are related to if /else logic. This will allow to set the
directories when we find the library in a second round.

Signed-off-by: Omar Shrit <omar@avontech.fr>
@shrit shrit requested a review from rcurtin February 25, 2025 22:19
Copy link
Copy Markdown
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

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

I think I may have found a bug or two in the fix, let me know what you think. 👍

endif()
endif()
if (CEREAL_FOUND)
set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} ${CEREAL_INCLUDE_DIR})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I missed this on the initial review! It seems so obvious to see now. Anyway, glad to have it fixed 😄

Signed-off-by: Omar Shrit <omar@avontech.fr>
Copy link
Copy Markdown
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. Looks good to me now 👍

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Second approval provided automatically after 24 hours. 👍

@shrit shrit merged commit 2076090 into mlpack:master Feb 28, 2025
10 of 15 checks passed
@shrit shrit deleted the cmake_fix branch February 28, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants