[CMake] Finding static library on Linux/gcc

Nikita V. Borodikhin nikita at pictures.uniqueics.com.ru
Sun May 13 13:29:55 EDT 2007


Hello,

I want to build my program as static binary on Release build and dynamic
otherwide. While I building it I also want to check CPPUnit-based unit
tests execution result but unit tests are broken on Release.

I build Release with additional linker flag:
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=-static
but it seems FIND_LIBRARY( CPPUNIT_LIBRARY cppunit ) do not use it when
 searching for library.

My system is Fedora Core 4, CMake 2.4.6 and I have both libcppunit.a and
libsppunit.so in /usr/lib.

CMake 2.4.2 didn't expose this problems because it wrote just
'-lcppunit' in build.make but 2.4.6 writes ' -Wl,-Bdynamic -lcppunit'
even on static build.


Is it possible to instruct CMake that it should search for static
external library, not dynamic?

Thanks,
-- 
Nikita V. Borodikhin, NIKB-RIPN BNV7-RIPE
Registered Linux user #256562 with the Linux Counter
uniqueics.com.ru


More information about the CMake mailing list