[CMake] Double linking / linking static libraries

Clinton Stimpson clinton at elemtech.com
Wed Aug 4 11:12:08 EDT 2010


FindQt4.cmake has been fixed so it doesn't potentially introduce this double linking problem.
If you can upgrade, 2.8 would help you.

Clint

On Aug 4, 2010, at 2:51 AM, Dennis Schridde wrote:

> I searched some more and found a trigger for this
> behaviour:
> 
> ------
> PROJECT(test)
> cmake_minimum_required(VERSION
> 2.6)
> 
> find_package(Qt4
> REQUIRED)
> include(${QT_USE_FILE})
> 
> set(Boost_ADDITIONAL_VERSIONS 1.38 1.39
> 1.40 1.41 1.42)
> find_package(Boost REQUIRED COMPONENTS
> thread)
> 
> find_package(GLU REQUIRED)
> 
> find_package(JPEG
> REQUIRED)
> 
> ADD_EXECUTABLE(test test.cpp)
> TARGET_LINK_LIBRARIES(test
> ${QT_LIBRARIES} ${GLU_LIBRARY} ${Boost_LIBRARIES}
> ${JPEG_LIBRARIES})
> ------
> 
> Removing either include(QTUSEFILE) or find(GLU)
> will make the double-linking go away. If both are present, jpeg and
> boost-thread will be double-linked:
> 
> ---- without find(GLU)
> ----
> /usr/bin/c++     -fPIC CMakeFiles/test.dir/test.cpp.o  -o test
> -rdynamic -lQtGui -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor
> -lXinerama -lXfixes -lfreetype -lfontconfig -lXext -lX11 -lm -lQtCore -lz
> -lgthread-2.0 -lglib-2.0 -lrt -lpthread -ldl -lboost_thread-mt -ljpeg 
> ----
> with find(GLU) ---
> /usr/bin/c++     -fPIC CMakeFiles/test.dir/test.cpp.o  -o
> test -rdynamic -lQtGui -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor
> -lXinerama -lXfixes -lfreetype -lfontconfig -lXext -lX11 -lm -lQtCore -lz
> -lgthread-2.0 -lglib-2.0 -lrt -lpthread -ldl -lGLU -lGL -lSM -lICE -lX11
> -lXext -lboost_thread-mt -ljpeg -lXi -lXrender -lXrandr -lXcursor -lXinerama
> -lXfixes -lfreetype -lfontconfig -lm -lQtCore -lz -lgthread-2.0 -lglib-2.0
> -lrt -lpthread -ldl -lGLU -lGL -lboost_thread-mt -ljpeg 
> ---- ----
> 
> I am
> using Fedora release 12 and cmake version 2.6-patch 4.
> The issue is not
> reproducible on Gentoo/Linux and cmake version 2.8.1.
> 
> Is cmake-2.6 still
> being maintained? Otherwise I will suggest an update to our admins. (Is
> cmake-2.8 available for Fedora 12?)
> 
> --Dennis
> _______________________________________________
> 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



More information about the CMake mailing list