Avoid attempt linking to std::fs when target does not exist (#1131)

This commit is contained in:
Martin Chang 2021-12-21 22:22:57 +08:00 committed by GitHub
parent 03f34cb40b
commit 52800006a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -192,9 +192,11 @@ if(NEED_BOOST_FS)
else()
option(HAS_STD_FILESYSTEM_PATH "use std::filesystem" ON)
# HACK: Needed to be compiled on Yocto Linux
get_property(CAN_LINK_FS TARGET std::filesystem PROPERTY INTERFACE_LINK_LIBRARIES SET)
if ( CAN_LINK_FS )
target_link_libraries(${PROJECT_NAME} PUBLIC std::filesystem)
if(TARGET std::filesystem)
get_property(CAN_LINK_FS TARGET std::filesystem PROPERTY INTERFACE_LINK_LIBRARIES SET)
if ( CAN_LINK_FS )
target_link_libraries(${PROJECT_NAME} PUBLIC std::filesystem)
endif()
endif()
endif()