Skip to content

Use target include instead of raw include#1784

Merged
Dead2 merged 1 commit intozlib-ng:developfrom
FantasqueX:use-target-include-1
Sep 20, 2024
Merged

Use target include instead of raw include#1784
Dead2 merged 1 commit intozlib-ng:developfrom
FantasqueX:use-target-include-1

Conversation

@FantasqueX
Copy link
Copy Markdown
Contributor

CMake recommends using target_include_directories instead of include_directories. https://cmake.org/cmake/help/latest/command/include_directories.html

Some downstream projects such as opencv integrate zlib-ng to their source code. In those cases, less include_directories is better.

@FantasqueX FantasqueX changed the title Use target include install raw include Use target include instead of raw include Sep 17, 2024
@nmoinvaz
Copy link
Copy Markdown
Member

I'm not sure about removing ${CMAKE_CURRENT_SOURCE_DIR} but the CI should say if there is a problem.

@FantasqueX
Copy link
Copy Markdown
Contributor Author

I'm not sure about removing ${CMAKE_CURRENT_SOURCE_DIR} but the CI should say if there is a problem.

target_include_directories(${ZLIB_INSTALL_LIBRARY} PUBLIC
        "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}$<SEMICOLON>${CMAKE_CURRENT_SOURCE_DIR}>"
        "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")

The code above does the same thing as include_directories(${CMAKE_CURRENT_SOURCE_DIR}) in compile time.

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 32.47%. Comparing base (c939498) to head (120e5b5).
Report is 4 commits behind head on develop.

❗ There is a different number of reports uploaded between BASE (c939498) and HEAD (120e5b5). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (c939498) HEAD (120e5b5)
7 1
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #1784       +/-   ##
============================================
- Coverage    83.34%   32.47%   -50.87%     
============================================
  Files          132       66       -66     
  Lines        10019     5497     -4522     
  Branches      2687     1209     -1478     
============================================
- Hits          8350     1785     -6565     
- Misses        1010     3479     +2469     
+ Partials       659      233      -426     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@Dead2 Dead2 left a comment

Choose a reason for hiding this comment

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

LGTM

@Dead2 Dead2 merged commit 09f8404 into zlib-ng:develop Sep 20, 2024
@Dead2 Dead2 mentioned this pull request Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants