Skip to content

cmake VERSION_LESS_EQUAL #866

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

Closed
malytomas opened this issue Jan 17, 2019 · 2 comments
Closed

cmake VERSION_LESS_EQUAL #866

malytomas opened this issue Jan 17, 2019 · 2 comments
Assignees
Labels
bug build or testing cmake, meson, continuous integration, or testing related

Comments

@malytomas
Copy link
Contributor

Older versions of cmake, according to documentation: https://cmake.org/cmake/help/v3.5/command/if.html , do not know VERSION_LESS_EQUAL, just VERSION_LESS.

This leads to errors:

CMake Error at somewhere/jsoncpp/CMakeLists.txt:18 (if):
  if given arguments:

    "3.5.1" "VERSION_LESS_EQUAL" "3.13.1"

  Unknown arguments specified

This is the offending line:

if("${CMAKE_VERSION}" VERSION_LESS_EQUAL "${JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION}")

Cmake 3.7 seems to be the first version to support VERSION_LESS_EQUAL.

hjmjohnson added a commit that referenced this issue Jan 18, 2019
Older versions of cmake, according to documentation:
https://cmake.org/cmake/help/v3.5/command/if.html , do not know
VERSION_LESS_EQUAL, just VERSION_LESS.

This leads to errors:

CMake Error at somewhere/jsoncpp/CMakeLists.txt:18 (if):
  if given arguments:

    "3.5.1" "VERSION_LESS_EQUAL" "3.13.1"

  Unknown arguments specified

Resolves: #866
@hjmjohnson
Copy link
Contributor

@malytomas See new PR that attempt to fix this. Sorry for the oversight.

@hjmjohnson hjmjohnson self-assigned this Jan 18, 2019
@hjmjohnson hjmjohnson added bug build or testing cmake, meson, continuous integration, or testing related labels Jan 18, 2019
@malytomas
Copy link
Contributor Author

Hi,
thanks for quick response! :D

The PR fixes the aforementioned issue, unfortunately to only show another (sorry I have not tried this before).

Cmake 3.8 is first to introduce cxx_std_11 compiler feature: https://cmake.org/cmake/help/v3.8/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES

Offending line:

cxx_std_11 # Compiler mode is aware of C++ 11.

Commenting this line makes it work for me, but there might still be some other problems eg. in tests, which I have disabled. I may try it later.

An alternative to set the cxx standard: https://cmake.org/cmake/help/v3.1/prop_tgt/CXX_STANDARD.html with CXX_STANDARD_REQUIRED set to on.

Anyway, thanks for the effort to make this work on older cmake. I appreciate it :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build or testing cmake, meson, continuous integration, or testing related
Projects
None yet
Development

No branches or pull requests

2 participants