On Fri, Jan 22, 2016 at 1:40 AM, Guy Harris <g...@alum.mit.edu> wrote:
>
>
> This means we can't use CMAKE_REQUIRED_FLAGS, and have to find some
> *other* way to specify the flag to be tested.


FYI, the only sure-fire way in CMAKE to set specific only linker flags is
using the target properties. The following code modifies target properties
for a specific target, but first collects existing flags, to not overwrite
those:

    GET_TARGET_PROPERTY(TARGET_COMPILE_FLAGS <TargetExeName> COMPILE_FLAGS )
    GET_TARGET_PROPERTY(TARGET_LINK_FLAGS <TargetExeName> LINK_FLAGS )

    SET( TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} -D<something> " )
    SET( TARGET_LINK_FLAGS "${TARGET_LINK_FLAGS} -W<something> " )

    SET_TARGET_PROPERTIES(<TargetExeName> PROPERTIES COMPILE_FLAGS
${TARGET_COMPILE_FLAGS} LINK_FLAGS ${TARGET_LINK_FLAGS} )

<TargetExeName> is the same name, that get's passed to ADD_EXECUTABLE or
ADD_LIBRARY for linkage, so in case of wsutil or wireshark it would be
exactly that (without any lib... or .dylib stuff).

This works in 9 out of 10 cases on all 3 major plattforms. In my experience
it depends on what is called, and when, and most likely fails with MSVC.

regards
Roland
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to