Skip to content

Fix lowercase include paths on Mac - #4325

Merged
Garrett Campbell (gcampbell-msft) merged 3 commits into
microsoft:mainfrom
tringenbach:feature/fix-mac-include-paths-lowercase
Mar 10, 2025
Merged

Garrett Campbell (gcampbell-msft) merged 3 commits into
microsoft:mainfrom
tringenbach:feature/fix-mac-include-paths-lowercase

Conversation

@tringenbach

Copy link
Copy Markdown
Contributor

This change addresses item #1596

This changes the path normalization to not lowercase paths on Mac (darwin).

The purpose of this change

The C++ extension treats paths as case sensitive on MacOS. (In reality, sometimes they are, but it depends, usually not).

When CMakeTools converts them to lowercase and sends the include paths over, they don't work, and all the #include's that reference files in those paths get red squiggles.

I do not understand why converting to lower case would be desirable, even if it didn't break. The OS is at least case preserving, so the"normalized or canonical form really is the form the mixed case.

@gcampbell-msft

Copy link
Copy Markdown
Collaborator

Sean McManus (@sean-mcmanus) Colen Garoutte-Carson (@Colengms) Any thoughts on this PR?

It sounds like it's possible that the C++ extension should be treating mac paths as case-insensitive on the C++ side

@sean-mcmanus

Sean McManus (sean-mcmanus) commented Mar 7, 2025 •

Copy link
Copy Markdown
Contributor

Garrett Campbell (@gcampbell-msft) We treat mac paths as case sensitive. We only normalize (change the case) of paths on Windows (we change it to uppercase internally). The PR changes seems good to me. I don't think lowercasing paths on mac is a good idea.

@tringenbach

Copy link
Copy Markdown
Contributor Author

FWIW, Disk Utility on MacOS does allow me to create a case sensitive APFS filesystem.

image

Perhaps more practical, when I saw lowercase paths in the logs in VSCode, that jumped out at me as "wrong". So even if you changed the C++ extension to accept it, it would "look wrong" and get blamed incorrectly for other problems. At least that's my logic.

I'm happy with whatever works though :)

@gcampbell-msft

Copy link
Copy Markdown
Collaborator

I'm happy to take this then Tim (@tringenbach) could you make a changelog update and pull it up to date with main? Then, I'll approve

@tringenbach
Tim (tringenbach) force-pushed the feature/fix-mac-include-paths-lowercase branch from 4b14d09 to 4edd184 Compare March 8, 2025 00:30
@tringenbach
Tim (tringenbach) force-pushed the feature/fix-mac-include-paths-lowercase branch from 4edd184 to 7090763 Compare March 8, 2025 00:32
@tringenbach

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@tringenbach

Copy link
Copy Markdown
Contributor Author

I'm happy to take this then Tim (@tringenbach) could you make a changelog update and pull it up to date with main? Then, I'll approve

Sure! How's that?

@gcampbell-msft

Copy link
Copy Markdown
Collaborator

Tim (@tringenbach) Slightly updated, and approved, I will merge once tests and builds pass. Thanks!

@gcampbell-msft

Copy link
Copy Markdown
Collaborator

Already passed tests and build, just a merge conflict resolution for the changelog, merging.

@gcampbell-msft
Garrett Campbell (gcampbell-msft) merged commit 4dc5400 into microsoft:main Mar 10, 2025
hippo91 pushed a commit to hippo91/vscode-cmake-tools that referenced this pull request Mar 29, 2025
* Fix lowercase include paths on Mac

* Update CHANGELOG for version 1.21

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>
Mateusz Pfeifer (fajkomix1990) pushed a commit to fajkomix1990/mati---glowny that referenced this pull request Jul 2, 2025
* Fix lowercase include paths on Mac

* Update CHANGELOG for version 1.21

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>
Hannia Valera (hanniavalera) pushed a commit that referenced this pull request May 13, 2026
* Adds a new end to end test directory devoted to ctest tests

* Fix non stopping breakpoints

* Adds scripts entry for new end to end ctest

