Skip to content
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

[BUILD] CMake calls find_package(CURL) in multiple places #1913

Closed
marcalff opened this issue Jan 10, 2023 · 1 comment · Fixed by #1916
Closed

[BUILD] CMake calls find_package(CURL) in multiple places #1913

marcalff opened this issue Jan 10, 2023 · 1 comment · Fixed by #1916
Assignees
Labels
bug Something isn't working

Comments

@marcalff
Copy link
Member

Per the CMake makefiles:

./examples/http/CMakeLists.txt:find_package(CURL)
./exporters/otlp/CMakeLists.txt:  find_package(CURL REQUIRED)
./exporters/zipkin/CMakeLists.txt:find_package(CURL REQUIRED)
./ext/src/http/client/curl/CMakeLists.txt:find_package(CURL)
./ext/test/http/CMakeLists.txt:find_package(CURL)
./ext/test/w3c_tracecontext_test/CMakeLists.txt:find_package(CURL)
./CMakeLists.txt:    find_package(CURL)

CMake should not call find_package(CURL) so many times from nested directories.

Beside, the current logic is questionable:

find_package(CURL)
if(NOT CURL_FOUND)
  message(WARNING "Skipping example_w3c_tracecontext_test: CURL not found")
else()

If CURL is not found and BUILD_W3CTRACECONTEXT_TEST is set, the build should fail, not pass and do nothing.

Instead:

  • Evaluate once IF CURL is needed, similar to USE_NLOHMANN_JSON
  • Call find_package(CURL) once from the top level CMakeLists.txt
  • Assume CURL_FOUND and related variables are already evaluated, in sub directories.

Implementing this cleanup will help to add the CURL dependency from different sources (git submodule, external project, alternate location).

@marcalff marcalff added the bug Something isn't working label Jan 10, 2023
@marcalff marcalff self-assigned this Jan 10, 2023
@lalitb
Copy link
Member

lalitb commented Jan 10, 2023

Thanks, agree CURL checks can be much simplified. Later, once #1145 and #1146 are implemented, with native HTTP client libraries used for Windows and Mac, CURL can be made mandatory only for POSIX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants