I tried the following in my CMakeLists.txt file. SET (CMAKE_EXE_LINK_DYNAMIC_C_FLAGS "-Wl,-Bstatic") SET_TARGET_PROPERTIES (xxxx PROPERTIES LINK_FLAGS "-L/usr/local/lib/ -L/usr/lib")
I have checked that libc.a and libm.a exists in the /usr/lib directory. I am currently using FreeBSD5.5. When I compile and ldd the executable I get libstdc++.so.4 => /usr/lib/libstdc++.so.4 (0x280e6000) libm.so.3 => /lib/libm.so.3 (0x281bc000) libc.so.5 => /lib/libc.so.5 (0x281d7000) If I copy the libc.a and libm.a to another directory say /home/alex/libs and then include SET_TARGET_PROPERTIES (xxxx PROPERTIES LINK_FLAGS "-L/usr/local/lib/ -L/home/alex/libs") The executable created is a purely static executable. I cannot explain this? ALso when I try to take these sources and compile it on FreeBSD 6.2 using the same Cmake Files I get on doing ldd on the executable libstdc++.so.6=> /usr/local/lib/gcc/i386-portbld-freebsd6.2/3.4.6/libstdc++.so.6 libgcc_s.so.1=> /usr/local/lib/gcc/i386-portbld-freebsd6.2/3.4.6/libgcc_s.so.1 libm.so.4 => /lib/libm.so.4 (0x28223000) libc.so.6 => /lib/libc.so.6 (0x28239000) the difference is that gcc is linked as shared library on BSD6.2 whereas on BSD5.5 it was static. Please someone explain. Regards, Ajay BTW I am using CMake 2.4.6 On Sunday 10 June 2007 10:20, Bill Hoffman wrote: > Alan W. Irwin wrote: > > On 2007-06-09 10:22+0400 Nikita V. Borodikhin wrote: > >>> I frankly don't understand why that failed to work. Completely static > >>> executables are possible with cmake. I know this because I made one > >>> several > >>> months ago as a temporary experiment. > >> > >> They _were_ possible but on cmake >= 2.4.4 they are no longer possible > >> without setting some variables in CMakeLists.txt (not command line!). > >> > >> Details: http://www.cmake.org/Bug/bug.php?op=show&bugid=5087&pos=13 > > > > Ouch! That issue is perhaps not something that most Linux users will run > > into every day (very few build static executables any more), but static > > builds are really fundamental. Therefore, for the reputation of CMake, I > > hope a CMake developer will be able to fix bug 5087 before 2.4.7. > > This should > > not take much time since it looks like Nikita has pinpointed where the > > error occurs in his bug report. > > So, there is a new work around for this problem. If you set this variable: > > CMAKE_EXE_LINK_DYNAMIC_C_FLAGS "-Wl,-Bstatic" > That should causes a static link. For all exe in the project. As a new > feature a LINK_STATIC property should be supported in exe targets, > but this work around should be good enough for 2.4.7. > > -Bill > > _______________________________________________ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake -- Ajay Divekar System Developer Guardian Technologies International Tel No : 703-481-4882 _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake