InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

UseITK uses include_directories and link_directories

Open
#1,450 9 comments 0 reactions 1 assignee Claimed by @thewtex View on GitHub
type:Enhancement type:Infrastructure
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

`UseITK.cmake` uses `include_directories` and `link_directories`.

### Steps to Reproduce

N/A

### Expected behavior

Variables should be returned such that `target_include_directories` and `target_link_libraries` can be used.

### Actual behavior

https://github.com/InsightSoftwareConsortium/ITK/blob/c95b99852a9109a8fc176a06f88b2aa6d442154b/CMake/UseITK.cmake#L26-L30

https://github.com/InsightSoftwareConsortium/ITK/blob/c95b99852a9109a8fc176a06f88b2aa6d442154b/CMake/UseITK.cmake#L232

`include_directores` pollutes the include path. Our code (https://github.com/CCPPETMR/SIRF) builds against both ITK and NiftyReg, both of which have a copy of `nifti1.h`. For a particular library, we want to be using the NiftyReg files, but because of this issue, ITK includes get prepended. We therefore get into problems with the `itk_nifti_mangle.h`.

You can see this problem, which is present in one of our Travis builds: https://travis-ci.org/CCPPETMR/SIRF/builds/618272131?utm_source=github_status&utm_medium=notification. There is one matrix in red, due to this problem.

### Reproducibility

N/A

### Versions

From at least `4.13`. Still present in `master`.

### Environment

Linux Ubuntu 14.04 (and potentially other distributions).

### Additional Information

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.