From ac8ea16f45594d8dcc6f56ecbe736fa60cd060aa Mon Sep 17 00:00:00 2001 From: Jonathan Dong Date: Mon, 23 Jan 2017 17:55:47 +0800 Subject: [PATCH] Added '-fPIC' to generate position independent code This is important if you try to link the generated static library into your dynamic library. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6a2dd659..25f23683b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ if (ENABLE_TESTS OR ENABLE_WEBMTS OR ENABLE_WEBMINFO OR ENABLE_WEBM_PARSER) require_cxx_flag_nomsvc("-std=c++11") endif () +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + add_cxx_preproc_definition("__STDC_CONSTANT_MACROS") add_cxx_preproc_definition("__STDC_FORMAT_MACROS") add_cxx_preproc_definition("__STDC_LIMIT_MACROS")