[CMake] Linking Libraries
Brandon Van Every
bvanevery at gmail.com
Mon Nov 12 12:45:13 EST 2007
On Nov 12, 2007 12:32 PM, <abboti at rpi.edu> wrote:
>
> I've created a project (Farsight) that has this top-level CMakeLists file
> (segment shown). The subdirs also have theirs. The cpp files in /seg
> use VTK libraries. I have found that the project compiles using MS
> Visual Studio, but not using g++.
>
> To get g++ to work I added this to the CMakeLists shown below:
> LINK_LIBRARIES(
> VTKCommon
> VTKIO
> VTKFiltering
> )
>
> I understand this to be an old command that is no longer necessary, and I
> don't want to have it in this CMakeLists file because I don't need to
> know what each module (subdir) requires for libraries.
So why don't you just add VTKCommon VTKIO VTKFiltering to the
appropriate TARGET_LINK_LIBRARIES commands?
Cheers,
Brandon Van Every
>
> ################################################################################
> # Snippet of Top-Level CMakeLists.txt
> ################################################################################
>
> SUBDIRS( wrap )
>
>
> # here we instruct CMake to build "Farsight" executable from all
> # source files and place it in the "bin" folder
>
> ADD_EXECUTABLE( Farsight
> ${FARSIGHT_SRCS}
> )
>
> # last thing we have to do is to tell CMake what libraries our executable
> needs,
> # luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
> TARGET_LINK_LIBRARIES( Farsight
> )
>
>
>
> #####################################################################
> The CMakeLists.txt in \wrap
> #####################################################################
> SET( MY_WRAPPERS_SRCS
> itkimage2qimage.cpp
> qimage2itkimage.cpp
> vtkLSMReader.cxx
> )
>
> SET( MY_WRAPPERS_HDRS
> qimage2itkimage.h
> vtkLSMReader.h
> vtkBXDProcessingWin32Header.h
> )
>
> ADD_LIBRARY( fswrappers
> ${MY_WRAPPERS_SRCS}
> ${MY_WRAPPERS_HDRS}
> )
>
> TARGET_LINK_LIBRARIES( fswrappers ${QT_LIBRARIES} VTKCommon VTKFiltering )
>
>
>
>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
More information about the CMake
mailing list