On 05/21/2015 06:00 PM, lucas.pet...@engilitycorp.com wrote: > I am trying to compile a code written in C, but using an external > library that contains C++ functions. I am on a Cray system and > everything works if I manually link with the cray CC wrapper. > When I change the linker language with this command: > > set_property(TARGET adh PROPERTY LINKER_LANGUAGE CXX) > > CMake is using the CC wrapper, but adding -lstdc++ to the link line. > This causes an error. Can anyone tell me how to not get this added library?
CMake detects the libraries implicitly added by the compiler front-end for each language. When mixing languages it chooses to link using the compiler front-end for one of the languages and adds the implicit libraries needed for other languages and not added by the chosen one. This case looks strange because you are telling it to link with the C++ compiler but CMake is still adding the implicit library for C++. Look at CMakeFiles/${CMAKE_VERSION}/CMake*Compiler.cmake for details of the compiler detected for each language. Look for these variables: CMAKE_C_COMPILER CMAKE_C_IMPLICIT_LINK_LIBRARIES CMAKE_CXX_COMPILER CMAKE_CXX_IMPLICIT_LINK_LIBRARIES To what are they set? Thanks, -Brad -- 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://public.kitware.com/mailman/listinfo/cmake