opentelemetry-cpp
opentelemetry-cpp copied to clipboard
”cmake_minimum_required(VERSION 3.1)“ is inaccurate
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.
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.
old cmake compatible example can be found here:
https://github.com/open-telemetry/opentelemetry-cpp/blob/521ebd8f51fb27219c8dd581629ec1b93df8b70a/sdk/test/trace/CMakeLists.txt#L1-L30
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 ?
I vote for upgrade the minimum version of cmake.It will be easier to maintain.
@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.
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
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
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.
This issue was marked as stale due to lack of activity.