Fix Drogon not building caused by FindFilesystem (#1056)

* fix FindFilesystem not using the correct header for printf

* fix FS not found on Yocto
This commit is contained in:
Martin Chang 2021-10-21 19:43:53 +08:00 committed by GitHub
parent 5a03c9aa9f
commit e2eb674781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

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

View File

@ -194,7 +194,7 @@ set(_found FALSE)
if(CXX_FILESYSTEM_HAVE_FS)
# We have some filesystem library available. Do link checks
string(CONFIGURE [[
#include <cstdlib>
#include <cstdio>
#include <@CXX_FILESYSTEM_HEADER@>
int main() {
@ -204,6 +204,11 @@ if(CXX_FILESYSTEM_HAVE_FS)
}
]] code @ONLY)
# HACK: Needed to compile correctly on Yocto Linux
if(CMAKE_CXX_COMPILER_ID STREQUAL "GCC" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_REQUIRED_FLAGS ${prev_req_flags} -std=c++17)
endif ()
# Check a simple filesystem program without any linker flags
_cmcm_check_cxx_source("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)