Neo*_*aru 13 windows header pthreads cmake include
我是CMake的新手.我在Linux上测试了我正在制作的程序.这个程序使用(POSIX Threads lib),所以在我的CMakeList中,我添加了:
find_package(Threads)
Run Code Online (Sandbox Code Playgroud)
它适用于Linux发行版(Arch,Mint,Ubuntu,...),但现在,我正在Windows32(Visual Studio 9 2008)中尝试它,我在生成过程中收到此消息:
-- Looking for include file pthread.h - not found
Run Code Online (Sandbox Code Playgroud)
(当我编译输出项目文件时,确实找不到pthread.h).
在Windows上,考虑"C:\ pthread"作为我的pthread目录,我在路径中定义:
但我仍然得到相同的错误(即使删除缓存后).我知道我可以在我的Project中"手动"添加Pthread,或者在CMakeList.txt中定义一些常量,但我认为这不是CMake的原理:我可以在所有系统上使用SAME"CMakeList.txt",对吧?那么我怎么能告诉CMake"嘿!看这里!Pthread就在这个目录中!".也许Cmake没有查看PATH,但在另一个环境变量中,但我没有找到这些信息.
谢谢你的阅读.
编辑:我不知道它是否有所作为,但我的项目是一个C++项目(而不是C)
我做了什么,我编辑了 cmake 文件:
option(CMAKE_USE_WIN32_THREADS_INIT "using WIN32 threads" ON)
Run Code Online (Sandbox Code Playgroud)
和
option(gtest_disable_pthreads "Disable uses of pthreads in gtest." ON)
Run Code Online (Sandbox Code Playgroud)
(我正在使用谷歌测试)
据我所知,Windows 平台本身不支持 Pthreads。除非你使用类似的东西
Windows 只有 win32 线程。
然而,这是一个在 Windows 上提供 pthreads 的项目
归档时间: |
|
查看次数: |
27170 次 |
最近记录: |