Skip to content

Do not use gcrypt cmake variables if gcrypt is not found - #2403

Merged
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
Tropicao:openscap-without-crypto
Sep 7, 2026
Merged

Do not use gcrypt cmake variables if gcrypt is not found#2403
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
Tropicao:openscap-without-crypto

Conversation

@Tropicao

Copy link
Copy Markdown
Contributor

Commit d12d820 ("Fix build without crypto support") enabled building the crapi library without a crypto backend, but left the target_include_directories and target_compile_definitions calls unguarded. When no crypto library is available, the GCrypt find module leaves GCRYPT_INCLUDE_DIRS unset, so CMake fails at the generate step with:

CMake Error: The following variables are used in this project, but
they are set to NOTFOUND: GCRYPT_INCLUDE_DIR

The test command provided at this time made the build successful because it provided -DCMAKE_DISABLE_FIND_PACKAGE_GCrypt=TRUE, but if no crypto backend is provided, it does not make sense to provide those cmake configuration options preventing dependency search manually.

Guard both calls with a CRYPTO_FOUND check so they are only applied when an actual digest backend is present, even without providing -DCMAKE_DISABLE_FIND_PACKAGE_foo

@Tropicao

Copy link
Copy Markdown
Contributor Author

The failed jobs do not look related to the proposed change. I guess those are parts of what #2391 is aiming to fix ?

@Tropicao
Tropicao force-pushed the openscap-without-crypto branch 2 times, most recently from 2fbfec3 to c367661 Compare September 7, 2026 06:21
Commit d12d820 ("Fix build without crypto support") enabled
building the crapi library without a crypto backend, but left the
target_include_directories and target_compile_definitions calls
unguarded. When no crypto library is available, the GCrypt find module
leaves GCRYPT_INCLUDE_DIRS unset, so CMake fails at the generate step
with:

  CMake Error: The following variables are used in this project, but
  they are set to NOTFOUND: GCRYPT_INCLUDE_DIR

The test command provided at this time made the build successful because
it provided -DCMAKE_DISABLE_FIND_PACKAGE_GCrypt=TRUE, but if no crypto
backend is provided, it does not make sense to provide those cmake
configuration options preventing dependency search manually.

Guard both calls with a CRYPTO_FOUND check so they are only applied when
an actual digest backend is present, even without providing
-DCMAKE_DISABLE_FIND_PACKAGE_foo

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
@Tropicao
Tropicao force-pushed the openscap-without-crypto branch from c367661 to 5b858d1 Compare September 7, 2026 06:22
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@jan-cerny jan-cerny self-assigned this Sep 7, 2026
@jan-cerny jan-cerny added this to the 1.4.5 milestone Sep 7, 2026
@jan-cerny
jan-cerny merged commit c57b7f9 into OpenSCAP:main Sep 7, 2026
20 of 21 checks passed
@Tropicao

Tropicao commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @jan-cerny, I was actually about to ask for guidance about the remaining failure, as I suspect it to be completely unrelated, but you merged while I was typing my question, so... thanks :)

@Tropicao
Tropicao deleted the openscap-without-crypto branch September 7, 2026 07:04
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