0

I am having difficulty linking a compiled version of libcurl that exists in a different path from the default libcurl that installed as a part of the operating system. Cmake always resorts to using the default libcurl instead of using the version I compiled.

Mark
  • 1
  • You need to override the default `LD_LIBRARY_PATH` to use your custom `libcurl`, see [How to set the environmental variable LD_LIBRARY_PATH in linux](https://stackoverflow.com/questions/13428910/how-to-set-the-environmental-variable-ld-library-path-in-linux). If you are not on Linux, there are similar methods for other OS's. Also see: [shared libraries - How can LD_LIBRARY_PATH be changed within CMake](https://stackoverflow.com/questions/30380257/how-can-ld-library-path-be-changed-within-cmake) – David C. Rankin Jun 14 '18 at 18:55
  • @DavidC.Rankin: Variable *LD_LIBRARY_PATH* affects on loading the library at **runtime**, but the question (as far as I understand it) is about a linking proper library at **build time**. – Tsyvarev Jun 14 '18 at 19:31
  • @Tsyvarev - correct you are. My brain was in the wrong library gear. The library SEARCH path is the one in question, see: [LD_LIBRARY_PATH vs LIBRARY_PATH](https://stackoverflow.com/questions/4250624/ld-library-path-vs-library-path) – David C. Rankin Jun 14 '18 at 19:45
  • @DavidC.Rankin: Variable *LIBRARY_PATH* is used by the linker when search a library **by** its **name**, but it is a rare case in CMake world: usually, a library is search by CMake itself, and linker gets **absolute path** to the library. And I am very unsure that CMake respects *LIBRARY_PATH* when it search a library, see e.g. that question: https://stackoverflow.com/questions/50346194/why-does-cmake-not-respect-library-path-and-cpath/50347407. – Tsyvarev Jun 14 '18 at 20:33

0 Answers0