On 10/13/2011 03:27 PM, pellegrini wrote: > 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
The message "ld: cannot find -lXm" reveals that the linker can't find libXm.so - or libXm.a if not ruled out - in the directories searched for libraries; the mere presence of the SONAMEd libXm.so.2 does not suffice unless you tell CMake to use it, e.g. via imported libraries and appropriate IMPORTED_LOCATION properties. Typically, you have a symlink libXm.so -> libXm.so.2 or to the actual library file, so the -lXm is sufficient for the linker to succeed, but this symlink isn't necessary to execute a program linked against the Motif library, and sometimes it is dropped when the package's development component is not installed. Thus, could you check if there is a libXm.so symlink? If not, create it and try anew, and if it still does not work, could you post the relevant part of the "make VERBOSE=1" output for further investigation? Regards, Michael -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake