Skip to content

[CMAKE] Make vc6 build process easier #1210

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"generator": "NMake Makefiles",
"hidden": false,
"binaryDir": "${sourceDir}/build/${presetName}",
"environment": {
"VS6_DIR": "$env{ProgramFiles(x86)}\\Microsoft Visual Studio",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcodes a path which doesn't work if its not at this path. I use a portable install that I have at an arbitrary path. I have to run the vcvars32.bat for it to make it work which isn't making my life easier. Even setting VS6_DIR doesn't fix it because this overwrites whatever I have set.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you figure out how to make it work for arbitrary paths without setting up environment outside of cmake then feel free to post a pull request with the alternate implementation. Without this, the only option is to use vcvars32.bat. With this, that option still remains but additionally for users who have their install in the default path or are willing to relocate their install to the default path, this makes it much easier. Alternatively they could also just edit the value of VS6_DIR in cmake presets to match their arbitrary path.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think editing the value in the CMakePresets.json is a behaviour we should even suggest, much less encourage or we'll end up with PRs inadvertently including changes to it. I'd rather this kind of enviroment specific config was provided in an example CMakeUserPresets.json instead that the user can copy to the root of their local repo copy and modify as appropriate as this file is already excluded by gitignore. This kind of user specific stuff is exactly what the user presets file is for.

This would give users 2 options....

  1. Run vcvars32.bat
  2. Copy our example to CMakeUserPresets.json to the root, modify as required. Use the custom preset and don't think about it again.

"PATH": "$env{VS6_DIR}\\VC98\\BIN;$env{VS6_DIR}\\Common\\Tools;$env{VS6_DIR}\\Common\\Tools\\WinNT;$env{VS6_DIR}\\Common\\MSDev98\\Bin;$penv{PATH}",
"INCLUDE": "$env{VS6_DIR}\\VC98\\INCLUDE;$env{VS6_DIR}\\VC98\\MFC\\INCLUDE;$env{VS6_DIR}\\VC98\\ATL\\INCLUDE;$penv{INCLUDE}",
"LIB": "$env{VS6_DIR}\\VC98\\LIB;$env{VS6_DIR}\\VC98\\MFC\\LIB;$penv{LIB}"
},
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL",
Expand Down
Loading