[CMake] Mixing static and dynamic library

pellegrini pellegrini at ill.fr
Thu Oct 13 09:27:10 EDT 2011


Hi all,

I would like to port a hardcoded build line from an old make file to my 
CMakeLists.txt file for a fortran 90
project using ifort compiler.
The line is the following:

    ifort *.o -o myexec -static-intel -Bstatic -lXm -Bdynamic -lXt

First, if I get it right (sorry for my ignorance but I come from the 
python world where I was quite
preserved from these lines !!!), the goal is to build an executable:
    - statically bound to the intel libraries
    - statically bound to libXm library
    - dynamically bound to libXt library

A "locate" told me that on my machine both Xt and Xm are in dynamic form 
(libXm.so.2, libXt.so.6) and in a standard location (/usr/lib). So in my 
CMakeLists.txt file, I tried:

set(CMAKE_Fortran_FLAGS_RELEASE "-static-intel")
add_executable(myexec $SOURCES)
target_link_libraries(myexec -Bdynamic Xm Xt)

when building the project I get an error at link time (ld: cannot find 
-lXm).

Would you have any idea of what is going wrong with my settings ?

thanks a lot

Eric

-- 
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France



More information about the CMake mailing list