Thank you.

I have tried to compile my code using that version of CMakeLists, but it 
doesn't work. My program's output is still wrong.

This is completely, utterly wrong!


# 2.7 was a development version, so you should either specify
# 2.6 or 2.8...
cmake_minim_required(VERSION 2.7)
project(ITK_MPI)

find_package(MPI REQUIRED)

include_directories(${MPI_INCLUDE_PATH})

add_executable(hello hello.cpp)
target_link_libraries(hello ${MPI_LIBRARIES})

if(MPI_COMPILE_FLAGS)
  set_target_properties(hello PROPERTIES
    COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
endif()

if(MPI_LINK_FLAGS)
  set_target_properties(hello PROPERTIES
    LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()


You should *NEVER* set CMAKE_<LANG>_COMPILER, this completely breaks
things. Also, with CMake you shouldn't use the compiler wrappers (mpicxx
etc.), because CMake figures out how to compile MPI programs without it.

HTH

Michael
_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to