Pending (possible) built-in support in cmake, looks like I could use
check_cxx_source_compiles(
"extern \"C\" void cmkcheckweak() __attribute__((weak));
int main(int argc, char** argv) {
return cmkcheckweak == nullptr; // works with (void*)0;
}" HAVE_WEAK_SYMBOLS)
But that doesn't work because check_cxx_source_compiles doesn't (by
default - how do I tell it to?) use the compiler flags (like -std=gnu++11)
needed to compile this (while in this case there is an easy workaround -
how do I do this in general)
Filled the 2 issues:
http://public.kitware.com/Bug/view.php?id=15359 for weak symbol knowledge
by cmake
http://public.kitware.com/Bug/view.php?id=15361 for
check_cxx_source_compiles
Thanks!
Laurent
On 1/19/15, 1:35 PM, "Laurent Demailly" <[email protected]> wrote:
>I searched and didn't find yet would it be reasonable to have built in
>support in cmake for knowing if the platform/compiler supports weak
>symbols ?
>
>I'm porting the following autconf fragment:
>
>AC_CACHE_CHECK(
> [for weak symbol support],
> [folly_cv_prog_cc_weak_symbols],
> [AC_LINK_IFELSE(
> [AC_LANG_SOURCE[
> extern "C" void configure_link_extern_weak_test()
>__attribute__((weak));
> int main(int argc, char** argv) {
> return configure_link_extern_weak_test == nullptr;
> }]],
> [folly_cv_prog_cc_weak_symbols="yes"],
> [folly_cv_prog_cc_weak_symbols="no"])])
>
>if test "$folly_cv_prog_cc_weak_symbols" = yes; then
> AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
> [Define to 1 if the linker supports weak symbols.])
>fi
>
>And I'm not sure what's the best way to do such recipe in Cmake ?
>(by hand for now pending possible support in 3.2+ maybe)
>
>
>Laurent
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake