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

Error "Version string portion was too short or too long" for msvc with native cmake #809

Closed
whannes opened this issue Jul 13, 2018 · 7 comments

Comments

@whannes
Copy link

whannes commented Jul 13, 2018

When adding fmtlib as a subfolder to any of my projects in MSVC 2017 (Windows 10) with native cmake support (cmake: 3.11.18040201-MSVC_2) I get an error :

1> Version string portion was too short or too long.
   at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
   at System.Version.TryParseVersion(String version, VersionResult& result)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at libcmake.CMakeProjectBase`3.<ExtractInfoGeneric>d__94`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at libcmake.CMakeLists.<ExtractInfo>d__114.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at libcmake.CMakeLists.<ParseWithoutCacheAsync>d__113.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.CMake.Project.CMakeListsUtils.<ParseAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.VisualStudio.CMake.Project.CMakeListsCache.<ParseAsync>d__28.MoveNext()

I think it is somehow related to the version requirements in the CMakeLists.txt:

if(${CMAKE_VERSION} VERSION_LESS 3.12)
  cmake_policy(VERSION ${CMAKE_VERSION})
endif()

When using cmake from the command line, it does not occur.

@vitaut
Copy link
Contributor

vitaut commented Jul 14, 2018

Reverted the problematic CMake commit in ae4a394, but please report the issue to MSVC developers since it looks like a bug in their parser.

@vitaut vitaut closed this as completed Jul 14, 2018
@henryiii
Copy link
Contributor

Might be fixable from the CMake side too. I’ll check this next week.

@henryiii
Copy link
Contributor

henryiii commented Jul 15, 2018

@Aletschhorn, can you try replacing ${CMAKE_VERSION} with ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}? I think the problem is your CMake version (3.11.18040201-MSVC_2) has a -moreinfo on the end (which is allowed) but that is not recognized in this expression. I won't have access to my Windows VM until Monday.

@whannes
Copy link
Author

whannes commented Jul 16, 2018

I quickly checked again, whats MSVC does not like is
cmake_minimum_required(VERSION 3.1.0...3.11)
On the CMake website (https://cmake.org/cmake/help/v3.12/command/cmake_minimum_required.html) it says:

if the running version of CMake is older than 3.12, the extra ... dots will be seen as version component separators, resulting in the ... part being ignored and preserving the pre-3.12 behavior of basing policies on .

Thus, as mentioned by @vitaut , this seems like a bug from the MSVC implementation.

@henryiii
Copy link
Contributor

Thanks @Aletschhorn . I've added a request for a note in the documentation here: https://gitlab.kitware.com/cmake/cmake/issues/18178 .

henryiii added a commit to henryiii/fmt that referenced this issue Jul 16, 2018
@whannes
Copy link
Author

whannes commented Jul 16, 2018

Bug report for MS: https://developercommunity.visualstudio.com/content/problem/294070/cmake-312-version-requirements-definition-fails-fo.html

@whannes
Copy link
Author

whannes commented Nov 14, 2018

FYI: This has now just been fixed with the most recent MSVC update.

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

No branches or pull requests

3 participants