Commit Graph

111 Commits

Author SHA1 Message Date
Mykola
69098a18b9
Avoid using cmake glob vars if we are a subproject (#1459)
If jsoncpp is a subproject (like a git submodule), setting the
global cmake variables affect the entire project (changes the
structure of the output folders) and these changes prevent it.
2023-06-27 10:42:38 -04:00
luzpaz
a1f1613bdd
Fix various typos (#1350)
Found via `codespell -q 3 -L alue,alse`

Co-authored-by: Christopher Dunn <cdunn2001@gmail.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
2021-12-14 18:04:47 -08:00
Christopher Dunn
c4904b2c0d Bump micro version 2021-11-03 11:39:54 -05:00
SpaceIm
5fabc5e6d2
conversion errors only if warnings as errors enabled (#1284) 2021-05-05 20:55:25 -05:00
Sergey Rachev
993e4e2828 - isolated namespace targets into separate file 2021-05-04 23:34:28 -05:00
Sergey Rachev
a3914b792f - narrowed lines to be aligned with overall file line width 2021-05-04 23:34:28 -05:00
Sergey Rachev
b640795571 - exported targets go to separate generated file and package config file generated from template to use automatic package resolving and resolution logic
CMake  provides helpers to generate config file. Generated config file has usefull macro check_required_components() to set necessary variables like PackageName_FOUND if requirements has been satisfied. An absence of dedicated config file confuses user project as necessary variables are not set.
2021-05-04 23:34:28 -05:00
Yixing Lao
da9e17d257 allow selection of Windows MSVC runtime 2021-02-03 14:29:20 -06:00
Hans Johnson
8954092f0a
ENH: Prevent cmake in source builds (#1091)
* ENH: Prevent cmake in source builds

Building directly inside the root of the source tree
can cause problems where the build intermediate files
overwrite or conflict with the intended source code
files.

This modification identifies this problem and
issues failure messages and suggestions to over
come the problem with more robust build suggestion.

Co-authored-by: Jordan Bayles <jophba@chromium.org>
2020-11-06 13:35:51 -08:00
Jordan Bayles
9059f5cad0
Roll version numbers for 1.9.4 release (#1223) 2020-09-25 19:19:16 -07:00
Ben Wolsieffer
5be07bdc5e
Fix generation of pkg-config file with absolute includedir/libdir. (#1199) 2020-07-20 20:36:30 +08:00
Chen
cfc1ad72ad
Enhance cmake script (#1197)
* BUILD_TYPE corresponds to Release/Debug
   but LIB_TYPE corresponds to shared/static.

* Add support to build shared, static and object lib at the same time.
2020-07-13 20:33:58 +08:00
Chen
8b7ea09b80
Bump soversion to 24 (#1167) 2020-04-30 17:58:07 +08:00
xkszltl
a4fb5db543
Put ".exe" and ".dll" together to make test usable in build dir. (#1166) 2020-04-30 10:31:54 +08:00
Joel Johnson
524234e479 Use non-version checked add_compile_options
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.
2020-04-28 15:21:16 -06:00
Joel Johnson
12ceb01485 Always use consistent CXX_STANDARD
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.
2020-04-28 15:21:16 -06:00
Joel Johnson
edc6239f39 Not needed to specify CMAKE_MACOSX_RPATH
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.
2020-04-28 15:21:16 -06:00
Joel Johnson
5a0152ae1b Only set CMAKE_BUILD_TYPE for single config generators 2020-04-28 15:21:16 -06:00
Joel Johnson
a3afd74b80 Don't use unique variable for postfix
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.
2020-04-28 15:21:16 -06:00
Claus Klein
a6fe8e27d8
Use ccache right (#1139)
* Prevent cmakelint warnings

Use 4 spaces for indent, no tabs

* Use ccache right

fix indents too at CMakeLists.txt
2020-02-13 13:20:46 -08:00
David Seifert
6bc55ec35d Meson updates (#1124)
* Modernize meson.build

* Make tests optional
* Use `files()` for quick sanity checks

* Bump version to 1.9.3

* Bump SOVERSION, as some functions were removed
  and structs were changed, as determined by
  libabigail.
2020-01-07 09:23:50 +08:00
theirix
7e5485ab5b Add option JSONCPP_WITH_EXAMPLE (#1099)
* Add option JSONCPP_WITH_EXAMPLE

Allows to conditionally build examples as
it has been done for tests.  Useful for packaging.

* Do not build example by default
2019-12-23 11:04:44 +08:00
Hans Johnson
aebc7faa4f BUG: New CMake features used that break backward compatibility
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
2019-10-17 11:11:34 -05:00
dota17
e9ccbe0145 Create an example directory and add some code examples. (#944)
* update example directory

* modify some compile error.

* update with clang-format

* update

* update

* add_definitions("../include/json")

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Wed Jul 10 21:26:16 2019 +0800
#
# On branch code_example
# Your branch is up-to-date with 'origin/code_example'.
#
# Changes to be committed:
#	modified:   example/CMakeLists.txt
#

* change CMakeLists.txt

* update streamWrite.cpp

* update

* Update readFromStream.cpp

* fix typo
2019-09-17 13:30:00 -07:00
Jordan Bayles
7b28698c5c
Cleanup versioning strategy relanding (#989) (#997)
* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
2019-08-13 22:41:43 -07:00
Jordan Bayles
0d27381acf
Revert "Cleanup versioning strategy (#989)" (#996)
This reverts commit 12325b814f.
2019-07-31 11:26:48 -07:00
Jordan Bayles
12325b814f
Cleanup versioning strategy (#989)
* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
2019-07-22 15:25:23 -07:00
Jordan Bayles
f8db40ff83 Update minimum CMake version requirement 2019-06-28 10:24:50 -07:00
Jordan Bayles
2a3ae0e79f
Merge pull request #932 from oleurodecision/cmake_clean
cmake cleanup
2019-06-25 13:59:46 -07:00
Olivier LIESS
8d2095af3c cmake fixes 2019-06-03 12:45:24 +02:00
Olivier LIESS
0155f38b5b added cmake config version file for proper cmake delivery 2019-06-03 12:39:50 +02:00
Frank Richter
69402d1fbb Bump minor version, SOVERSION 2019-03-23 21:03:30 +01:00
Hans Johnson
2c257590a1 BUG: VERSION_LESS_EQUAL introduced in cmake 3.7
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
2019-01-18 07:00:39 -06:00
Hans Johnson
deb6cca214 STYLE: FATAL_ERROR ignored in cmake_required_minimum since 2.6.0 2019-01-18 07:00:39 -06:00
Hans Johnson
a3c8e86c0b ENH: Refactor and enhance the CI testing infrastructure
1) Improve travis build script for use outside travis.
   Allow the script used for CI builds to also be used
   locally in a similar manner to the CI use of the scrips

2) Add ctest compatible testing and CDASH support
   Report testing and building results to
   https://my.cdash.org/index.php?project=jsoncpp

   NOTE: The new ctest infrastructure is not yet robust on winodws
         Do no yet enable the new features for running test with ctest
         on windows platform.  The previous behaviors are maintainted,
         but enhance test reporting from windows is not yet supported.

3) Add a cmake coverage testing option
   Ensure that cmake builds on linux are tested.
   Ensure that code coverage is reported.

4) Move conditional environment checking into the matrix
   Avoid multiple places where conditional logic is used to
   change compiler behavior.  As more test environments are
   created fromt the travis.yml matrix, all settings should be
   obvious from that one location.

5) Tests with known regressions from the jsonchecker are suppressed
    Tests that are known to pass with jsoncpp more lenient
    syntax enforcement are exluded from tests in test/runjsontests.py
2019-01-14 16:12:43 -06:00
Hans Johnson
b3b92df879 ENH: Provide range for non-warned cmake versions
Allow configuring without cmake policy developer warnings
for a range of cmake versions.

This prevents the need to explicitly enumerate every new
policy for each new cmake version.

===

Moved setting of the CMAKE_CXX_STANDARD to before the project()
directive.
2018-12-30 15:32:57 -06:00
Hans Johnson
892a386018 ENH: Use cmake builtin versioning capabilities
The project directive in cmake 3.1 has a builtin
mechanism for providing consistent versioning
in a package.
2018-12-30 15:32:57 -06:00
Hans Johnson
0417e626c0 STYLE: Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command names
became case-insensitive.  Now the preferred style is lower-case.
2018-12-30 15:32:57 -06:00
Julien Schueller
d501fbe741 Set CMAKE_BUILD_TYPE default on win32 too 2018-12-02 18:37:11 -06:00
Julien Schueller
a72266d00b Remove useless BUILD_STATIC_LIBS option 2018-12-02 18:37:11 -06:00
Tomáš Malý
323450eafc allow out-of-source build 2018-04-17 16:16:54 +02:00
Louis Dionne
ffc62d26f3 [CMake] Generate CMake config files by default 2018-04-05 16:37:58 -07:00
Christopher Dunn
ddabf50f72 1.8.4; soversion=20 2017-12-20 15:07:10 -06:00
Christopher Dunn
c98e1d85e3 Bump to soversion=19, 1.8.3
Note that cmake is deprecated, but we keep it in-sync manually for now.
2017-08-28 09:04:33 -05:00
Christopher Dunn
13b5ed7287 1.8.2 <- 1.8.1
Soon, I hope to drop the cmake stuff and let meson handle
the version numbers.
2017-08-27 15:02:01 -05:00
Christopher Dunn
a679dde58d 1.8.1 2017-06-25 22:01:22 -07:00
Gaurav
c68443f3a0 Fix Cmake build issue
FIx cmake build.
2017-03-10 10:33:03 +05:30
Gaurav
11c48d0047 Fix warning issue with gcc flags.
PR for - https://github.com/open-source-parsers/jsoncpp/issues/586
Separating the default options for compiler flags.
2017-03-10 10:22:33 +05:30
Christopher Dunn
f700fe4559 Require cmake>=3.1
Plus some other build-related changes. I don't think there is anything
functionally different from 1.7.7, or even any binary incompatibilities, but
the cmake change is significant.
2016-12-14 13:39:05 -06:00
David Seifert
f3a4941590
Replace current install variables with GNUInstallDirs
* The GNUInstallDirs module is more idiomatic and supported by
  Kitware upstream, whereas the current directories are not
  standardised across CMake-using packages. Using CMake native
  mechanisms is better than reinventing the wheel, as it makes
  using the build system more uniform across the ecosystem
* Use CMAKE_CXX_STANDARD to force C++11
* Require CMake 3.1.0 at a minimum
* Fixed lower/UPPERcase format for function/macro calls
* Fixed indents by replacing tabs with 4 spaces
2016-12-14 17:53:10 +01:00