[Tarantool-patches] [PATCH] cmake: add LTO support for building luajit

Timur Safin tsafin at tarantool.org
Thu Jun 25 12:19:55 MSK 2020


: From: Alexander Turenko <alexander.turenko at tarantool.org>
: Subject: Re: [PATCH] cmake: add LTO support for building luajit
: 
: > +    # Enablibg LTO for luajit if DENABLE_LTO set.
: > +    if (${ENABLE_LTO})
: > +`......message(STATUS "Enablig LTO for luajit")
: > +        set (luajit_ld ${CMAKE_C_LINK_OPTIONS_IPO})
: > +`......set (luajit_cflags ${luajit_cflags} ${CFLAGS_LTO})
: > +`......set (CMAKE_AR ${AR_LTO})
: > endif()
: 
: It seems I forgot to mention one point in the previous message.
: 
: Please, set luajit_ar variable and use it below, not reassign CMAKE_AR.
: `include(luajit)` directive does not open a new variables scope, so if
: we'll reassign CMAKE_AR here, it may affect static libraries creation
: for code outside luajit. We should not change outside build rules in
: luajit.cmake.

In general I'd agree with Sasha here, and would advise to introduce scoped variable, (if we were talking about average local variable), but here we are talking about CMAKE_* variable, which is toolchain, and better be used consistently across whole project.

But this might be debatable, though...

Timur



More information about the Tarantool-patches mailing list