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

Nils Gladitz nilsgladitz at gmail.com
Thu Jul 24 05:08:42 EDT 2014


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


More information about the CMake mailing list