Hi, cmake users<br><br>I tried to use cmake to create the makefile , but I failed to make when Linking CXX executable read_send_write,<br>there are many references undefined. it seems that the program haven't<br>
found the libraries. maybe I don't have the right configuration of cmake.<br>
The cmake configuration is attached. could you give me some suggestion?<br>
<br>I began to use cmake about one month ago and don't know the meanings of settings in cmake exactly.<br>Could you give me some suggestions?<br>some information are as follows:<br><br>the end of error reported are as follows,<br>
CMakeFiles/read_send_write.<div id=":12b" class="ii gt">dir/read_send_write.o(.gnu.linkonce.t._ZN4PMPI10Errhandler4FreeEv+0x11):<br>
In function `PMPI::Errhandler::Free()':<br>
: undefined reference to `MPI_Errhandler_free'<br>
collect2: ld returned 1 exit status<br>
make[2]: *** [read_send_write] Error 1<br>
make[1]: *** [CMakeFiles/read_send_write.dir/all] Error 2<br>
make: *** [all] Error 2<br>
usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...<br><br><br><br><br>my CMakeLists.txt, downloaded from <a href="http://crab-lab.zool.ohiou.edu/kevin/ITK_MPI/">http://crab-lab.zool.ohiou.edu/kevin/ITK_MPI/</a> :<br>
cmake_minimum_required(VERSION 2.4)<br><br>project( ITK_MPI )<br><br>#include_directories( /usr/include/openmpi/1.2.4-gcc )<br>include_directories( /opt/openmpi/install/include/openmpi/ )<br><br>find_package ( ITK )<br>if ( ITK_FOUND )<br>
include( ${USE_ITK_FILE} )<br>endif( ITK_FOUND )<br><br>find_package ( MPI )<br>if ( MPI_FOUND )<br> include_directories( ${MPI_INCLUDE_PATH} )<br>endif( MPI_FOUND )<br><br>add_executable( pieces pieces.cxx )<br>
target_link_libraries( pieces ITKCommon)<br><br>add_executable( read_split_write read_split_write.cxx )<br>target_link_libraries( read_split_write ${MPI_LIBRARIES}<br> ITKIO ITKCommon )<br><br>add_executable( read_send_write read_send_write.cxx )<br>
target_link_libraries( read_send_write ${MPI_LIBRARIES}<br> ITKIO ITKCommon )<br><br>add_executable( read_split_paste_write read_split_paste_write.cxx )<br>target_link_libraries( read_split_paste_write ITKIO ITKCommon )<br>
<br>add_executable( read_split_send_paste_write read_split_send_paste_write.cxx )<br>add_executable( read_split_send_paste_write read_split_send_paste_write.cxx )<br>target_link_libraries( read_split_send_paste_write ${MPI_LIBRARIES}<br>
ITKIO ITKCommon )<br><br><br>the configuration of cmake.<br><br> CMAKE_AR /usr/bin/ar <br> CMAKE_BACKWARDS_COMPATIBILITY 2.4 <br>
CMAKE_BUILD_TYPE <br> CMAKE_COLOR_MAKEFILE ON <br> CMAKE_CXX_COMPILER /opt/openmpi/install/bin/mpicxx <br>
CMAKE_CXX_FLAGS <br> CMAKE_CXX_FLAGS_DEBUG -g <br> CMAKE_CXX_FLAGS_MINSIZEREL -Os -DNDEBUG <br>
CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG <br> CMAKE_CXX_FLAGS_RELWITHDEBINFO -O2 -g <br> CMAKE_C_COMPILER /opt/openmpi/install/bin/mpicc <br>
CMAKE_C_FLAGS <br> CMAKE_C_FLAGS_DEBUG -g <br> CMAKE_C_FLAGS_MINSIZEREL -Os -DNDEBUG <br>
CMAKE_C_FLAGS_RELEASE -O3 -DNDEBUG <br> CMAKE_C_FLAGS_RELWITHDEBINFO -O2 -g <br> CMAKE_EXE_LINKER_FLAGS <br>
CMAKE_EXE_LINKER_FLAGS_DEBUG <br> CMAKE_EXE_LINKER_FLAGS_MINSIZE <br> CMAKE_EXE_LINKER_FLAGS_RELEASE <br>
CMAKE_EXE_LINKER_FLAGS_RELWITH <br> CMAKE_INSTALL_PREFIX /opt/openmpi/install <br> CMAKE_MAKE_PROGRAM /usr/bin/gmake <br>
CMAKE_MODULE_LINKER_FLAGS <br> CMAKE_MODULE_LINKER_FLAGS_DEBU <br> CMAKE_MODULE_LINKER_FLAGS_MINS <br>
CMAKE_MODULE_LINKER_FLAGS_RELE <br> CMAKE_MODULE_LINKER_FLAGS_RELW <br> CMAKE_RANLIB /usr/bin/ranlib <br>
CMAKE_SHARED_LINKER_FLAGS <br> CMAKE_SHARED_LINKER_FLAGS_DEBU <br> CMAKE_SHARED_LINKER_FLAGS_MINS <br>
CMAKE_SHARED_LINKER_FLAGS_RELE <br> CMAKE_SHARED_LINKER_FLAGS_RELW <br> CMAKE_SKIP_RPATH OFF <br>
CMAKE_USE_RELATIVE_PATHS OFF <br> CMAKE_VERBOSE_MAKEFILE OFF <br> EXECUTABLE_OUTPUT_PATH <br>
ITK_DIR /opt/itk/bin <br> LIBRARY_OUTPUT_PATH <br> MPI_EXTRA_LIBRARY /opt/openmpi/install/lib/libmpi_cxx.so.0 <br>
MPI_INCLUDE_PATH /opt/openmpi/install/include/ <br> MPI_LIBRARY /opt/openmpi/install/lib/<a href="http://libmpi_cxx.la">libmpi_cxx.la</a> <br><br><br><br></div>