[cmake-developers] [CMake 0015359]: __attribute__((weak)) support/detection (weak symbols)

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 19 16:39:58 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15359 
====================================================================== 
Reported By:                Laurent Demailly
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15359
Category:                   CMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-01-19 16:39 EST
Last Modified:              2015-01-19 16:39 EST
====================================================================== 
Summary:                    __attribute__((weak)) support/detection (weak
symbols)
Description: 
it would be great if some built in recipe would set some variable depending on
whether the
compiler/linker support  __attribute__((weak))


this is done in autoconf the following way for instance:

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


ps: sent similar request (more of a question on how to do it pending built in
support by cmake base) to the cmake at cmake.org mailing list - hope it's ok to
have some amount of duplicate

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-01-19 16:39 Laurent DemaillyNew Issue                                    
======================================================================



More information about the cmake-developers mailing list