CMake : not found in Windows

前端 未结 3 579
南笙
南笙 2021-02-05 14:55

I\'m newbie with CMake. I tested it on Linux for a program I am making. This program uses (POSIX Threads lib), so in my CMakeList, I added :

find_package(Thread         


        
相关标签:
3条回答
  • 2021-02-05 15:29

    What I did, I edited the cmake file:

    option(CMAKE_USE_WIN32_THREADS_INIT "using WIN32 threads" ON)
    

    and

    option(gtest_disable_pthreads "Disable uses of pthreads in gtest." ON)
    

    (I am using google test)

    0 讨论(0)
  • 2021-02-05 15:30

    As far as i know, Pthreads is not natively supported on windows platform. Unless you use some thing like

    win services for unix

    Windows only has win32 threads.

    However, this is a project which provides pthreads on windows

    pthreads on win32

    0 讨论(0)
  • 2021-02-05 15:38

    Apparently the CMAKE_USE_WIN32_THREADS_INIT is useful in context of all platforms. This variable is generated or initialised on invocation of findPackage(Threads), ideally it handles linking issues on all platforms in case thread library is required to be linked with executable. Basically it generates appropriate thread library name on platform unix like platforms and is empty on platform such as windows where explicit threading library is not required for linking. Reference: CMake findThreads https://cmake.org/cmake/help/v3.0/module/FindThreads.html?highlight=threads

    0 讨论(0)
提交回复
热议问题