From 095fd61335c1e80b576ee5417ecc505bb853764d Mon Sep 17 00:00:00 2001 From: Kevin Kane Date: Thu, 19 Mar 2020 10:25:54 -0700 Subject: [PATCH] Always build with -fPIC on GCC and clang Even if liboqs is built as a static library, building shared versions of OpenSSL will fail if liboqs isn't built with -fPIC. Always build with it so the shared build will work, as this won't affect the static OpenSSL build. --- .CMake/compiler_flags.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.CMake/compiler_flags.cmake b/.CMake/compiler_flags.cmake index 418880fcb7..5e48080eec 100644 --- a/.CMake/compiler_flags.cmake +++ b/.CMake/compiler_flags.cmake @@ -5,6 +5,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang") add_compile_options(-Wpedantic) #add_compile_options(-Wbad-function-cast) add_compile_options(-fvisibility=hidden) + add_compile_options(-fPIC) if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_compile_options(-g3) add_compile_options(-fno-omit-frame-pointer) @@ -47,6 +48,7 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU") add_compile_options(-Wfloat-equal) add_compile_options(-Wwrite-strings) add_compile_options(-fvisibility=hidden) + add_compile_options(-fPIC) if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_compile_options (-Wstrict-overflow=4) add_compile_options(-ggdb3)