Brad King wrote:

> On 10/8/2011 7:40 AM, Stephen Kelly wrote:
>> 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)
> 
> We cannot make a change like that to such a widely used check.  It will
> undoubtedly cause subtle behavior changes for other checks.
> 
> You can use the source-tree signature of try_compile to build your own
> test project that creates a shared library and tries using that flag.
> 
> BTW, the reason the compiler won't warn about -Wl,--no-undefined is
> because "-Wl," is the part parsed by the compiler.  It then passes the
> --no-undefined option to the linker, and the linker is not warning.


Yes, I realised all this yesterday too and wrote a new macro 
check_cxx_linker_flags. It required changing try_compile to not use 
add_executable, but optionally to create a shared library. 

It is staged as check-cxx-linker-flags, and seems to work on linux for me. 
(I haven't tried on windows yet)



--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to