Wireshark-dev: Re: [Wireshark-dev] cmake, linker flags, whitespace, cmp0004

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Tue, 10 May 2016 18:00:42 +0200
Hello Martin,

is this problem still open?

Thanks
   Jörg

On Sun, Apr 17, 2016 at 03:14:32PM +0200, Martin Kaiser wrote:
> I'm getting strange cmake errors on Debian Wheezy (cmake 2.8.9).
> 
> -- Performing Test WS_LD_FLAG_VALID0
> CMake Error at CMakeLists.txt:11 (ADD_EXECUTABLE):
>   Target "cmTryCompileExec701976172" links to item " -Wl,--as-needed" which
>   has leading or trailing whitespace.  This is now an error according to
>   policy CMP0004.
> 
> 
> CMake Error: Internal CMake error, TryCompile generation of cmake failed
> -- Performing Test WS_LD_FLAG_VALID0 - Failed
> statuscheck linker flag - test linker flags: -pie
> -- Performing Test WS_LD_FLAG_VALID1
> CMake Error at CMakeLists.txt:11 (ADD_EXECUTABLE):
>   Target "cmTryCompileExec2930916065" links to item " -pie" which has leading
>   or trailing whitespace.  This is now an error according to policy
> CMP0004.
> 
> CMake Error: Internal CMake error, TryCompile generation of cmake failed
> 
> 
> 
> Apparently, cmake doesn't like leading whitespace in linker options. I
> tried setting the CMP0004 policy to the old behaviour which is not
> ignore the whitespace.
> 
> cmake_policy(SET CMP0004 OLD)
> 
> This doesn't fix things. Google results show that this is in fact a bug
> in cmake's parsing.
> 
> KDE discovered the bug in their build
> http://comments.gmane.org/gmane.comp.kde.devel.buildsystem/7858
> 
> Cmake fixed it here
> https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e65ef08b
> 
> 
> I tried to work around this by removing whitespace from the linker flags
> or applying a regexp replace on the final list of linker flags.
> None of this produced a clean and readable solution.
> 
> Does anyone more familiar with cmake have a recommendation how to fix
> this properly?

-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.