diff --git a/cmake/GhcHelper.cmake b/cmake/GhcHelper.cmake index 4ebbe73..5443d36 100644 --- a/cmake/GhcHelper.cmake +++ b/cmake/GhcHelper.cmake @@ -7,14 +7,18 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION endif() add_executable(${targetName} ${ARGN}) set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17) - if(APPLE) - target_link_libraries(${targetName} -lc++fs) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + if(APPLE) + target_link_libraries(${targetName} -lc++fs) + else() + target_compile_options(${targetName} PRIVATE "-stdlib=libc++") + target_link_libraries(${targetName} -stdlib=libc++ -lc++fs) + endif() else() - target_compile_options(${targetName} PRIVATE "-stdlib=libc++") - target_link_libraries(${targetName} -stdlib=libc++ -lc++fs) + if(NOT APPLE) + target_link_libraries(${targetName} -stdlib=libc++) + endif() endif() - - target_link_libraries(${targetName} -lc++fs) target_compile_definitions(${targetName} PRIVATE USE_STD_FS) endif()