function(link_system_libs target_name)
    if (WIN32)
        target_link_libraries(${target_name} winmm)
    elseif (APPLE)
        target_link_libraries(${target_name} pthread m dl)
    elseif (UNIX)
        target_link_libraries(${target_name} pthread m dl atomic)
    endif()
endfunction()

macro(use_cxx11)
    if (CMAKE_VERSION VERSION_LESS "3.1")
        if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
        endif ()
    else ()
        set(CMAKE_CXX_STANDARD 11)
    endif ()
endmacro(use_cxx11)
