diff --git a/src/jsontestrunner/CMakeLists.txt b/src/jsontestrunner/CMakeLists.txt index 39c6f4871..210e0900b 100644 --- a/src/jsontestrunner/CMakeLists.txt +++ b/src/jsontestrunner/CMakeLists.txt @@ -1,4 +1,13 @@ -find_package(PythonInterp 2.6) +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0) + # The new Python3 module is much more robust than the previous PythonInterp + find_package (Python3 COMPONENTS Interpreter) + # Set variables for backwards compatibility with cmake < 3.12.0 + set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND}) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) +else() + set(Python_ADDITIONAL_VERSIONS 3.8) + find_package(PythonInterp 3) +endif() add_executable(jsontestrunner_exe main.cpp diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp index 1d636d8a0..ad34c8ae9 100644 --- a/src/test_lib_json/main.cpp +++ b/src/test_lib_json/main.cpp @@ -350,7 +350,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, arrayInsertAtRandomIndex) { JSONTEST_ASSERT_EQUAL(Json::Value("index1"), array[2]); JSONTEST_ASSERT_EQUAL(Json::Value("index2"), array[3]); // checking address - for (int i = 0; i < 3; i++) { + for (Json::ArrayIndex i = 0; i < 3; i++) { JSONTEST_ASSERT_EQUAL(vec[i], &array[i]); } vec.push_back(&array[3]); @@ -362,7 +362,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, arrayInsertAtRandomIndex) { JSONTEST_ASSERT_EQUAL(Json::Value("index1"), array[3]); JSONTEST_ASSERT_EQUAL(Json::Value("index2"), array[4]); // checking address - for (int i = 0; i < 4; i++) { + for (Json::ArrayIndex i = 0; i < 4; i++) { JSONTEST_ASSERT_EQUAL(vec[i], &array[i]); } vec.push_back(&array[4]); @@ -376,7 +376,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, arrayInsertAtRandomIndex) { JSONTEST_ASSERT_EQUAL(Json::Value("index2"), array[4]); JSONTEST_ASSERT_EQUAL(Json::Value("index5"), array[5]); // checking address - for (int i = 0; i < 5; i++) { + for (Json::ArrayIndex i = 0; i < 5; i++) { JSONTEST_ASSERT_EQUAL(vec[i], &array[i]); } vec.push_back(&array[5]); @@ -2234,7 +2234,6 @@ JSONTEST_FIXTURE_LOCAL(StyledStreamWriterTest, writeNestedObjects) { } JSONTEST_FIXTURE_LOCAL(StyledStreamWriterTest, multiLineArray) { - Json::StyledStreamWriter writer; { // Array member has more than 20 print effect rendering lines const Json::String expected("[\n\t0," @@ -2268,6 +2267,7 @@ JSONTEST_FIXTURE_LOCAL(StyledStreamWriterTest, multiLineArray) { JSONTEST_ASSERT_STRING_EQUAL(expected, result); } { + Json::StyledStreamWriter writer; // Array members do not exceed 21 print effects to render a single line const Json::String expected("[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]\n"); Json::Value root;