[SWDEV-545751] CMAKE - Enable fPIC (#629)

Change-Id: Iaade10e70b3a39d6bca23ae98f9f501339ffd76d
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>

[ROCm/amdsmi commit: cd33b75540]
This commit is contained in:
Galantsev, Dmitrii
2025-08-19 11:39:39 -05:00
committato da GitHub
parent 61c817a2d3
commit beaffa2c84
+4
Vedi File
@@ -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)