The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=14207 ====================================================================== Reported By: Greg Eisenhauer Assigned To: ====================================================================== Project: CMake Issue ID: 14207 Category: CMake Reproducibility: always Severity: major Priority: normal Status: new ====================================================================== Date Submitted: 2013-06-07 09:01 EDT Last Modified: 2013-06-07 09:01 EDT ====================================================================== Summary: with PGI compilers, simple C++ program plus C library project fails to link Description: Attached is a tar file with two simple source files and a CMake spec. This is a very simple example of a C++ hello world program including a C library. The CMakeList.txt looks like this:
add_library(dummy help.c) ADD_EXECUTABLE(main main.cpp) target_link_libraries(main dummy) The C++ program doesn't actually reference the library, so you can try it with or without the target_link_libraries() line. If you try this with the PGI compilers, and include the dummy library you get a link error, "undefined reference to `__zceh_uncaught_exception'". This appears to be because Cmake has spuriously added -lstdc++ to the link line. (A manual link without -lstdc++ works without error.) If you comment out the target_link_libraries(), all is well, -lstdc++ doesn't appear and the link goes fine. Steps to Reproduce: # where CC and cc are PGI compilers on Titan # untar cmake_test.tar cd cmake_test.tar setenv CC cc setenv CXX CC cmake . make Additional Information: -- The C compiler identification is PGI 12.10.0 -- The CXX compiler identification is PGI 12.10.0 I've tested this with cmake 2.8.6, 2.8.10.2, and with a fresh build from GIT. I've tested with all the versions of the PGI compilers available on titan. All combinations show the same problem of spuriously adding -lstdc++ to the link line. I've tested this on sith.ccs.ornl.gov with various versions of cmake and PGI and *CANNOT* duplicate the problem. I don't currently have access to PGI compilers on any other machines, so this may be something specific to Titan. I've dumped all variables and attributes for the two targets, and stdc++ doesn't seem to appear in anything other than CMAKE_C_IMPLICIT_LINK_LIBRARIES. Sorry I haven't been able to duplicate this on anything except titan.ccs.ornl.gov, which is a rather unique and restricted machine, but I know the folks at kitware collaborate there, so hopefully someone can check this out. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2013-06-07 09:01 Greg EisenhauerNew Issue 2013-06-07 09:01 Greg EisenhauerFile Added: cmake_test.tar ====================================================================== -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers