-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If CMake supports it, sets the debugger working directory for Visual … #1435
Conversation
The duplication hurts me :| Maybe we can add a macro 'openmw_add_executable' around 'add_executable' that also sets the target properties we want? |
It's in an |
Actually, that broke something. I don't really know what it broke or how (CMake still succeeds, but stuff isn't built properly). I don't see anything particularly wrong with anything when I investigate it. |
cmake/OpenMWMacros.cmake
Outdated
macro (openmw_add_executable target) | ||
add_executable(${target} ${ARGN}) | ||
if (MSVC) | ||
if (CMAKE_VERSION VERSION_GREATER 3.8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this only be true for CMake versions 3.9 and up? VS_DEBUGGER_WORKING_DIRECTORY was added in version 3.8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Apparently VERSION_GREATER_EQUAL
hasn't been around for that long, either, so I'll have to use an OR
.
This may or may not be related, but the two projects that fail to compile, the wizard and the launcher, both pass ${GUI_TYPE} as an argument, which is either set to WIN32 or unset. Before this macro was added, the arguments passed to add_executable started with EDIT: Additionally this generates CMake warnings CMP0003 and CMP0020 which did not occur before. So this is definitely caused by incorrect linker options. |
I've done some more experimentation. If I surround I reckon this means that with correct placement of quotes in every call to |
I've done some experimenting. It still doesn't work, but it should be easier to see why it might not be working |
I'm printing a bunch of stuff with Unfortunately, we still can't find our |
If I make it so |
Finally I have something I can work with. If I use the master version of the CMake files, the Wizard and Launcher projects depend on There's still the open question of why this transitive dependency isn't added by CMake after my changes. Theoretically, it still should be, as the transitive dependency on |
I'm under the impression that anything to do with Qt is a symptom rather than a cause. I still think that there's something broken with how I'm wrapping |
I think I fixed it. It seems policies CMP0003 and CMP0020 were being unset upon entering the macro, so I turned them back on. I'm not sure why this is - I didn't think macros created a new scope. |
Possibly a bug? Have you tried contacting the cmake people for their advice? |
Were they even being set in the first place? |
I looked it up, and apparently, macros and functions have the same policies set as when they were defined, not when they were called. At some point we probably have a Before doing this, I did print out their values both inside and outside my new macro, and they were definitely set outside of it. It still isn't the cleanest thing imaginable. In order to make this cleaner, the only real solutions are to:
As hacks go, the current one seems to be the neatest possible. |
I think it'd be reasonable to set the cmake_minimum_version (and hence policy) at the start of cmake file, before importing macros. |
I'll take a look at doing that. Right now, it's set quite a way down the top-level CMake file, but I think I can rearrange it without breaking anything. |
…Studio
This should stop a bunch of threads appearing on the forum where a user has attempted to launch Visual Studio's debugger right after using the Windows build script and then suddenly found that it doesn't work properly.