Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Missing use of CMAKE_DEBUG_POSTFIX #2121
I did this
Build a latest 7.56.1 curl on Windows with Debug configuration and
I expected the following
I except fo find a
I think the reason is that a line
Both 7.56.1 and master branch contain this line.
Windows, Visual Studio 2015, x86
@bagder Depends on naming conventions you want to use for library name.
will definitely enforce exact postfix for name without any customization possible.
IMO, for Windows sometimes it is good to have information in which mode it was built.
I don't personally build either on windows nor with cmake which is why I'm asking for input. If nobody has any opinions which way is the best, the most common way or just works out better in practice, then I'm fine with closing this but it feels like our current way has landed without a lot of thought on these details...
I have an opinion, and I have put thought into it, based on my experiences of debugging debug-release mismatched library link issues.
@theirix Please read the details in my #1649 pull.
Having said that, I don't see any problem with being able to override via CMAKE_DEBUG_POSTFIX.
I imagine we'd put something like this at the top of CMakeLists.txt
And then adjust the below to:
I would suggest that the default behaviour is the safest - use postfixes in the filenames.
Oh, and I chose "-d" instead of "-debug" as I was following other conventions from other libraries. There are probably 3 different naming conventions commonly seen, but -debug and -release is not one of the more common ones I've come across.
We have a different issue at #1857 that I have a related question about. We are thinking about making the debug postfix uniform across builds, so that winbuild uses d (instead of _debug) and cmake uses d (instead of -d). Visual Studio project files already use d like curld.exe and libcurld.dll. Do you think we should leave them alone or make them uniform? I thought it would be easier to make them uniform but now I'm not sure.
I personally prefer -d to d because I prefer the variant / versions to be separate from the project name, not mashed together (ie becoming curld).
But name would be much worse if it were
-debug is not too bad, but its just longer than it needs to be.
@paulharris Everyone has his/her preferences to the naming. I for once prefer simply "d". But above all they should be uniform. It's a pain in the back when one has to depend on the way the lib has been build to get the right suffix in some scripts. This is also one of the reasons I have started with #1857 in the first place.
As for the way the postfix is set, I agree with @snikulov - it shouldn't be hardcoded with target properties but use the standard CMake variable.
Of course I understand that VS builds prefer to use different suffices for debug and release builds. It's ok if the build have a default suffix (