• Roman Lebedev's avatar
    CMake: use threads if allowed and found, not just if found. · 1a62d1b0
    Roman Lebedev authored
    If the user's cmakelists.txt first look for threads using
    find_package(Threads), then set(gtest_disable_pthreads ON),
    and then include googletest. GoogleTest will not look for
    threads. But since they have already been found before in
    user's cmakelists, it will use them regardless.
    
    This helped me fix build issue in darktable-org/rawspeed
    on windows/MSYS2, even though there are threads, and they
    are usable, googletest build was failing with issues
    about AutoHandle. I was first looking for threads, and only
    then including googletest, so no matter the value of
    gtest_disable_pthreads, it failed.
    
    The other obvious solution is for user to first include
    googletest, and only then look for threads by himself.
    1a62d1b0
CMakeLists.txt 8.44 KB