[waffle] [PATCH 10/33] cmake: build with fPIC when possible
Jose Fonseca
jfonseca at vmware.com
Tue Jul 15 07:44:34 PDT 2014
On 07/07/14 18:28, Emil Velikov wrote:
> Some of our third_party libraries may be build without it thus we'll fail at
> link tim.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> cmake/Modules/WaffleDefineCompilerFlags.cmake | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/cmake/Modules/WaffleDefineCompilerFlags.cmake b/cmake/Modules/WaffleDefineCompilerFlags.cmake
> index 4d149c8..96a7a10 100644
> --- a/cmake/Modules/WaffleDefineCompilerFlags.cmake
> +++ b/cmake/Modules/WaffleDefineCompilerFlags.cmake
> @@ -50,6 +50,8 @@ if(waffle_on_linux)
> waffle_add_c_flag("-Werror=missing-prototypes" WERROR_MISSING_PROTOTYPES)
> endif()
>
> +waffle_add_c_flag("-fPIC" WITH_FPIC)
> +
> waffle_check_thread_local_storage()
>
> if(waffle_has_tls)
>
Another way of fixing this is doing like in Apitrace:
-
https://github.com/apitrace/apitrace/blob/master/cmak/ConvenienceLibrary.cmake
-
https://github.com/apitrace/apitrace/commit/c56b9acc6abcae465b916f6ebafa3a282d1f36fc
This gives more control. For example, unlike a blanket -FPIC flag,
executables won't be needlessly compiled with FPIC.
Jose
More information about the waffle
mailing list