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

Bibrak Qamar bibrakc at gmail.com
Tue Mar 18 03:06:44 EDT 2014


And I did it.

It wasn't populating *MPI_C_INCLUDE_PATH *instead it populated
*MPI_INCLUDE_PATH.*

So now I am using only *MPI_INCLUDE_PATH, MPI_COMPILE_FLAGS, MPI_LINK_FLAGS
and MPI_LIBRARIES *not
* MPI_C_* *

Thanks
Bibrak Qamar



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

>  By quick Google search, I meant for "cmake project command". Not sure how
> I determined this originally. It was a long time ago. Probably read,
> re-read, and re-read the doco - it wasn't obvious. Anyway, hope it helps.
>
>
>
> On 18/03/14 17:22, Bruce Cartland 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/0b3e6629/attachment.html>


More information about the CMake mailing list