[Cmake] Adding executables that use dlls

Miller, James V (CRD) millerjv at crd.ge.com
Wed Dec 12 09:27:15 EST 2001


We usually have a section of our CMakeLists.txt file for Unix builds that sets the threads and dl
libraries.

# set link libraries for project
IF(UNIX)
  LINK_LIBRARIES(${CMAKE_THREAD_LIBS} ${CMAKE_DL_LIBS})
ENDIF(UNIX)

-----Original Message-----
From: Asad A. Abu-Tarif [mailto:tarifa at rpi.edu]
Sent: Wednesday, December 12, 2001 9:04 AM
To: CMake mailing list
Subject: Re: [Cmake] Adding executables that use dlls


Thanks.
I tried that it works fine with VC++ and windows NT
and the exe files are generated. However, on linux
I get the following errors as soon as it tries to link
the object files to create the very first executable it finds:
===============errors===================================
/usr/vtk3.2/Debug/lib/libVTKCommon.so: undefined reference to `dlerror'
/usr/vtk3.2/Debug/lib/libVTKCommon.so: undefined reference to
`pthread_create'
/usr/vtk3.2/Debug/lib/libVTKCommon.so: undefined reference to `dlclose'
/usr/vtk3.2/Debug/lib/libVTKCommon.so: undefined reference to `dlopen'
/usr/asad/RegMagicTKBin/Numerics/libRegMagicTKNumerics.so: undefined
reference to `max'
/usr/vtk3.2/Debug/lib/libVTKCommon.so: undefined reference to `dlsym'
/usr/vtk3.2/Debug/lib/libVTKCommon.so: undefined reference to `pthread_join'
===============end of errors===================================

Any help would be greatly appreciated. The CMakeLists.txt file I used
is below.

Regards,
Asad

=============CMakeLists.txt=====================================
PROJECT (NumericsTesting)
LINK_LIBRARIES(RegMagicTKNumerics VTKCommon )
ADD_EXECUTABLE(ExecTestingPowellCompilation ExecTestingPowellCompilation.cpp
TestingPowellCompilation.cpp )
ADD_EXECUTABLE(ExecTestingBracketCompilation
ExecTestingBracketCompilation.cpp TestingregBracketCompilation.cpp )
ADD_EXECUTABLE(ExecMatrixGeneration ExecMatrixGeneration.cpp )
=============CMakeLists.txt=====================================


      __________________________________________________
     /                        Asad A. Abu-Tarif
\
     |   Computer Engineering.
|
     |   PhD Candidate, Rensselaer Polytechnic Institute (RPI).       |
     |   tarifa at rpi.ed
|
     \___________________________________________________/

----- Original Message -----
From: "William A. Hoffman" <bill.hoffman at kitware.com>
To: "Asad A. Abu-Tarif" <tarifa at rpi.edu>; "CMake mailing list"
<cmake at public.kitware.com>
Sent: Wednesday, December 12, 2001 8:26 AM
Subject: Re: [Cmake] Adding executables that use dlls


> Use either the LINK_LIBRARIES command or the TARGET_LINK_LIBRARIES
command.
> For an example with VTK, see Examples/Tutorial/Step1/Cxx/CMakeLists.txt.
>
> -Bill
>
> At 08:00 AM 12/12/2001 -0500, Asad A. Abu-Tarif wrote:
> >Hi,
> >I'm trying to use CMake to build a package that I wrote.
> >I can generate the libraries fine. However, as soon as I
> >start adding executables, I start getting errors like: undefined
> >symbol.
> >
> >For example, here is one executable I'm trying to add:
> >
> >ADD_EXECUTABLE(ExecTestingPowellCompilation
ExecTestingPowellCompilation.cpp
> >TestingPowellCompilation.cpp )
> >
> >However, I should also link VTKCommon with those files because
> >they use it. How do I do that?
> >
> >Thanks a lot,
> >Asad
> >
> >_______________________________________________
> >Cmake mailing list
> >Cmake at public.kitware.com
> >http://public.kitware.com/mailman/listinfo/cmake
>

_______________________________________________
Cmake mailing list
Cmake at public.kitware.com
http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list