Skip to content

Support pkg-config in ta-lib for CMake Builds - #284

Merged
mario4tier merged 1 commit into
TA-Lib:mainfrom
vikasnkumar:main
Aug 29, 2026
Merged

Support pkg-config in ta-lib for CMake Builds#284
mario4tier merged 1 commit into
TA-Lib:mainfrom
vikasnkumar:main

Conversation

@vikasnkumar

Copy link
Copy Markdown
Contributor

The autoconfbuild supports pkg-config file generation and install, but the CMake build did not. Adding a couple of lines in CMake to support this on UNIX platforms.

@mario4tier
mario4tier merged commit bf86001 into TA-Lib:main Aug 29, 2026
3 checks passed
mario4tier added a commit that referenced this pull request Aug 29, 2026
#77 made libta-lib.so self-declare its libm dependency (DT_NEEDED), so a
dynamic consumer needs nothing extra. #284's Libs: -lm reintroduced that
requirement for every consumer. The real gap was that CMake's
configure_file has no LIBM variable, so @libm@ in Libs.private silently
substituted to empty -- unlike autotools, which fills it via AC_SUBST.
Give CMake its own LIBM value (mirroring the existing if(NOT WIN32) idiom
already used to link the target itself) and revert Libs: to match
autotools' output.

Claude-Session: https://claude.ai/code/session_01W8PVxowPALanc3wk8jaD6h
@mario4tier

Copy link
Copy Markdown
Member

Merged, thanks! Followed up with 8cf0839 on one detail in ta-lib.pc.in.

The added Libs: ... -lm wasn't quite right: since #77, libta-lib.so already self-declares its libm dependency (DT_NEEDED libm.so.6), so a dynamic consumer needs nothing extra — that's what Libs.private: is for (only pulled in for static linking via pkg-config --static). The actual gap was that Libs.private: @LIBM@ relies on autoconf's AC_SUBST([LIBM]), which CMake's configure_file has no equivalent for, so @LIBM@ was silently substituting to empty on the CMake path.

Follow-up gives CMake its own LIBM value (same if(NOT WIN32) idiom already used to link the target) and feeds that into Libs.private instead, so Libs: stays clean and matches autotools' output:

Libs: -L${libdir} -lta-lib
Libs.private: -lm

Verified with an actual CMake configure+build that the .so still carries DT_NEEDED libm.so.6 and the generated .pc now matches the above.

@vikasnkumar

Copy link
Copy Markdown
Contributor Author

Thank you !

mario4tier added a commit that referenced this pull request Aug 29, 2026
#284's CMakeLists.txt/ta-lib.pc.in changes landed on main and were just
merged into dev; refresh the digest to match.
mario4tier added a commit that referenced this pull request Aug 29, 2026
#284 added ta-lib.pc.in and wired it into CMakeLists.txt's
configure_file, but conanfile.py's exports_sources never picked it up --
Conan only copies files it lists into its build sandbox, so
configure_file failed with "File ... ta-lib.pc.in does not exist."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants