Skip to content

Improve CMake correctness and handling #1165

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

Merged
merged 11 commits into from
Apr 29, 2020

Conversation

mrjoel
Copy link
Contributor

@mrjoel mrjoel commented Apr 29, 2020

Update the CMake processing to improve interoperability with being included as CMake from a larger project using jsoncpp.

This is a follow-on replacement to #1143

mrjoel added 11 commits April 28, 2020 15:21
The more general CMake way to handle library suffixing is to set
CMAKE_<CONFIG>_POSTFIX, so setting the Debug output suffix name should
be more correctly done by the caller or CMake configurer by setting
the desired value in CMAKE_DEBUG_POSTFIX.
As of CMake 3.0 with CMP0042, MACOSX_RPATH is enabled by default.
Since the validated version used by jsoncpp is later than 3.0,
this is already covered.
Since CMake has subdirectory variable scope, unilaterally set the
CMAKE_CXX_STANDARD variable to use C++11. This covers cases with the
library being included externally, both in cases of only C++98 being
specified, as well as later versions being specified (since the
CXX_STANDARD itself isn't a library dependency, only the PUBLIC
target_compile_features on jsoncpp_lib). The previous direct check for
C++98 is handled by requiring C++11 on this library; should the
compiler being used not support C++11 then CMake will issue an error.
Since the introduction of CMAKE_COMPILER_IS_GNUCXX CMake has
suggested using CMAKE_CXX_COMPILER_ID for more general checks.
EXTRA_CXX_FLAGS is never defined, making this a noop. Further,
COMPILE_OPTIONS is invalid to set as a DIRECTORY property.
Commit aebc7fa added version checks for CMake compatibility. In reality,
only the add_compile_definitions need the check - add_compile_options
itself has been supported since 3.0. Tested and confirmed built
successfully with CMake 3.8.0.
This is already covered by the toplevel CMake, which also serves to
provide a consistent minimum version.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 93.881% when pulling e9b0b96 on mrjoel:mrjoel/cmake-updates into 2cb16b3 on open-source-parsers:master.

@cdunn2001 cdunn2001 merged commit d517d59 into open-source-parsers:master Apr 29, 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