DCMTK 3.6.1 CMake config shadows system headers

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jakecobb
Posts: 3
Joined: Thu, 2016-09-08, 15:55

DCMTK 3.6.1 CMake config shadows system headers

#1 Post by jakecobb »

The DCMTKConfig.cmake places all of the module subdirectories directly into DCMTK_INCLUDE_DIRS. The standard CMake way to configure for this dependency would be along the lines of:

Code: Select all

find_package(DCMTK REQUIRED CONFIG)
include_directories(${DCMTK_INCLUDE_DIRS})
This means the DCMTK headers which are normally separated by folder hierarchy
can now shadow system includes. As a specific example, the line:

Code: Select all

#include <tchar.h>
Will find <dcmtk>/include/oflog/tchar.h instead of the Windows system header.

In the FAQ for the snapshot,
this standard config method is not used. Instead the directory is set manually into
DCMTK_DIR and ${DCMTK_DIR}/include is explicitly given.

Is there any reason why these subdirectories should be put directly into the include path?
My impression is that DCMTK includes should always take a form like "dcmtk/oflog/tchar.h"
and so DCMTK_INCLUDE_DIRS should only point to ${PACKAGE_PREFIX_DIR}/include

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: DCMTK 3.6.1 CMake config shadows system headers

#2 Post by Jan Schlamelcher »

Hi jakecobb,

I will have to investigate this further, but on the first glance you seem to be correct. I remember (roughly) that implementing the DCMTKConfig.cmake was a bit tricky, since you need a different config depending on wether it should reside in the build vs inside the final installation directory. So I consider a bug like you described entirely possible.
I have added it into our bug tracker so it is not forgotten, since I don't know when somebody will find the time to take a look at it (should be fixed before the next snapshot or release I think though).

Best regards
Jan

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: DCMTK 3.6.1 CMake config shadows system headers

#3 Post by Jan Schlamelcher »

Hi jakecobb,

this should be fixed in commit cf843f5, can you confirm that?

Best regards
Jan

jakecobb
Posts: 3
Joined: Thu, 2016-09-08, 15:55

Re: DCMTK 3.6.1 CMake config shadows system headers

#4 Post by jakecobb »

Sorry for the slow reply. I applied the patch and it does fix the problem, thanks!

-Jake

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: DCMTK 3.6.1 CMake config shadows system headers

#5 Post by Jan Schlamelcher »

Great, no problem!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest