On 1/9/2012 3:44 PM, Mitchell, John A wrote:
add_executable(demo_cf_pointer demo_cf_pointer.F90) target_link_libraries(demo_cf_pointer I_Fortran -lstdc++)
CMake prefers to use the C++ compiler to link when any C++ is involved. Some toolchains use a "prelinker" step that actually runs the C++ compiler to handle template instantiations. IIRC some vendors document that the C++ compiler should be used if there is any C++ in the link. This may or may not still be true on modern tools, but that is the historical reason for this behavior. You can tell CMake explicitly to use the Fortran compiler to link: set_property(TARGET demo_cf_pointer PROPERTY LINKER_LANGUAGE Fortran) CMake should still take care of the implicit libraries so you do not need the explicit "-lstdc++" (though I have not tested this with MPI compiler wrappers myself). -Brad -- 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
