[cmake-developers] try_compile does not work for linker flags?
Stephen Kelly
steveire at gmail.com
Sat Oct 8 07:40:13 EDT 2011
Brad King wrote:
> On 10/7/2011 7:21 AM, Stephen Kelly wrote:
>> I have a check for the Wl,--no-undefined flag in the test, and on some
>> platforms the check passes (it seems), but the test fails later.
>
> Many linkers simply warn about an unused flag and ignore it.
> It's hard to test for them. Unfortunately I don't have time
> now to dig into this to be of further help.
>
My test shows that check_cxx_compiler_flag (which creates an executable)
doesn't even cause the compiler to issue a warning when the unrecognized
compiler flag is used:
http://www.cdash.org/CDash/testDetails.php?test=118342963&build=1604891
However, when compiling a shared library it fails directly:
http://www.cdash.org/CDash/testDetails.php?test=118193330&build=1601576
Would it break anything if we changed check_cxx_compiler_flag to build a
shared library instead of an executable? Maybe that will make the
try_compile fail as expected. (I'll try add a test for that now)
More information about the cmake-developers
mailing list