diff --git a/CMakeLists.txt b/CMakeLists.txt index 20555bc..003c3a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,14 @@ set( CMAKE_INCLUDE_CURRENT_DIR ON ) find_package( Threads ) +## +# Build with -fPIC +## +mark_as_advanced( BUILD_FPIC ) +set( BUILD_FPIC true CACHE BOOL "Generate position-independent code (-fPIC)" ) +if( BUILD_FPIC ) + set(BUILD_FPIC_FLAG "-fPIC") +endif( BUILD_FPIC ) ## # AFFINITY_CUSTOM_NAMESPACE - set to true if you want diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b4c49c6..698476b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,5 +6,9 @@ if (NOT WIN32) target_link_libraries( affinity PUBLIC ${CMAKE_THREAD_LIBS_INIT} ) endif() +target_compile_options( affinity + PUBLIC + ${BUILD_FPIC_FLAG} ) + install( TARGETS affinity ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )