opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

”cmake_minimum_required(VERSION 3.1)“ is inaccurate

Open GskFID opened this issue 2 years ago • 9 comments

There are many places to add tests with ”gtest_add_tests“, But gtest_add_tests is a new feature of Cmake 3.9 version, When I try to compile with 3.8.5, it doesn't compile the test code anyway, this confused me for a while. image

GskFID avatar May 16 '22 12:05 GskFID

Good point. We should -

  • Either not use gtest_add_tests() to add unit tests. (preferably)
  • Or make the minimum required cmake version as 3.9.

lalitb avatar May 16 '22 17:05 lalitb

old cmake compatible example can be found here: https://github.com/open-telemetry/opentelemetry-cpp/blob/521ebd8f51fb27219c8dd581629ec1b93df8b70a/sdk/test/trace/CMakeLists.txt#L1-L30

esigo avatar May 16 '22 18:05 esigo

old cmake compatible example can be found here:

https://github.com/open-telemetry/opentelemetry-cpp/blob/521ebd8f51fb27219c8dd581629ec1b93df8b70a/sdk/test/trace/CMakeLists.txt#L1-L30

This example seems to be using gtest_add_tests at line 21, or am I missing something ?

lalitb avatar May 16 '22 23:05 lalitb

I vote for upgrade the minimum version of cmake.It will be easier to maintain.

owent avatar May 17 '22 02:05 owent

@lalitb sorry I was wrong, we have no example for the old Cmake version. I agree with @owent, I'd vote for upgrading the minimum required cmake.

esigo avatar May 17 '22 15:05 esigo

To see if we can use the gtest_add_tests() function from cmake module: https://github.com/Kitware/CMake/blob/908d2cd136be3165d391c18777890798a18f96c3/Modules/GoogleTest.cmake#L293-L294

lalitb avatar May 18 '22 17:05 lalitb

There are few more cmake constructs in code not supported in cmake v3.1.0:

https://github.com/open-telemetry/opentelemetry-cpp/blob/a847d0ce42209e458f8f98a5751626a33adfad95/CMakeLists.txt#L9

https://github.com/open-telemetry/opentelemetry-cpp/blob/76c664a20b8219b91ead69ded6b7ee873b1a85ba/ext/test/http/CMakeLists.txt#L4

lalitb avatar May 18 '22 22:05 lalitb

There are few more cmake constructs in code not supported in cmake v3.1.0:

https://github.com/open-telemetry/opentelemetry-cpp/blob/a847d0ce42209e458f8f98a5751626a33adfad95/CMakeLists.txt#L9

https://github.com/open-telemetry/opentelemetry-cpp/blob/76c664a20b8219b91ead69ded6b7ee873b1a85ba/ext/test/http/CMakeLists.txt#L4

I think add_compile_definitions(WITH_CURL) can be removed now.

owent avatar May 19 '22 02:05 owent

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Aug 01 '22 02:08 github-actions[bot]