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

2014-07-24 Thread Sergey Rykovanov
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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

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

2014-07-24 Thread Nils Gladitz

On 07/24/2014 10:56 AM, Sergey Rykovanov wrote:


|cmake_minimum_required(VERSION2.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}|


include_directories(MPI_INCLUDE_PATH) adds an include directory named 
MPI_INCLUDE_PATH.


You probably meant
include_directories(${MPI_INCLUDE_PATH}) which adds the content of the 
variable MPI_INCLUDE_PATH as include directories.


Might have worked on Linux because the headers were already in standard 
include directories.


Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake