Skip to content

Apply CMake best practices and remove stale references#1416

Open
bmehta001 wants to merge 6 commits intomicrosoft:mainfrom
bmehta001:bhamehta/code-cleanup
Open

Apply CMake best practices and remove stale references#1416
bmehta001 wants to merge 6 commits intomicrosoft:mainfrom
bmehta001:bhamehta/code-cleanup

Conversation

@bmehta001
Copy link
Copy Markdown
Contributor

@bmehta001 bmehta001 commented Mar 18, 2026

Pure build/project cleanup

CMake improvements (3 files)

Cleanup / CMake hygiene

  • add LANGUAGES C CXX to the top-level project() call
  • switch build/config logging to message(STATUS ...) instead of bare message(...)
  • Fix message(FATAL_ERROR, ...) comma bug (invalid CMake syntax)
  • fix if(EXISTS ...) quoting in lib/, tests/functests/, and tests/unittests
  • simplify cross-version file copies to configure_file(... COPYONLY)
  • remove stale Visual Studio project/header references
  • update VS toolset fallback logic in Solutions/before.targets and Solutions/build.MIP.props
  • Update MATSDK_API_VERSION from 3.4 to 3.10 to match recent releases
  • Remove empty compiler-id blocks (Clang/Intel/MSVC with no content); GCC -fPIC flags preserved
  • Remove commented-out bondlite test block and stale TODO comments
  • Remove duplicate include_directories entry

Visual Studio project cleanup (8 files)

  • Remove stale header references that no longer exist in the repo:
    • targetver.h (SampleCpp, SampleCppMini)
    • LogManagerV1.hpp (Shared.vcxitems)
    • MockILocalStorageReader.hpp (UnitTests.vcxproj)
    • SanitizerBaseTests.cpp (FuncTests.vcxproj)
  • Modernize VS toolset: use `` fallback instead of hardcoded v141 (Solutions/before.targets, build.MIP.props)

Packaging

  • keep the package install-dir overrides that Debian/RPM packaging expects
  • adjust packaging messages / cleanup so the CMake changes stay behavior-correct

@bmehta001 bmehta001 requested a review from a team as a code owner March 18, 2026 08:34
@bmehta001 bmehta001 force-pushed the bhamehta/code-cleanup branch 2 times, most recently from 34e4948 to 790fdd0 Compare March 18, 2026 09:03
@bmehta001 bmehta001 changed the title Use best CMake practices, rm outdated headers, and update VS settings Use best CMake practices, rm/update outdated code Mar 18, 2026
@bmehta001 bmehta001 force-pushed the bhamehta/code-cleanup branch 18 times, most recently from 9a5a166 to 2feeb94 Compare March 19, 2026 05:40
@bmehta001 bmehta001 self-assigned this Mar 19, 2026
Comment thread lib/CMakeLists.txt Outdated
Comment thread lib/CMakeLists.txt Outdated
Comment thread lib/CMakeLists.txt Outdated
Comment thread lib/CMakeLists.txt Outdated
Comment thread lib/CMakeLists.txt Outdated
Copy link
Copy Markdown
Contributor

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

see comments.

Comment thread lib/http/HttpClient_Apple.mm Outdated
Copy link
Copy Markdown
Contributor

@ThomsonTan ThomsonTan left a comment

Choose a reason for hiding this comment

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

As a general suggestion, consider moving the cleanup changes into a separate PR to streamline the review process, reduce cognitive load, and accelerate merging by isolating functional changes from refactoring.

Comment thread lib/http/HttpClient_Apple.hpp Outdated
Comment thread CMakeLists.txt
@lalitb
Copy link
Copy Markdown
Contributor

lalitb commented Mar 21, 2026

This PR also duplicates the majority of changes from #1415 and parts of #1414. There is no unique content here worth preserving - the one thing it does differently from #1415 is the CMake quoting, and it does it incorrectly.

