Skip to content

CMake: INCLUDE_DIRECTORIES -> TARGET_INCLUDE_DIRECTORIES - #4284

Closed
AndreyG wants to merge 2 commits into
libgit2:masterfrom
AndreyG:cmake/modernization
Closed

CMake: INCLUDE_DIRECTORIES -> TARGET_INCLUDE_DIRECTORIES#4284
AndreyG wants to merge 2 commits into
libgit2:masterfrom
AndreyG:cmake/modernization

Conversation

@AndreyG

@AndreyG AndreyG commented Jun 26, 2017

Copy link
Copy Markdown
Contributor

It's preferable to use target_include_directories instead of include_directories in modern CMake. It's also more consistent with target_link_libraries.

@ethomson

Copy link
Copy Markdown
Member

Why are you dropping the explicit linkages? This looks weird: libgit2_clar does not link to libgit2 and this suggests to me that it does. It's already not obvious that we do not link to libgit2 (we can't, we need to test internal functions). This makes that less obvious still.

If you're worried about this not being sufficiently DRY, then why not set a variable to this set of libraries and then let TARGET_LINK_LIBRARIES point to both?

@pks-t

pks-t commented Jun 26, 2017

Copy link
Copy Markdown
Member

I'd ask for not touching that part at all regarding linkage, as I'm already doing this in #4282 in the way @ethomson asks for. The other part regarding the includes is still viable, though

@ethomson

ethomson commented Jun 26, 2017

Copy link
Copy Markdown
Member

Agree. 👍 Thanks @pks-t

@AndreyG

AndreyG commented Jun 26, 2017

Copy link
Copy Markdown
Contributor Author

Ok, I will fix it. But it seems quite strange for me that tests for the library don't link to that library.

@ethomson

Copy link
Copy Markdown
Member

Again - they can't, at least not without making everything public. We want to be able to test our buffer implementation and our posix emulation on Windows, and we do not want those to be a public, exported part of the library.

@AndreyG

AndreyG commented Jun 26, 2017

Copy link
Copy Markdown
Contributor Author

I have reworked my commits to leave git history clean.

@ethomson

Copy link
Copy Markdown
Member

🎉 Awesome, thanks, @AndreyG !

@AndreyG

AndreyG commented Jun 26, 2017

Copy link
Copy Markdown
Contributor Author

@ethomson thank you for clarification!

@pks-t

pks-t commented Jun 27, 2017

Copy link
Copy Markdown
Member

I'd still prefer to pull only the commit regarding target_include_directories to keep conflicts with #4282 as small as possible.

@AndreyG

AndreyG commented Jun 27, 2017

Copy link
Copy Markdown
Contributor Author

@pks-t It will be OK for me if you just cherry-pick my commit 905d80f regarding target_include_directories to your branch #4282 and then close this pull request.

@pks-t

pks-t commented Jun 27, 2017

Copy link
Copy Markdown
Member

@AndreyG That's certainly helpful, thank you! I'll try to get Windows building with #4282 tomorrow, and if so I'll cherry-pick this. Otherwise I'll manually pick the single commit and merge

@pks-t

pks-t commented Jun 28, 2017

Copy link
Copy Markdown
Member

Manually merged via c26ce78. I've made a follow-up commit to also use TARGET_INCLUDE_DIRECTORIES for libgit2_clar.

Thanks for your work!

@pks-t pks-t closed this Jun 28, 2017
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.

3 participants