[ITK-users] Brand new project with itk sentence with QtCreator, Qt5 and Cmake crashes

Matt McCormick matt.mccormick at kitware.com
Sat Aug 15 14:20:16 EDT 2015


Hi,

On Fri, Aug 14, 2015 at 12:20 PM, Marcos <fotosentido at gmail.com> wrote:
> As I said, I did that, I set the ITK_DIR to the directory where I installed.
>
> In fact, there is a ITKConfig.cmake in
> C:\ITK-4.8.0-installed\lib\cmake\ITK-4.8

In this case, set ITK_DIR to C:\ITK-4.8.0-installed\lib\cmake\ITK-4.8.


> and my CMakeLists.txt has a line like this:
> SET(ITK_DIR "C:\\ITK-4.8.0-installed\\")
>
> but that way it doesn't find it.

Usually, the ITK_DIR is not hard coded in a CMakeLists.txt.  It is set
by the user when they do the CMake configuration so it adjusts to the
situation on any given build machine.

HTH,
Matt




>
>
> I didn't have problems building ITK, the problem is trying to use it.
>
> Maybe it's not installed correctly, but Visual Studio did it without
> problems.
>
> Thank you.
>
>
>
> 2015-08-14 18:04 GMT+02:00 Matt McCormick <matt.mccormick at kitware.com>:
>>
>> Hi Marcos,
>>
>> On Fri, Aug 14, 2015 at 11:57 AM, Marcos <fotosentido at gmail.com> wrote:
>> > Hi,
>> >
>> > I'm just trying to make a Cmake project compile and debug.
>>
>> >
>> > I have them installed in:
>> >
>> > C:\VTK-6.2.0-installed
>> > C:\ITK-4.8.0-installed
>> > (Each one has the subdirectories \bin, \include, \lib and \share)
>> >
>> > So, I created a QT5 Widgets project from QtCreator, then I added a
>> > CMakeLists.txt containing:
>> >
>> >> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
>> >>
>> >>
>> >> PROJECT (UtilityDICOM)
>> >>
>> >>
>> >> SET(CMAKE_INCLUDE_CURRENT_DIR ON)
>> >>
>> >> SET(CMAKE_AUTOMOC ON)
>> >>
>> >>
>> >> FIND_PACKAGE(Qt5Widgets REQUIRED)
>> >>
>> >>
>> >> # VTK
>> >>
>> >> #SET(VTK_DIR "C:\\VTK-6.2.0-build\\")
>> >>
>> >>
>> >> # ITK
>> >>
>> >> #SET(ITK_DIR "C:\\ITK-4.8.0-build\\")
>> >>
>> >> FIND_PACKAGE(ITK REQUIRED)
>> >>
>> >> INCLUDE(${ITK_USE_FILE})
>> >>
>> >>
>> >> IF (ItkVtkGlue_LOADED)
>> >>
>> >>     FIND_PACKAGE(VTK REQUIRED)
>> >>
>> >>     INCLUDE(${VTK_USE_FILE})
>> >>
>> >> ENDIF()
>> >>
>> >>
>> >>
>> >> ADD_EXECUTABLE(UtilityDICOM WIN32 main.cpp mainwindow.cpp)
>> >>
>> >>
>> >> TARGET_LINK_LIBRARIES(UtilityDICOM Qt5::Widgets ${Glue}
>> >> ${VTK_LIBRARIES}
>> >> ${ITK_LIBRARIES})
>> >
>> >
>> >
>> >
>> > It returns the error:
>> >
>> >> CMake Error at CMakeLists.txt:15 (FIND_PACKAGE):
>> >
>> > By not providing "FindITK.cmake" in CMAKE_MODULE_PATH this project has
>> >
>> > asked CMake to find a package configuration file provided by "ITK", but
>> >
>> > CMake did not find one.
>> >
>> >
>> > Could not find a package configuration file provided by "ITK" with any
>> > of
>> >
>> > the following names:
>> >
>> >
>> > ITKConfig.cmake
>> >
>> > itk-config.cmake
>> >
>> >
>> > Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set
>> > "ITK_DIR"
>> >
>> > to a directory containing one of the above files. If "ITK" provides a
>> >
>> > separate development package or SDK, be sure it has been installed.
>>
>>
>> This means that in your CMake configuration, set ITK_DIR to
>> C:\ITK-4.8.0-installed.
>>
>>
>> For more details, see the Configuring and Building ITK section of the
>> ITK Software Guide:
>>
>> http://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1.html
>>
>> "Both the terminal-based and GUI versions of CMake will require you to
>> specify the directory where ITK was built in the CMake variable
>> ITK_DIR. The ITK binary directory will contain a file named
>> ITKConfig.cmake generated during ITK configuration process with CMake.
>> From this file, CMake will recover all information required to
>> configure your new ITK project."
>>
>>
>> Hope this helps,
>> Matt
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list