@bmehta001 bmehta001 force-pushed the bhamehta/code-cleanup branch 4 times, most recently from e303041 to 9a91839 Compare April 1, 2026 16:55
@bmehta001 bmehta001 force-pushed the bhamehta/code-cleanup branch 7 times, most recently from dc4da4f to 83ac9bd Compare April 29, 2026 21:31
@bmehta001 bmehta001 changed the title Use best CMake practices, rm/update outdated code Apply CMake best practices and remove stale references Apr 29, 2026
- Modernize CMakeLists.txt: flatten nesting, deduplicate, use
  consistent quoting and variable patterns
- Remove stale header references from vcxproj and vcxitems files
- Simplify test CMakeLists.txt files
- Fix CMake conventions in packaging scripts

Co-authored-by: Copilot <[email protected]>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Build/project cleanup focused on improving CMake hygiene and removing stale Visual Studio project references, while modernizing toolset selection for newer VS installs.

Changes:

  • Standardize CMake logging to message(STATUS ...), improve if(EXISTS ...) quoting, and simplify test-data copying via configure_file(... COPYONLY).
  • Update SDK build version prefixing (MATSDK_API_VERSION to 3.10) and remove stale/commented build logic.
  • Remove references to deleted headers/sources from multiple .vcxproj / .vcxitems files and adjust MSBuild toolset selection defaults.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
CMakeLists.txt CMake best-practices cleanup (languages, STATUS messages), version bump, removes stale blocks/comments
lib/CMakeLists.txt Consistent STATUS messages, quoted EXISTS checks, fix message(FATAL_ERROR ...) syntax
tools/ParseOsRelease.cmake Quote EXISTS path; switch to message(STATUS ...)
tools/MakeTgz.cmake Switch packaging output to message(STATUS ...)
tools/MakeDeb.cmake Switch packaging output to message(STATUS ...)
tools/MakeRpm.cmake Switch packaging output to message(STATUS ...)
tests/unittests/CMakeLists.txt STATUS messages + quoting in EXISTS checks for optional test sources
tests/functests/CMakeLists.txt STATUS messages, quoting in EXISTS checks, simplify test.json copy logic
tests/unittests/UnitTests.vcxproj Remove stale project item reference to a non-existent test file
tests/functests/FuncTests.vcxproj Remove stale header reference from project items
tests/functests/FuncTests.vcxproj.filters Remove stale header reference from filters list
lib/shared/Shared.vcxitems Remove stale header include from shared items
lib/shared/Shared.vcxitems.filters Remove stale header include from shared items filters
examples/cpp/SampleCpp/SampleCpp.vcxproj Remove stale targetver.h reference
examples/cpp/SampleCpp/SampleCpp.vcxproj.filters Remove stale targetver.h reference from filters
examples/cpp/SampleCppMini/SampleCppMini.vcxproj Remove stale targetver.h reference
examples/cpp/SampleCppMini/SampleCppMini.vcxproj.filters Remove stale targetver.h reference from filters
Solutions/build.MIP.props Switch toolset selection to default toolset variable
Solutions/before.targets Update toolset fallback behavior to prefer default toolset variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/MakeRpm.cmake Outdated
Comment thread tests/functests/CMakeLists.txt Outdated
Comment thread tests/functests/CMakeLists.txt Outdated
Comment thread tests/functests/CMakeLists.txt Outdated
Comment thread tests/unittests/CMakeLists.txt Outdated
Comment thread tests/unittests/CMakeLists.txt Outdated
Comment thread Solutions/build.MIP.props Outdated
Comment thread Solutions/before.targets Outdated
bmehta001 and others added 5 commits April 30, 2026 06:57
Keep the before.targets toolset selection deterministic on newer
Visual Studio hosts, but only set the MIP props fallback when a
consumer has not already chosen a toolset. While addressing the
MSBuild review comments, also point the optional module test
conditions and source paths at the real lib/modules locations and
use CPACK_PACKAGE_FILE_NAME for the RPM status message.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants