include_guard(GLOBAL)
block()
    if (WIN32)
        _register_git_cmake_library(render_3D::pthreads4w
                "https://github.com/GerHobbelt/pthread-win32.git"
                "v3.0.3.1"
        )
        rcl_get_effective_install_dir(render_3D::pthreads4w PTHREADS4W_ROOT)
        set(PTHREADS4W_INCLUDE_DIR "${PTHREADS4W_ROOT}/include")
        if (CMAKE_BUILD_TYPE STREQUAL "Debug")
            set(PTHREADS4W_LIBRARY "${PTHREADS4W_ROOT}/lib/pthreadVC3d.lib")
        else ()
            set(PTHREADS4W_LIBRARY "${PTHREADS4W_ROOT}/lib/pthreadVC3.lib")
        endif ()
        set(pthreads4w_opts
                -DENABLE_TESTS=OFF
                "-DCMAKE_C_FLAGS=-D_WINDLL"
                "-DCMAKE_CXX_FLAGS=-D_WINDLL"
                "-DDLLDEST=${PTHREADS4W_ROOT}/bin"
                "-DLIBDEST=${PTHREADS4W_ROOT}/lib"
                "-DHDRDEST=${PTHREADS4W_ROOT}/include"
        )
        rcl_cmake_library_set_cmake_options(render_3D::pthreads4w ${pthreads4w_opts})
        rcl_cmake_library_set_other_use_opt(render_3D::pthreads4w
                "-DPThreads4W_INCLUDE_DIR=\"${PTHREADS4W_INCLUDE_DIR}\""
                "-DPThreads4W_LIBRARY=\"${PTHREADS4W_LIBRARY}\""
        )
        rcl_cmake_library_set_init_script(render_3D::pthreads4w
                "set(PThreads4W_INCLUDE_DIR \"${PTHREADS4W_INCLUDE_DIR}\")"
                "set(PThreads4W_LIBRARY \"${PTHREADS4W_LIBRARY}\")"
        )
        rcl_cmake_library_set_clear_script(render_3D::pthreads4w
                "unset(PThreads4W_INCLUDE_DIR)"
                "unset(PThreads4W_LIBRARY)"
        )
    endif ()
endblock()