1

EDIT: NEVERMIND - I had already successfully fixed this problem by putting a copy of the header where the compiler would find it. However, other build errors in cmake-gui kept referring me to the old error log file with the old build error, making me falsely believe I had not solved the problem.

I will close this question once the seven day bounty period is expired.


I am attempting to create a Windows port of a Linux library that uses pthreads via pthreads-win32, but I am having issues telling CMAKE where to locate pthreads.h. Does anyone know how to direct CMAKE to look to a specific location for pthreads.h? And also for the library file?

Alternately, is there some sort of magical global include directory I could use?

hoodaticus
  • 3,772
  • 1
  • 18
  • 28

1 Answers1

1

For example , in CMakeLists.txt , you can use INCLUDE_DIRECTORIES to include the path .

INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)

and you can add the link path of pthread.h with this when you want to link the library :

LINK_DIRECTORIES(directory1 directory2 ...)
TARGET_LINK_LIBRARIES(target library1<debug | optimized> library2...)

In here , it say that you can link with libwinpthread.a

Community
  • 1
  • 1
Mattia Dinosaur
  • 891
  • 10
  • 29