-
Notifications
You must be signed in to change notification settings - Fork 0
cmake: optional dependency search paths #3
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,8 +15,10 @@ endif() | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if(NOT TARGET decodeless::allocator) | ||||||||||||||||||||||||||
| if(DECODELESS_SEARCH_DEPENDENCIES) | ||||||||||||||||||||||||||
| option(DECODELESS_ALLOCATOR_SEARCH_PATH | ||||||||||||||||||||||||||
| "${CMAKE_CURRENT_LIST_DIR}/../allocator") | ||||||||||||||||||||||||||
| find_package(decodeless_allocator REQUIRED CONFIG PATHS | ||||||||||||||||||||||||||
| "${CMAKE_CURRENT_LIST_DIR}/../../allocator") | ||||||||||||||||||||||||||
| "${DECODELESS_ALLOCATOR_SEARCH_PATH}") | ||||||||||||||||||||||||||
|
Comment on lines
17
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) 🛠️ Refactor suggestion Refactor String-Based Dependency Path Option A new option DECODELESS_ALLOCATOR_SEARCH_PATH is introduced to customize the search path for decodeless_allocator. Similar to the main CMakeLists.txt, using option() here for a path is not ideal because option() is reserved for booleans. Switching to set() with a CACHE type PATH will ensure the variable is treated as a string instead of a boolean value. Apply this change with the following diff: - option(DECODELESS_ALLOCATOR_SEARCH_PATH
- "${CMAKE_CURRENT_LIST_DIR}/../allocator")
+ set(DECODELESS_ALLOCATOR_SEARCH_PATH "${CMAKE_CURRENT_LIST_DIR}/../allocator" CACHE PATH "Path to decodeless_allocator")This change will make the configuration more robust when users provide custom paths. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
| elseif(DECODELESS_FETCH_DEPENDENCIES) | ||||||||||||||||||||||||||
| include(FetchContent) | ||||||||||||||||||||||||||
| FetchContent_Declare( | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Reconsider Using option() for a Path Variable
A new option DECODELESS_OFFSET_PTR_SEARCH_PATH has been introduced and used to pass a custom search path to find_package. However, the option() command is meant for boolean values. For a path string, it is best practice to use set() with a CACHE entry of type PATH to ensure proper type handling and caching behavior.
Consider replacing the declaration with the following diff:
📝 Committable suggestion