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

Json support for Cmake version 2.8.12 #1699

Closed
theamatuer opened this issue Aug 5, 2019 · 3 comments
Closed

Json support for Cmake version 2.8.12 #1699

theamatuer opened this issue Aug 5, 2019 · 3 comments

Comments

@theamatuer
Copy link

Is it possible to change the CmakeLists.txt file so that it can support Cmake version 2.8.12? If not directly, then I'd appreciate it if someone can tell me what features of the library are enabled by 3.1 and I'll see if I can try to work without them

@nlohmann
Copy link
Owner

nlohmann commented Aug 5, 2019

The easiest way would be if you changed the minimally required version in the CMake file yourself and see where your CMake version is complaining.

@theamatuer
Copy link
Author

ok looks like Cmake 2.8 prevents you from setting the version number in the project declaration, which in turn prevents stops write_basic_package_version_file from working. commenting out these sections seems to let cmake compile it thanks

@theamatuer
Copy link
Author

theamatuer commented Aug 5, 2019

okay I managed to figure out a workaround that let me run write_basic_package_version_file() using Cmake 2.8.12 , which basically has me using the VERSION parameter as well and changing SameMajorVersion to AnyNewerVersion. Dunno if that breaks anything but for now it's compiling and running my code so it probably works

these are the specific parts I changed, Gonna close it then

if (POLICY CMP0048)
  cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)

##
## PROJECT
## name and version
##


project(nlohmann_json)
set (NLOHMANN_JSON_VERSION 3.6.1)

...
...

##
## INSTALL
## install header files, generate and install cmake config files for find_package()
##
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
    ${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE} VERSION ${NLOHMANN_JSON_VERSION} COMPATIBILITY AnyNewerVersion
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants