Skip to content

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

Open
Tropicao wants to merge 1 commit into
OpenSCAP:mainfrom
Tropicao:openscap-without-crypto
Open

Do not use gcrypt cmake variables if gcrypt is not found#2403
Tropicao wants to merge 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

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>
@sonarqubecloud

Copy link
Copy Markdown

@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 ?

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.

1 participant