fix lua-bcc build issue with cmake try_compile
authorYonghong Song <yhs@fb.com>
Wed, 23 Aug 2017 20:40:47 +0000 (13:40 -0700)
committerBrenden Blanco <bblanco@gmail.com>
Thu, 24 Aug 2017 01:17:31 +0000 (18:17 -0700)
commit75e2f3798947f4f77e91b6b3af8e7bd969663f65
tree9e30b0efae37fd118f621118ebf35d67c86958d7
parentd32a61b076ded297afab5bbbb7fd6178ee274e71
fix lua-bcc build issue with cmake try_compile

Certain versions of recent gcc (e.g., gcc 6.3.0 on ubuntu17.04)
has pie enabled by default at linker (collect2) stage.
The compilation flag "-no-pie" is available to negate
this linker option.

Add -no-pie to compilation flag only if it is available.
Earlier gcc compiler may not have this option but it does
not have linker pie on-by-default either.

Tested with ubuntu 17.04 and my local gcc 4.8.5 (not accepting -no-pie).

Signed-off-by: Yonghong Song <yhs@fb.com>
CMakeLists.txt
cmake/FindCompilerFlag.cmake [new file with mode: 0644]
src/lua/CMakeLists.txt