diff --git a/projects/amdsmi/CMakeLists.txt b/projects/amdsmi/CMakeLists.txt index c4d22fecc6..8a99a2ee6a 100644 --- a/projects/amdsmi/CMakeLists.txt +++ b/projects/amdsmi/CMakeLists.txt @@ -97,6 +97,10 @@ option(ENABLE_ASAN_PACKAGING "" OFF) option(ENABLE_ESMI_LIB "Build ESMI Library" ON) option(BUILD_EXAMPLES "Build examples" OFF) +# If amdsmi is built as a static library, it should support being embedded in other programs. The setting below essentially enables the -fPIC flag. +set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Enable position independent code for all targets") +mark_as_advanced(CMAKE_POSITION_INDEPENDENT_CODE) + include(CMakeDependentOption) # these options don't work without BUILD_SHARED_LIBS cmake_dependent_option(BUILD_WRAPPER "Rebuild AMDSMI-wrapper" OFF "BUILD_SHARED_LIBS" OFF)