MantisBT - CMake
View Issue Details
0011011CMakeCMakepublic2010-07-19 18:022013-01-09 10:57
th3flyboy 
 
normalmajoralways
closedunable to reproduce 
CMake-2-8 
 
0011011: CMake appears to have issues attempting to link to libraries that have a period in the file name
Cmake appears to be having issues in linking to libraries with a period in the file name (such as the library SigC-2.0 for SigC++). This blocks linking to libraries and prevents compiling.
This only appears to happen when trying to link using a find library method for use with libraries when using a findX.cmake file to find them. Linking by using TARGET_LINK_LIBRARIES works fine if you link it to the actual library file name suchas library-version.minor.lib, and not a alias assigned by the Findx.cmake file such as for instance ${genericlibrary_library} or using the UtilityMacros to use LINK_WITH_VARIABLES(ComplingLibname
                    genericlibrary_library)
No tags attached.
zip sigc.zip (115,498) 2010-07-20 19:52
https://public.kitware.com/Bug/file/3255/sigc.zip
Issue History
2010-07-19 18:02th3flyboyNew Issue
2010-07-20 09:24Bill HoffmanStatusnew => assigned
2010-07-20 09:24Bill HoffmanAssigned To => Brad King
2010-07-20 10:00Brad KingNote Added: 0021430
2010-07-20 19:52th3flyboyFile Added: sigc.zip
2010-07-20 19:52th3flyboyNote Added: 0021434
2010-07-21 08:45Brad KingNote Added: 0021435
2010-07-21 13:43th3flyboyNote Added: 0021442
2010-08-21 20:46th3flyboyNote Added: 0021878
2010-08-23 08:39Brad KingNote Added: 0021891
2012-08-13 10:42Brad KingAssigned ToBrad King =>
2012-08-13 10:42Brad KingStatusassigned => resolved
2012-08-13 10:42Brad KingResolutionopen => unable to reproduce
2013-01-09 10:57Robert MaynardNote Added: 0032051
2013-01-09 10:57Robert MaynardStatusresolved => closed

Notes
(0021430)
Brad King   
2010-07-20 10:00   
Please attach a minimum test project to reproduce this.
(0021434)
th3flyboy   
2010-07-20 19:52   
Uploaded a example test. Compile using VS2008.
(0021435)
Brad King   
2010-07-21 08:45   
After modifying the C++ code in the example with the patch below, the helloworld executable links correctly for me. What error do you see?

diff --git a/test/helloworld/Main.cpp b/test/helloworld/Main.cpp
index bf09f58..60b53a2 100755
--- a/test/helloworld/Main.cpp
+++ b/test/helloworld/Main.cpp
@@ -9,9 +9,9 @@ using namespace std;
 class helloworldtest
 {
 public:
- helloworldtest();
+ helloworldtest() {}
 
- void run();
+ void run() {}
 
        sigc::signal<void> signal_detected;
 };
(0021442)
th3flyboy   
2010-07-21 13:43   
D'oh! Well that was smart for the example... I'll have to test that, but the problem we've been having in the project I'm working with is whenever we link to SigC++ we have linker errors coming from namespace std. I'll have to test this, but I think I am an idiot at this point.
(0021878)
th3flyboy   
2010-08-21 20:46   
I realized something involving this bug. I guess the code I submitted as an example is borked, however here's where it gets interesting. When compiling the project I'm working with using Visual Studio with solutions generated by CMake, this is an anomaly. When you link the .lib file directly by filename in the cmakelists.txt it compiles fine, however when you link to it using the findcmake file provided in that zip, it acts up and can't link to sigc/libstd. When I submitted that example, I basically adapted the tutorial code from the sigc site as a very basic example. I would think that the basic hello world tutorial from there would work. Now, when linking using VC9 and Windows 7, with the cmake file provided, it tosses errors at me as specified above. However, something makes me doubt it's the code in the project due to that it works just fine when you directly link to the .lib in the cmakelists.txt instead of a variable as demonstrated in the example above.

Sorry it took so long to get back to this, life has been chaotic lately.
(0021891)
Brad King   
2010-08-23 08:39   
Just before the call to target_link_libraries, print out the value of the variable:

message(WARNING "genericlibrary_library=[${genericlibrary_library}]"

Obviously please substitute the variable name actually referenced in the link call. What does it print? When the build fails to link, what is the actual error message?
(0032051)
Robert Maynard   
2013-01-09 10:57   
Closing resolved issues that have not been updated in more than 4 months.