Quoting Charlene Tsai <[EMAIL PROTECTED]>:
Hi,
Could some please show me the proper way to handle libxml2 on Gentoo
linux. In my CMakeLists.txt, if I include the following line it works
on windows and some versions of linux:
TARGET_LINK_LIBRARIES( my_exe ITKCommon ITKIO libxml2)
However, when trying to compile on Gentoo linux (using gcc 4.1.2) it
complains about not being able to find libxml2.so for linking, unless
I change it to:
TARGET_LINK_LIBRARIES( my_exe ITKCommon ITKIO xml2)
Any advice is appreciated.
You should really read about how libraries and finders work in CMake.
There is a good amount of information in the wiki and the
Documentation section of the website.
For libxml2, this is what you need:
FIND_PACKAGE(LibXml2)
TARGET_LINK_LIBRARIES( my_exe ITKCommon ITKIO ${LIBXML2_LIBRARIES} )
As you are using ITK, your CMakeLists.txt should look like this:
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
INCLUDE(ITK_USE_FILE)
ENDIF(ITK_FOUND)
FIND_PACKAGE(LibXml2 REQUIRED)
...
TARGET_LINK_LIBRARIES( my_exe ITKCommon ITKIO ${LIBXML2_LIBRARIES} )
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake