This issue is a result of a Codex global repository scan.
The non-MPI branch in FindMKL.cmake calls find_package_handle_standard_args(MKL MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_INCLUDE) without DEFAULT_MSG. With CMake's signature, the second argument is treated as the custom failure message, not as a required variable. As a result, MKL_INTERFACE_LIB can be omitted from the required variable list and MKL_FOUND can be set even when the interface library was not found.
|
include(FindPackageHandleStandardArgs) |
|
# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE |
|
# if all listed variables are TRUE |
|
|
|
if(ENABLE_MPI) |
|
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_SCALAPACK MKL_BLACS MKL_INCLUDE) |
|
else() |
|
find_package_handle_standard_args(MKL MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_INCLUDE) |
|
endif() |
Relevant code:
if(ENABLE_MPI)
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_SCALAPACK MKL_BLACS MKL_INCLUDE)
else()
find_package_handle_standard_args(MKL MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_INCLUDE)
endif()
Suggested fix:
Use the same signature in both branches:
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_INCLUDE)
This ensures MKL_INTERFACE_LIB is actually required before imported targets are created.
This issue is a result of a Codex global repository scan.
The non-MPI branch in
FindMKL.cmakecallsfind_package_handle_standard_args(MKL MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_INCLUDE)withoutDEFAULT_MSG. With CMake's signature, the second argument is treated as the custom failure message, not as a required variable. As a result,MKL_INTERFACE_LIBcan be omitted from the required variable list andMKL_FOUNDcan be set even when the interface library was not found.abacus-develop/cmake/FindMKL.cmake
Lines 39 to 47 in 84ca04b
Relevant code:
Suggested fix:
Use the same signature in both branches:
This ensures
MKL_INTERFACE_LIBis actually required before imported targets are created.