diff --git a/CMakeLists.txt b/CMakeLists.txt index 45c02bc77e9fc..10491f0e0e74f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,11 @@ if(CCACHE_PROGRAM) set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") endif() +# This compiles all the libraries with -fPIC, which is critical to link a static +# library into a shared lib. +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + option(USE_LLD "Use lld (from llvm) linker" OFF) option(USE_MOLD "Use mold (A Modern Linker)" OFF) diff --git a/cmake/TaichiCore.cmake b/cmake/TaichiCore.cmake index 5a0ad287e42b4..8cfc6afeaaf8c 100644 --- a/cmake/TaichiCore.cmake +++ b/cmake/TaichiCore.cmake @@ -126,10 +126,6 @@ if (TI_WITH_CC) list(APPEND TAICHI_CORE_SOURCE ${TAICHI_CC_SOURCE}) endif() -# This compiles all the libraries with -fPIC, which is critical to link a static -# library into a shared lib. -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - set(CORE_LIBRARY_NAME taichi_core) add_library(${CORE_LIBRARY_NAME} OBJECT ${TAICHI_CORE_SOURCE})