Skip to content
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

Work around newer CMake and MSVC support #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Alex-Beng
Copy link

  1. Eliminate two cmake warnings.
CMake Warning (dev) at CMakeLists.txt:6 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
CMake Deprecation Warning at CMakeLists.txt:7 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

There are two CMake warnings when using newer CMake(above 3.5) and the wrong order of cmake_minimum_required(should be the first line)

In order to maintain compatibility with lower versions of CMake and eliminate warnings, the order of CMake statements was changed and the <min>...<max> form was used to set the version range.

  1. Work around newer MSVC support

In VS 2015 and newer, the snprintf is supported, so there is no need to add define by -Dsnprintf=_snprintf, which can be found in here

The corresponding MSVC_VERSION for MSVC can be found here. Although i have not tested it on lower versions of Visual Studio, it should work.

I tested in MSVC 2019 and 2022 with CMake 3.29.3.

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.

1 participant