Skip to content

CMake: INCLUDE_DIRECTORIES -> TARGET_INCLUDE_DIRECTORIES - #4276

Closed
AndreyG wants to merge 1 commit into
libgit2:masterfrom
AndreyG:cmake/modernization
Closed

CMake: INCLUDE_DIRECTORIES -> TARGET_INCLUDE_DIRECTORIES#4276
AndreyG wants to merge 1 commit into
libgit2:masterfrom
AndreyG:cmake/modernization

Conversation

@AndreyG

@AndreyG AndreyG commented Jun 21, 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.

@pks-t

pks-t commented Jun 21, 2017

Copy link
Copy Markdown
Member

As of now, we cannot use the target_include_directories as it has only been introduced in CMake 2.8.12. While most current distros already have this version (Ubuntu Trusty, CentOS 6), there is at least the usual suspect of Debian, where Debian Wheezy only has v2.8.9. Furthermore, Travis currently still uses Ubuntu Precise, which has an older version, as well.

Anyway, thanks for your proposal!

@pks-t pks-t closed this Jun 23, 2017
@AndreyG

AndreyG commented Jun 23, 2017

Copy link
Copy Markdown
Contributor Author

Can I use target_include_directories under if(${CMAKE_VERSION} VERSION_GREATER 2.8.12)? I really need it because I use libgit2 as subproject and this is rather awkward to add explicitly libgit2/include to include directories of my target.

@pks-t

pks-t commented Jun 23, 2017

Copy link
Copy Markdown
Member

Oh, yeah, that'd certainly be possible, sorry for not thinking of this possibility. I can reopen the issue if you decide to put up some code for this.

@AndreyG

AndreyG commented Jun 26, 2017

Copy link
Copy Markdown
Contributor Author

I have created another pull request: #4284

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