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

Cannot open include file: 'tommath.h' #681

Open
naushadck opened this issue Jan 28, 2025 · 4 comments
Open

Cannot open include file: 'tommath.h' #681

naushadck opened this issue Jan 28, 2025 · 4 comments

Comments

@naushadck
Copy link

naushadck commented Jan 28, 2025

Hello,

Unable to build. It throws the following error.

Error C1083 Cannot open include file: 'tommath.h': No such file or directory libtomcrypt

cmake build error

Could not find a package configuration file provided by "libtommath"
(requested version 1.2.0) with any of the following names:

libtommathConfig.cmake
libtommath-config.cmake
@sjaeckel
Copy link
Member

If you want to use libtommath, you have to have it available on the system you're building libtomcrypt.

Either install libtommath via your package manager or you could also clone the libtommath repository and build it via CMake, which will in turn add that build to your local CMake registry.

@levitte
Copy link
Collaborator

levitte commented Jan 30, 2025

Note that the package managers probably don't build using CMake (I know for a fact that the Debian package doesn't), which means that you won't get libtommathConfig.cmake with it. It's appropriate to fall back to using pkg-config.

I've a package that does exactly this for libtomcrypt:

find_package(libtomcrypt QUIET)
if (libtomcrypt_FOUND)
  set(LIBTOMCRYPT libtomcrypt)
else()
  find_package(PkgConfig)
  pkg_check_modules(libtomcrypt REQUIRED IMPORTED_TARGET libtomcrypt)
  set(LIBTOMCRYPT PkgConfig::libtomcrypt)
endif()

@sjaeckel
Copy link
Member

find_package(libtomcrypt QUIET)
if (libtomcrypt_FOUND)
set(LIBTOMCRYPT libtomcrypt)
else()
find_package(PkgConfig)
pkg_check_modules(libtomcrypt REQUIRED IMPORTED_TARGET libtomcrypt)
set(LIBTOMCRYPT PkgConfig::libtomcrypt)
endif()

Would it maybe make sense to have this snippet somewhere available?

@levitte
Copy link
Collaborator

levitte commented Feb 1, 2025

Perhaps. Not sure where, though... Application writer documentation or something like that?

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

No branches or pull requests

3 participants