* Adds configurations for new end to end ctest test

* Do not forbid test refreshing even in test mode

* Fix end to end test devoted to ctest

* Test is functionnal when running through debug

* Add "allowParallelJobs" in the config

* Removes useless files

* Replaces TestCleanup target with simpler call in the teardown method

* Add cmake.ctest.allowParallelJobs setting

* Upgrade cmake minimum required version to avoid warnings

* Sets up two tests. One with parallel jobs enabled and the other without

* Remove useless file

* Adds two tests dealing with testSuiteDelimiter

* Remove generated test file between each test

* Do not delete file if it is not present

* Fix test suite delimiter

* Do not add a comma if no text is appended

* Delete test file results before the test

* Create cleanUpTestResultFiles to factorize code

* Adds explicit message to failing assertions

* Fix comment

* Generalize output writing

* Protect empy successor when dealing with last element of the container

* Adds doc and format

* Move suite initialization in the right method

* Await for settings change promise

* Set CMT_TESTING to one

* Restore previous state

* Renames files and targets

* Create a TestUtils lib to factorize code

* Start templating test file

* Move cmake stuff in its own module

* Adds doc

* Set tests definition in CMake presets

* Renames preset

* Remove generated test from git

* Fix generate_test_source_file function and return value

* Introduces use of common directory to store test result

* Defines common tests directory in cmake cache variables

* Add and fix doc. Renames variable.

* First ry to retrieve CMakePresets name in the test

* Remove tmp test dir, its location being read from CMakePresets.

* Reword test labels

* Format

* Turns method into free function to be reused in other test suites

* Removes unused import

* Adds another test suite to check test failure detection

* Typo

* Adds comments

* Factorize code

* Add newline at eof

* Typos

* Adds suite test to check when all tests fail

* Adds doc. Removes comment

* Moves test env initialization into commonSetup method to avoid code duplication

* Adds doc

* Remove dead code

* Adds endToEndTestsSingleRootCTest to the list of tests to run in the CI pipelines for windows, linux, and macos.

* Remove launch configuration modification that was not made on purpose

* Enable test explorer for those test suites

* Keeping integrity of the return code as suggested in the review comments

* Takes into account code review suggestions

* Specify compilers for linux and windows systems.

* Select the preset according to the OS type

