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

Reply via email to