Skip to content

add_compile_definitions command not available in cmake 3.8.2 #1018

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
crazySocket opened this issue Sep 4, 2019 · 4 comments · Fixed by #1057
Closed

add_compile_definitions command not available in cmake 3.8.2 #1018

crazySocket opened this issue Sep 4, 2019 · 4 comments · Fixed by #1057
Assignees
Labels
bug build or testing cmake, meson, continuous integration, or testing related

Comments

@crazySocket
Copy link

Describe the bug
You cannot build library with cmake in version 3.8.2.

To Reproduce
Make sure your cmake version is 3.8.2. Build the library.

Expected behavior
CMake fails to configure build since add_compile_definitions is not available in version 3.8.2.

Desktop (please complete the following information):

  • OS: windows 10
@baylesj
Copy link
Contributor

baylesj commented Sep 8, 2019

Good catch. We say we support version 3.8.0, but sounds like we don't.

@baylesj baylesj added bug build or testing cmake, meson, continuous integration, or testing related labels Sep 8, 2019
@dota17
Copy link
Member

dota17 commented Sep 10, 2019

In CMake 3.12 Release Notesadd_compile_definitions may be not added until CMake 3.12.

From PR #932 , add_definitions was changed to add_compile_definitions.
But in CMakeList.txt (root directory) , the oldestversion is still 3.8.0

set(JSONCPP_OLDEST_VALIDATED_POLICIES_VERSION "3.8.0")

Maybe we should change the above message or revert some change of the cmake cleanup.

@cdunn2001
Copy link
Contributor

cdunn2001 commented Oct 16, 2019

I have found Cmake to be nearly impossible to maintain because different versions are so very different. I only bother with Meson, and I generally accept any PR submitted for Cmake.

If someone has a fix for this, great. If the solution is to specify a later version of Cmake, that's fine with me.

@hjmjohnson
Copy link
Contributor

As this project is using C++11 features, cmake provides more robust support for C++11 features starting with version 3.12 and greater.

The new Cmake feature of "add_compiler_definitions" is certainly more appropriate, and more robust, but it a new feature that is only available in cmake 3.12 and greater. Ubuntu 18.04 envirionments come standard with cmake 3.10, so using the bleeding edge features of cmake is probably not a good idea for a project like jsoncpp. I'll have a look at fixing this later this week.

@hjmjohnson hjmjohnson self-assigned this Oct 16, 2019
hjmjohnson added a commit to hjmjohnson/jsoncpp that referenced this issue Oct 16, 2019
We desire for jsoncpp to compile and be readily available
with older  versions of cmake.  The use of newer cmake
commands requires conditional statements so that older
strategies can be used with older versions of cmake.

Resolves: open-source-parsers#1018
hjmjohnson added a commit to hjmjohnson/jsoncpp that referenced this issue Oct 16, 2019
We desire for jsoncpp to compile and be readily available
with older  versions of cmake.  The use of newer cmake
commands requires conditional statements so that older
strategies can be used with older versions of cmake.

Resolves: open-source-parsers#1018
hjmjohnson added a commit that referenced this issue Oct 17, 2019
We desire for jsoncpp to compile and be readily available
with older  versions of cmake.  The use of newer cmake
commands requires conditional statements so that older
strategies can be used with older versions of cmake.

Resolves: #1018
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

Successfully merging a pull request may close this issue.

5 participants