* Updated Issue Template Selection (#4335)

* updated templates

* wording updates

* updated changelog

* template updates

* Fix 3232 (#4223)

* Adds the getAllCMakeProjects method

* Loop over all CMake projects of the workspace to provide tasks.

Also pass the workspaceFolder to the provideTask method

* Add workspacefolder property to the CustomBuildTaskTerminal class.

This is necessary to make each task run in the correct project

* Simplify getAllCMakeProjects method.

It is a simple delegation to the eponym method of projectController

* The scope is now always a workspaceFolder

* Adds the getDefaultPresetNameForProject function

* Renames getDefaultPresetName function into getDefaultPresetNameForActiveProject

* Renames getActiveProject method into getProject method

Using workspaceFolder scope allows to retrieve the project using this folder

* Adds doc

* Get the preset for the specified workspace using the new getDefaultPresetNameForProject function

* Fix trailing space

* Adds comment

* Adds the method getProjectForFolder in the extension.

It is mostly a delegation to the eponym method of the projectController

* Update CHANGELOG.md (#3232)

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* feat: add `cmake.ctest.debugLaunchTarget` (#4273)

* feat: add `cmake.ctest.testSuiteDelimiter.debugLaunchTarget`

* fix: setting name

* fix: description name

* chore: add changelog entry

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* fix(ctest): don't require backtrace in presence of DEF_SOURCE_LINE (#4321)

* ctest: Don't require backtrace in presence of DEF_SOURCE_LINE

* docs: add CHANGELOG entry

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* Fix lowercase include paths on Mac (#4325)

* Fix lowercase include paths on Mac

* Update CHANGELOG for version 1.21

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* Fix gnuld error parsing false positive on make errors, false negative due to trailing \r, and false parsing of new "multiple definitions" error (#4341)

* Fix gnuld error parsing false positive on make errors, false negative due to trailing \r, and false parsing of new "multiple definitions" error

* Move bug fix entry in CHANGELOG to 1.21 section

* Dev/snehara/update readme (#4338)

* graphics

* more images

* readme updates

* whitespace

* html sanitization

* made picture clarity better

* Update README.md

* Update README.md

* rewording suggestion from Garrett

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* rewording suggestion from Garrett

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* rewording suggestion from Garrett

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* rewording suggestion from Garrett

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* reordered features

* rewording and fixing broken contributing link

* removed extra period

* made feature and banner updates

* updated alt text

* reverted wording

* removed cache editor feature image

* updated wording for presets support feature

* removed extra image

---------

Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>

* fix getProjectForFolder (#4348)

* Don't require LCOV to be found in test project (#4351)

* Update README.md (#4350)

* Update README.md

added a brief description of the features we support

* updated readme

* be more explicit in what we check (#4352)

* Localization - Translated Strings (#4344)

Co-authored-by: csigs <csigs@users.noreply.github.com>

* Localization - Translated Strings (#4353)

Co-authored-by: csigs <csigs@users.noreply.github.com>

* Changes the location of temp directory holding the tests (TESTS_DIR).

Using /tmp is not compatible with windows use

* Remove useless CMAKE variable

* Adapt single-root-ctest end-to-end tests to current API and fix Windows portability

 * Adopt CommandResult.exitCode API for cmake.ctest assertions (cmakeProjProject.ctest() now returns Promise<CommandResult>)
 * Set CMT_TESTING_OVERRIDE_TEST_EXPLORER=1 in launch.json so refreshTests in test mode falls through to runCTestImpl
 * Resolve cleanUpTestResultFiles ${workspaceFolder} macro at runtime instead of letting it land literally in y in rimraf
 * Pin Windows generator to "Visual Studio 17 2022" (windows-2022 runner no longer ships VS 16 2019)
 * Set CXX_STANDARD 17 on generated test executables (MSVC default is C++14 and the sources use <filesystem>)
 * Use path::string() in generate_output_file.cpp (path::string_type is std::wstring on Windows)
 * Set WINDOWS_EXPORT_ALL_SYMBOLS on TestUtils so the .lib import library is generated on MSVC

* enhance end-to-end CTest tests: update paths for cross-platform compatibility, improve directory handling, and refactor test configuration management.

* cleanUpTestResultFiles now derives the test result directory from the configure preset's `cacheVariables.TESTS_DIR` (expanding ${sourceDir})
   rather than a hardcoded literal that could silently drift, and guards
   the rmdir with `fs.exists` so the very first setup() — when the
   directory is absent — does not throw.
 * Snapshot the workspace-folder values of `cmake.ctest.allowParallelJobs`
   and `cmake.ctest.testSuiteDelimiter` once before any suite runs and
   restore them once after every suite has finished, so the project's
   checked-in `.vscode/settings.json` is no longer left dirty by a test
   run. Restoration intentionally happens in a global `after` hook (not
   per-suite) because writing the setting fires the extension's
   `refreshTests` cascade; deferring it to the very end avoids the
   cascade racing with the next suite's `BuildDirectoryHelper.clear()`
   on Windows (EBUSY) and isolates the shutdown-time build attempt to a
   scoped try/catch.

* lint errors

---------

Co-authored-by: Guillaume Peillex <guillaume.peillex@cea.fr>
Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com>
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
Co-authored-by: nerix <nero.9@hotmail.de>
Co-authored-by: Ron <45816308+rjaegers@users.noreply.github.com>
Co-authored-by: tringenbach <tim.ringenbach@gmail.com>
Co-authored-by: 0xemgy <139615394+0xemgy@users.noreply.github.com>
Co-authored-by: Tofik Sonono <tofik.sonono@intel.com>
Co-authored-by: csigs <csigs@users.noreply.github.com>
Co-authored-by: Local Merge <noreply@anthropic.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants