What I’ve tried. Just creating a win32 window in c++. Was pretty straightforward, the only configuring that needed to be done was project: properties → Linker ->system → sub system → windows
Now for the next step, integrate a win32 window with cmake. Uh oh, no way to go into properties. So when I try to execute I get a popup window that says “please select a valid startup item”. Which only appears when I have the win32 code in the cpp file. If I use the default cpp file visual studio creates with the make file I get “hello cmake” in the debug window.
I tried one more additional thing. In CmakeLists.txt I added:
add_executable(win32_wit_cmake WIN32 win32_wit_cmake.cpp)
My question is this. How do I make it so visual studio knows how to build a win32 window with cmake.
In your original post the target name was win32_wit_cmake, but this error message implies that you (also?) have cmake32_1 target, which you haven’t mentioned before. What other targets are you hiding from us?
That’s a yet another target name, the third one by now, in addition to win32_wit_cmake and cmake32_1.
Perhaps you should share your entire project file.
Hi, I started over from scratch. It says new users can’t upload attachments. If I go back to the original file I can’t even build it properly because I can’t select a startup item.
And you’ve never shared a text file over the internet?
You can use a pastebin service, such as this one, or create a public GitHub repository for your project.
If this is not a nested project, then I’d say you are missing the project() statement. And also the cmake_minimum_required().
Also I don’t understand what you are trying to achieve by creating the same target CMakeProject1 twice (as that CMake version check is very likely to pass).
Anyway, I actually lost track a bit of what your problem was. So I just tried to build your project (after fixing those problems), and here’s the application that I got running:
No, I usually set C/CXX standards per project, not as a target property like you did, so I deleted that line from your original project. But actually it shouldn’t matter in this case, as your application builds fine both with and without it.