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

Cmake mod #1

Merged
merged 7 commits into from
May 28, 2020
Merged

Cmake mod #1

merged 7 commits into from
May 28, 2020

Conversation

pumkinpal
Copy link

I just made some minor cleanups as per ocornut#3027 (comment).

CMakeLists.txt Outdated
target_include_directories (imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

set_target_properties(imgui PROPERTIES CXX_STANDARD 11)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using compiler features be better here? I've never quite understood which one was the officially recommended way to do it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, compiler features are preferred and idiomatic way.
I realised (thanks to Mike-Devel ocornut#3027 (comment)) that setting the CXX_STANDARD property directly is a bad idea as it ignores CMAKE_CXX_STANDARD set by the parent project. Features such as "cxx_std_XX" respect CMAKE_CXX_STANDARD but require cmake 3.8.2 or greater if you want to specify cxx_std_XX instead of specific language features (e.g. cxx_decltype). I initially assumed that you wanted to stick to cmake 3.2 as to not impose undue requirements on consumers.
I can go ahead and amend my pull request in an hour so if you wish to instead use a compiler feature to set cxx_std_11. Furthermore isn't imgui currently only a C++98 library? Should C++11 be required to consume the imgui target?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that'd be great :)

And I'm not sure of the exact requirement, but at the least we should require c++0x. That's just my opinion though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well doesn't Imgui currently require only C++98 and that's an currently an advertised aspect of Imgui. Furthermore do you want me to bump the minimum Cmake version to 3.8.2?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right:

Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers.

We should be able to remove it altogether, then. It's up to Imgui to make sure compatibility among archaic compilers, not cmake's, since that is a project choice made by the maintainer.

Good catch :)

What would the reasoning for bumping to 3.8.2 be? I'm not opposed per se, it just implies there's a reason for it :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake 3.8.2 is when then cxx_std_XX compiler features were introduced. Prior to that, you could only specify what specific language features you required and CMake would use that to figure out what C++ standard version it needed to use on a given compiler.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, then yes let's bump it and then target cxx_std_98.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Qix-
Copy link
Owner

Qix- commented May 16, 2020

Thanks for doing this. Quick question before I merge (see above).

ivan-kulikov-dev and others added 3 commits May 24, 2020 11:54
update cmake_minimum_required to 3.8.2 and  switched from setting set_target_properties to target_compile_features cxx_std_98
@Qix- Qix- merged commit a324f6e into Qix-:cmake May 28, 2020
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.

3 participants