[Insight-developers] Forgetting to include ITK_USE_FILE in project CMakeLists.txt causes all file IO to fail?

Williams, Norman K norman-k-williams at uiowa.edu
Thu Nov 29 15:07:33 EST 2012


I ran into this working through this bug:
https://itk.icts.uiowa.edu/jira/browse/ITK-2859

Turns out Micah Chambers was right; it segfaults.  I finally figured out
what the problem was: he does this:

find_package(ITK REQUIRED)
if(NOT ITK_FOUND)
  message(FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR.")
endif(NOT ITK_FOUND)

without doing this:


include(${ITK_USE_FILE})

This is kind of baffling to me, but there's a lot of crazy computer
science-y thingies going on under the covers with how the CMake
configuration works.

I will say this: It's kind of scary that the find_package succeeds, and
the compilation and linking works without complaint, but without the
UseITK.cmake the program craps itself if it tries to read or write a file.

Is this an intended behavior?  Is there a way that CMake could be forced
to either do the work of UseITK.cmake, or complain if it isn't included?



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list