On 03/30/2011 01:42 PM, Marc Tajchman wrote:
> Hi,
> 
> How to specify different compilers for different source files in
> CMakeLists.txt, e.g. if
> 
> test1.cxx must be compiled with g++
> test2.cxx must be compiled with mpicxx (mpi compiler)
> 
> I tried
> 
>> add_executable(test1.exe test1.cxx)
>> set_source_files_properties(test2.cxx PROPERTIES CMAKE_CXX_COMPILER
> ${MPI_COMPILER})
>> add_executable(test2.exe test2.cxx)
> 
> but it didn't work (i.e. g++ is still used for test2.cxx -> test2.o).
> 
> Any help appreciated.
> 
> Best Regards,
> Marc
>

CMake can't do that. But if you need MPI, use

find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
add_executable(test1 test1.cxx)
add_executable(test2 test2.cxx)
target_link_libraries(test2 ${MPI_LIBRARIES})
set_target_properties(test2 PROPERTIES
  COMPILE_FLAGS "${MPI_COMPILE_FLAGS}"
  LINK_FLAGS "${MPI_LINK_FLAGS}")


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