cmake: add explicit std::filesystem linking

Fix: https://github.com/InfiniTimeOrg/InfiniSim/issues/57
Supersede: https://github.com/InfiniTimeOrg/InfiniSim/pull/58
This commit is contained in:
Paul
2023-01-18 17:26:00 +01:00
parent 168ff53cb4
commit d6c266905b
2 changed files with 254 additions and 0 deletions

View File

@@ -305,6 +305,11 @@ if(NOT TARGET SDL2::SDL2)
endif()
target_link_libraries(infinisim PRIVATE SDL2::SDL2)
# Some toolchains (e.g. g++-8) require to explicitly link with the standard filesystem library
# See https://github.com/InfiniTimeOrg/InfiniSim/issues/57#issuecomment-1386889378
find_package(Filesystem REQUIRED)
target_link_libraries(infinisim PRIVATE std::filesystem)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
@@ -357,3 +362,4 @@ add_subdirectory(external/miniz)
add_subdirectory(external/nlohmann_json)
target_link_libraries(littlefs-do PRIVATE miniz)
target_link_libraries(littlefs-do PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(littlefs-do PRIVATE std::filesystem)