[CMake] How to force cmake to only look for C MPI not C++

Bibrak Qamar bibrakc at gmail.com
Tue Mar 18 02:34:58 EDT 2014


Thanks for the help.

I did that but still the error persists.

The C compiler identification is GNU
-- Check for working C compiler:
/export/home/bibrak/MPJExpress_Project/work/programs/installs/bin/gcc
-- Check for working C compiler:
/export/home/bibrak/MPJExpress_Project/work/programs/installs/bin/gcc --
works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found MPI:
/export/home/bibrak/MPJExpress_Project/work/programs/mpich3_installed/lib/libmpichcxx.so
-- Configuring done
-- Generating done


It finds *libmpichcxx.so* furthermore when I issue the make command it
throws the error that mpi.h not found.

Here is one of the entry in the depend.make file

CMakeFiles/nativempjdev.dir/mpjdev_natmpjdev_Comm.c.o:
../mpjdev_natmpjdev_Comm.c
CMakeFiles/nativempjdev.dir/mpjdev_natmpjdev_Comm.c.o:
../mpjdev_natmpjdev_Comm.h
CMakeFiles/nativempjdev.dir/mpjdev_natmpjdev_Comm.c.o:
../mpjdev_natmpjdev_shared.h
CMakeFiles/nativempjdev.dir/mpjdev_natmpjdev_Comm.c.o:
/usr/java/latest/include/jni.h
CMakeFiles/nativempjdev.dir/mpjdev_natmpjdev_Comm.c.o:
/usr/java/latest/include/linux/jni_md.h

Some how can't add *mpi.h *

Does it mean this is not populated correctly ?* ${MPI_C_INCLUDE_PATH}*





Bibrak Qamar



On Tue, Mar 18, 2014 at 11:22 AM, Bruce Cartland
<bruce.cartland at pobox.com>wrote:

>  Try the project command
>
> * project(yourProjectName C)
>
> It's what I use.
>
> Quick Google found this
>
> * http://www.cmake.org/cmake/help/cmake2.6docs.html#command:project
>
>
>
> On 18/03/14 17:09, Bibrak Qamar wrote:
>
>  Hi,
>
>  I am using cmake to create Makefile. I am using MPI in my project but I
> only want to use the C (mpicc) not C++ (mpicxx) following is the
> CMakeLists.txt:
>
>  I have tested it but on some platforms it seems that it only detects the
> C++ mpi (mpicxx) and uses its libraries. This creates errors (mpi.h not
> found) as the project only needs C (mpicc and its libraries).
>
>  So how to force cmake to only search for C (mpicc) and use its libraries
> (the mpi.h not mpicxx.h).
>
>
>
> ADD_LIBRARY(nativempjdev SHARED ${SOURCE_FILES})
>
> find_package(MPI)
> if(MPI_FOUND)
> set(CMAKE_C_COMPILE_FLAGS ${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS})
> set(CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS})
>
> include_directories(${MPI_C_INCLUDE_PATH} $ENV{JAVA_HOME}/include
> $ENV{JAVA_HOME}/include/linux)
> endif(MPI_FOUND)
> target_link_libraries(nativempjdev ${MPI_C_LIBRARIES})
> install(TARGETS nativempjdev DESTINATION $ENV{MPJ_HOME}/lib)
>
>
>
>  Thanks
>   Bibrak Qamar
>
>
>
>
>
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140318/31ac595e/attachment.html>


More information about the CMake mailing list