[CMake] Fwd: Removing overkill linking

Marcel Loose loose at astron.nl
Mon Oct 4 09:24:54 EDT 2010


On Sun, 2010-10-03 at 13:15 +0100, Paul McEnery wrote:
> Resolved!
> 
> The solution was to set CMAKE_EXE_LINKER_FLAGS using
"-Wl,--as-needed".
> 
> CMakeLists.txt:
> ==========================================
> cmake_minimum_required (VERSION 2.6)
> 
> project(galinette)
> 
> set(GALINETTE_VERSION         "1.1"             CACHE STRING
> "Software version" FORCE)
> set(bindir                    "bin"             CACHE FILEPATH "bin
> directory"    FORCE)
> set(libdir                    "lib"             CACHE FILEPATH "lib
> directory"    FORCE)
> set(sharedir                  "share/galinette" CACHE FILEPATH "share
> directory"  FORCE)
> set(CMAKE_EXE_LINKER_FLAGS    "-Wl,--as-needed -Wl,--no-undefined
> ${CMAKE_EXE_LINKER_FLAGS}")
> set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed
${CMAKE_SHARED_LINKER_FLAGS}")
> 
> add_definitions  (-Wall)
> 
> add_subdirectory (libgalinette)
> add_subdirectory (galinette-cli)
> add_subdirectory (galinette-gtk)
> ==========================================
> 
> Many thanks for all your help.
> 
> Regards,
> Paul.

Hi Paul,

Please checkout http://wiki.mandriva.com/en/Overlinking
It discusses the pkg-config issue you ran into, as well as underlinking
problems caused by the use of --as-needed. I'm afraid there's no silver
bullet :-(

Best regards,
Marcel Loose.



More information about the CMake mailing list