[SWDEV-538483] Fix C++17 fs linking for GCC<9.0
Added check for GCC versions prior to 9.0 and link with libstdc++fs when needed. This fixes undefined symbols on older systems like Deb10 with GCC 8.3.0. Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com> Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Esse commit está contido em:
commit de
Arif, Maisam
pai
1b027d15bd
commit
e1b3d5f02e
@@ -90,6 +90,15 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Link with stdc++fs for filesystem support (only for GCC < 9.0)
|
||||
set(FILESYSTEM_LIB "")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
set(FILESYSTEM_LIB stdc++fs)
|
||||
message(STATUS "GCC ${CMAKE_CXX_COMPILER_VERSION} detected, linking with stdc++fs for filesystem support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(BUILD_TESTS "Build test suite" OFF)
|
||||
|
||||
@@ -49,6 +49,7 @@ target_link_libraries(${ROCM_SMI_TARGET} PRIVATE
|
||||
rt
|
||||
Threads::Threads
|
||||
${CMAKE_DL_LIBS}
|
||||
${FILESYSTEM_LIB}
|
||||
)
|
||||
target_include_directories(${ROCM_SMI_TARGET} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
||||
@@ -88,6 +88,7 @@ target_link_libraries(${AMD_SMI} PRIVATE
|
||||
rt
|
||||
Threads::Threads
|
||||
${CMAKE_DL_LIBS}
|
||||
${FILESYSTEM_LIB}
|
||||
)
|
||||
target_include_directories(${AMD_SMI} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
||||
@@ -61,12 +61,7 @@ include_directories(${TEST} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${ROCM_INC_DIR}/..)
|
||||
|
||||
# Build rules
|
||||
add_executable(${TEST} ${tstSources} ${functionalSources})
|
||||
target_link_libraries(${TEST} ${AMD_SMI} GTest::gtest c stdc++ pthread)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9")
|
||||
target_link_libraries(${TEST} stdc++fs)
|
||||
endif()
|
||||
target_link_libraries(${TEST} ${AMD_SMI} GTest::gtest c stdc++ pthread ${FILESYSTEM_LIB})
|
||||
|
||||
# Install tests
|
||||
install(
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário