Getting used to cmake

11OLSEN's icon

Hi, I'm trying to get on with the new sdk and finally VS 2019. I want to recompile some externals and keep on creating new ones. I'm relatively unexperienced with cmake but compiling the sdk examples was straight forward. But most of my externals have additional dependencies. I started with a simple test

#include "ext.h"                        
#include "ext_obex.h"
#ifdef WIN_VERSION
#include "windows.h"
#include "commctrl.h"
#else ...

but methods from commctrl.h throw "unresolved symbol" errors. Do I have to link with the Win 10 SDK somehow?
I tryed to add this to the CMakeLists.txt

#WIN SDK LIBS
link_directories(
    "C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0")

with no success

testcase's icon

I;m not on windows but could you post the cmake file you are using?

11OLSEN's icon

it's the default which is the same for every example project

CMakeLists.txt
text/plain 0.51 KB

When I switch the cmake generator in VS from "ninja" to "Visual Studio 16 Win64" the generation detects win 10 sdk and everything, but building fails. It must be something simple like adding some lines to the cmakelists.txt

testcase's icon

what version of cmake are you using?

11OLSEN's icon

cmake 3.20 - I don't think it's a problem of the toolchain which is automatically installed and updated by visual studio.

11OLSEN's icon

I finally found the solution by simply adding the lib name to the C standard libraries variable.