Yubico/libfido2

import libfido2 in a cmake project using FetchContent (take 2)

ncoder-1 opened this issue · 0 comments

Fixed in 3ab79a9. Thank you for the report!

Originally posted by @martelletto in #512 (comment)

Sorry to reopen this,

The patch works except that for builds with CMAKE_BUILD_TYPE=Debug due to the main CMakeLists.txt trying to build the regress sub_dir which itself will try to build with forced shared libs.

This is the build output (for a Debug build type, other build types work fine):

[1/4] Linking C executable _deps/fido2-build/regress/regress_cred
FAILED: _deps/fido2-build/regress/regress_cred 
: && /usr/bin/clang -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE -std=c99  -Wall -Wextra -pedantic -fsanitize=address -g -g2 -fno-omit-frame-pointer -Wl,-z,noexecstack -Wl,-z,relro,-z,now   -rdynamic  -fPIE -pie _deps/fido2-build/regress/CMakeFiles/regress_cred.dir/cred.c.o -o _deps/fido2-build/regress/regress_cred  -lfido2_shared && :
/usr/bin/ld: cannot find -lfido2_shared
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
[2/4] Linking C executable _deps/fido2-build/regress/regress_assert
FAILED: _deps/fido2-build/regress/regress_assert 
: && /usr/bin/clang -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE -std=c99  -Wall -Wextra -pedantic -fsanitize=address -g -g2 -fno-omit-frame-pointer -Wl,-z,noexecstack -Wl,-z,relro,-z,now   -rdynamic  -fPIE -pie _deps/fido2-build/regress/CMakeFiles/regress_assert.dir/assert.c.o -o _deps/fido2-build/regress/regress_assert  -lfido2_shared && :
/usr/bin/ld: cannot find -lfido2_shared
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
[3/4] Linking C executable _deps/fido2-build/regress/regress_dev
FAILED: _deps/fido2-build/regress/regress_dev 
: && /usr/bin/clang -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE -std=c99  -Wall -Wextra -pedantic -fsanitize=address -g -g2 -fno-omit-frame-pointer -Wl,-z,noexecstack -Wl,-z,relro,-z,now   -rdynamic  -fPIE -pie _deps/fido2-build/regress/CMakeFiles/regress_dev.dir/dev.c.o -o _deps/fido2-build/regress/regress_dev  -lfido2_shared && :
/usr/bin/ld: cannot find -lfido2_shared
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.