[CMake] Make works on linux, not on Mac Os X Mavericks, openmpi

Sergey Rykovanov serge.rykovanov at gmail.com
Thu Jul 24 04:56:01 EDT 2014


Hi,

I have a very simple "Hello world" program that compiles with mpic++. I
also have the following CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8)

project(Hello_world)

add_executable(hello.e main.cpp)
# Require MPI for this project:
find_package(MPI REQUIRED)
include_directories(MPI_INCLUDE_PATH)set(CMAKE_CXX_COMPILE_FLAGS
${CMAKE_CXX_COMPILE_FLAGS}
${MPI_COMPILE_FLAGS})set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS}
${MPI_LINK_FLAGS})
target_link_libraries(hello.e ${MPI_LIBRARIES}

This cmake file works perfectly on Linux, but not on Mac OS X Mavericks. On
Mavericks I get: "mpi.h not found" error.

Here is the output of cmake . showing that it found the openmpi:

-- The C compiler identification is AppleClang 5.1.0.5030040-- The CXX
compiler identification is AppleClang 5.1.0.5030040-- Check for
working C compiler: /usr/bin/cc-- Check for working C compiler:
/usr/bin/cc -- works-- Detecting C compiler ABI info-- Detecting C
compiler ABI info - done-- Check for working CXX compiler:
/usr/bin/c++-- Check for working CXX compiler: /usr/bin/c++ -- works--
Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info -
done-- Found MPI_C: /opt/local/lib/openmpi-devel-mp/libmpi.dylib  --
Found MPI_CXX: /opt/local/lib/openmpi-devel-mp/libmpi.dylib  --
Configuring done-- Generating done-- Build files have been written to:
/Users/sleepyhead/work/MPI_TEST

What am I doing wrong?


Cheers,
Sergey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140724/76fa2bc7/attachment.html>


More information about the CMake mailing list