I’m currently porting a crossplatform project to CMAKE and so far I’ve been able to just use find_package() or add_subdirectory() when dealing with third party libraries, but I don’t know how do it with Windows APIs. In particular, I’m trying to add synchapi.h.
You don’t need to handle it in CMake - just include it in your C/C++ file:
#include <synchapi.h>
It should be in the compiler’s default search path. If it’s not then I’m guessing there’s a problem with your toolchain.
Looks like I’m lacking something still, getting linker error:
unresolved external symbol WakeByAddressAll referenced in function
Do I need to specify binary location of windows API? Btw, I specified MT/MTd for windows.
Looks like a link-time error rather than a compile-time error. You may need to do:
target_link_libraries(foo Synchronization)
though I’m surprised it’s not being linked already. sorry, I looked at this page and referenced the DLL, not the .lib.
1 Like
That did the job, now I got to deal with some errors regarding macros.