Why CLion's bundled Cmake Cannot Find the Installed OpenMPI

Hi,

I'm confused why Cmake of CLion cannot find the installed OpenMPI on my MacOS. Actually, I installed ‘open-mpi’ by homebrew. And it can work out in my terminal. However, it can't find MPI-related lib when building. Can someone share me some clues?

====================[ Build | open_test | Debug ]===============================
/Users/wilfried/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake --build /Users/wilfried/CLionProjects/open_test/cmake-build-debug --target open_test -j 6
[0/1] Re-running CMake...
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_WORKS) 
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_WORKS) 
CMake Error at /Users/wilfried/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
 Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
 /Users/wilfried/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
 /Users/wilfried/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.27/Modules/FindMPI.cmake:1837 (find_package_handle_standard_args)
 CMakeLists.txt:6 (find_package)

 

My CMakeLists.txt is like the following:

cmake_minimum_required(VERSION 3.10)
project(open_test)


set(CMAKE_CXX_STANDARD 17)


find_package(MPI REQUIRED)
add_executable(open_test main.cpp open_test.cpp)
target_link_libraries(open_test PRIVATE MPI::MPI_CXX)

 

 

0

Please sign in to leave a comment.