From c4fe622179bbf34c3b10fdc4056056177835a3e3 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Fri, 23 Dec 2022 09:27:00 -0500 Subject: [PATCH] build(PythonPackages): Enable CMAKE_POSITION_INDEPENDENT_CODE For: /opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: _deps/libcbor-build/src/libcbor.a(serialization.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC 2701 /opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: _deps/libcbor-build/src/libcbor.a(common.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC 2702 collect2: error: ld returned 1 exit status --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eda0c3f34..088f312ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,9 @@ set(_itk_build_testing ${BUILD_TESTING}) set(BUILD_TESTING OFF) set(_itk_build_shared ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) +if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() # Uses newer CMake set(RapidJSON_GIT_REPOSITORY "https://github.com/thewtex/rapidjson.git")