cmake: Fix linking error when project_options is unavailable
When the SDK is used in another project, `project_options` is not
fetched or added by the SDK and results in the following error when
linking executables:
Fatal error: L3900U: Unrecognized option '-lproject_options'
This is a linker error rather than a CMake error, because when no CMake
target exists for a named library, CMake assumes this library to be in
the linker's search path and adds a link flag.
To fix this, link `project_options` and `project_warnings` only when the
SDK is the top-level project. This fix is needed for libraries only, and
examples and tests are not affected because they are not built when the
SDK is used inside another project.
Signed-off-by:
Lingkai Dong <lingkai.dong@arm.com>
Loading
Please register or sign in to comment