Discussion:
[ITK-users] Problem using CMAKE including ITK, VTK and GDCM
Elli
2018-04-29 18:13:09 UTC
Permalink
Dear all,

I am having some trouble with CMAKE. Until now, I used in my project ITK and
VTK what worked quite fine. However, now I want to use
vtkGDCMPolyDataReader, so I also downloaded and built the GDCM library. With
the build and the installation everything worked fine.

Now I want to include GDCM in my project. I have a CMakeLists file (I have
to admit that my experience with cmake is very limited). It looks the
following:

cmake_minimum_required(VERSION 2.8)

project(Radiomics)

SET (BOOST_ROOT "C:/boost_1_65_0/boost_1_65_0")
SET (BOOST_LIBRARYDIR "C:/boost_1_65_0/boost_1_65_0/stage/lib")

SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
SET(USE_STATIC_LIBS = 1)
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.55) required.")
else()
message(STATUS "Setting up BOOST")
message(STATUS " Library - ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif (NOT Boost_FOUND)

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

FIND_PACKAGE(GDCM REQUIRED)
IF(GDCM_FOUND)
INCLUDE(${GDCM_USE_FILE})

ELSE(GDCM_FOUND)
MESSAGE(FATAL_ERROR "Cannot find GDCM, did you set GDCM_DIR?")
ENDIF(GDCM_FOUND)


add_executable(Radiomics MACOSX_BUNDLE src/main.cpp)
target_link_libraries(Radiomics
${Boost_LIBRARIES} ${Glue} ${vtkgdcm} ${VTK_LIBRARIES} ${ITK_LIBRARIES})

But now I get the error:

Some (but not all) targets in this export set were already defined.

Targets Defined:
gdcmCommon;gdcmDICT;gdcmDSED;gdcmIOD;gdcmMSFF;gdcmMEXD;gdcmjpeg8;gdcmjpeg12;gdcmjpeg16;gdcmcharls


Targets not yet defined: gdcmexpat;gdcmopenjp2;gdcmzlib;socketxx;vtkgdcm

I already found other persons reporting the bug but I could not find any
solution.

Can anyone help me with this?

Thanks in advance!

Elli



--
Sent from: http://itk-users.7.n7.nabble.com/
The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
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:
https://itk.org/mailman/listinfo/insight-users
Dženan Zukić
2018-04-30 13:59:17 UTC
Permalink
Hi Elli,

what you need to do is set ITK_USE_SYSTEM_GDCM to ON when configuring ITK
and point to the GDCM you compiled yourself.

Regards,
DÅŸenan
Post by Elli
Dear all,
I am having some trouble with CMAKE. Until now, I used in my project ITK and
VTK what worked quite fine. However, now I want to use
vtkGDCMPolyDataReader, so I also downloaded and built the GDCM library. With
the build and the installation everything worked fine.
Now I want to include GDCM in my project. I have a CMakeLists file (I have
to admit that my experience with cmake is very limited). It looks the
cmake_minimum_required(VERSION 2.8)
project(Radiomics)
SET (BOOST_ROOT "C:/boost_1_65_0/boost_1_65_0")
SET (BOOST_LIBRARYDIR "C:/boost_1_65_0/boost_1_65_0/stage/lib")
SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
SET(USE_STATIC_LIBS = 1)
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.55) required.")
else()
message(STATUS "Setting up BOOST")
message(STATUS " Library - ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif (NOT Boost_FOUND)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
FIND_PACKAGE(GDCM REQUIRED)
IF(GDCM_FOUND)
INCLUDE(${GDCM_USE_FILE})
ELSE(GDCM_FOUND)
MESSAGE(FATAL_ERROR "Cannot find GDCM, did you set GDCM_DIR?")
ENDIF(GDCM_FOUND)
add_executable(Radiomics MACOSX_BUNDLE src/main.cpp)
target_link_libraries(Radiomics
${Boost_LIBRARIES} ${Glue} ${vtkgdcm} ${VTK_LIBRARIES} ${ITK_LIBRARIES})
Some (but not all) targets in this export set were already defined.
gdcmCommon;gdcmDICT;gdcmDSED;gdcmIOD;gdcmMSFF;gdcmMEXD;gdcmjpeg8;gdcmjpeg12;gdcmjpeg16;gdcmcharls
Targets not yet defined: gdcmexpat;gdcmopenjp2;gdcmzlib;socketxx;vtkgdcm
I already found other persons reporting the bug but I could not find any
solution.
Can anyone help me with this?
Thanks in advance!
Elli
--
Sent from: http://itk-users.7.n7.nabble.com/
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
https://itk.org/mailman/listinfo/insight-users
Elisabeth Pfaehler
2018-05-01 05:57:59 UTC
Permalink
Thanks a lot! I included

OPTION(ITK_USE_SYSTEM_GDCM "Use an outside build of GDCM." ON)
MARK_AS_ADVANCED(ITK_USE_SYSTEM_GDCM)
if(ITK_USE_SYSTEM_GDCM)

find_package(GDCM REQUIRED)

endif()

in the CMakeLists.txt of iTK and now its working! :)
Post by Dženan Zukić
Hi Elli,
what you need to do is set ITK_USE_SYSTEM_GDCM to ON when configuring ITK
and point to the GDCM you compiled yourself.
Regards,
DÅŸenan
Post by Elli
Dear all,
I am having some trouble with CMAKE. Until now, I used in my project ITK and
VTK what worked quite fine. However, now I want to use
vtkGDCMPolyDataReader, so I also downloaded and built the GDCM library. With
the build and the installation everything worked fine.
Now I want to include GDCM in my project. I have a CMakeLists file (I have
to admit that my experience with cmake is very limited). It looks the
cmake_minimum_required(VERSION 2.8)
project(Radiomics)
SET (BOOST_ROOT "C:/boost_1_65_0/boost_1_65_0")
SET (BOOST_LIBRARYDIR "C:/boost_1_65_0/boost_1_65_0/stage/lib")
SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
SET(USE_STATIC_LIBS = 1)
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.55) required.")
else()
message(STATUS "Setting up BOOST")
message(STATUS " Library - ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif (NOT Boost_FOUND)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
FIND_PACKAGE(GDCM REQUIRED)
IF(GDCM_FOUND)
INCLUDE(${GDCM_USE_FILE})
ELSE(GDCM_FOUND)
MESSAGE(FATAL_ERROR "Cannot find GDCM, did you set GDCM_DIR?")
ENDIF(GDCM_FOUND)
add_executable(Radiomics MACOSX_BUNDLE src/main.cpp)
target_link_libraries(Radiomics
${Boost_LIBRARIES} ${Glue} ${vtkgdcm} ${VTK_LIBRARIES} ${ITK_LIBRARIES})
Some (but not all) targets in this export set were already defined.
gdcmCommon;gdcmDICT;gdcmDSED;gdcmIOD;gdcmMSFF;gdcmMEXD;gdcmjpeg8;gdcmjpeg12;gdcmjpeg16;gdcmcharls
Targets not yet defined: gdcmexpat;gdcmopenjp2;gdcmzlib;socketxx;vtkgdcm
I already found other persons reporting the bug but I could not find any
solution.
Can anyone help me with this?
Thanks in advance!
Elli
--
Sent from: http://itk-users.7.n7.nabble.com/
The ITK community is transitioning from this mailing list to
discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
https://itk.org/mailman/listinfo/insight-users
--
Elisabeth Pfaehler
Oude Ebbingestraat 73a
9712HE Groningen
Loading...