summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--contrib/patches/picoc/CMakeLists.txt2
2 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8112d10..7906396 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,10 @@ include("${CMAKE_MODULE_PATH}/USCXMLMacros.cmake")
# use folders in the IDEs for the various targets
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+# compile with fPIC if required
+# see https://stackoverflow.com/questions/38296756/what-is-the-idiomatic-way-in-cmake-to-add-the-fpic-compiler-option
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
# use rpath with MacOSX
set(CMAKE_MACOSX_RPATH 1)
diff --git a/contrib/patches/picoc/CMakeLists.txt b/contrib/patches/picoc/CMakeLists.txt
index 76fe184..2792907 100644
--- a/contrib/patches/picoc/CMakeLists.txt
+++ b/contrib/patches/picoc/CMakeLists.txt
@@ -3,6 +3,8 @@ project(picoc)
# include_directories(${PROJECT_SOURCE_DIR}/include)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
file(GLOB PICOC_FILES
${PROJECT_SOURCE_DIR}/*.h
${PROJECT_SOURCE_DIR}/*.c