[Insight-developers] ITK + find_package(DCMTK NO_MODULE) progress/success
Brad King
brad.king at kitware.com
Fri Feb 22 16:31:51 EST 2013
On 02/22/2013 02:47 PM, Williams, Norman K wrote:
> My patch for ITK depends on the patched DCMTK. It might be possible to
> maintain backwards compatibility with the old find_package and unpatched
> DCMTK, but I'm not sure how to implement that. Would it be as simple as
> this?
>
> find_package(DCMTK NO_MODULE QUIET)
> if(NOT DCMTK_FOUND)
> find_package(DCMTK REQUIRED QUIET)
> if(NOT DCMTK_FOUND)
> message(FATAL_ERROR "DCMTK package not found. Please set DCMTK_DIR and
> re-run CMake")
> endif()
> endif()
You can teach FindDCMTK to try the NO_MODULE mode first and then
fall back to the rest of its implementation. Add something like
this at the top of FindDCMTK in ITK (untested):
if(NOT DCMTK_FOUND)
find_package(DCMTK NO_MODULE QUIET)
endif()
if(DCMTK_FOUND)
return()
endif()
Of course the rest of the logic for exports will have to be
conditional on how DCMTK was found.
-Brad
More information about the Insight-developers
mailing list