MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0011348 | CMake | CMake | public | 2010-10-21 12:23 | 2010-10-26 12:14 |
Reporter | Jeff Hensley | ||||
Assigned To | Brad King | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | OS | OS Version | |||
Product Version | CMake-2-8 | ||||
Target Version | Fixed in Version | ||||
Summary | 0011348: Why does Cmake use "-l" for linking when the actual (static) library is given? | ||||
Description | I'm having to jump through some hoops while using Cmake because it seems to recognize that given libraries are in known locations, and then provides links to them via the -l flag even though we are providing the actual location and name of a library (*.a). Note: this is on an HPC platform. cc is a wrapper script that sets up the MPI and other niceities. cc is thus a front end to different compilers which is changed by using the module command. | ||||
Steps To Reproduce | |||||
Additional Information | Consider the following simple example: project (foo C) add_executable(foo foo.c) set(executable_name "foo") set(ZLIB_LIBRARY "/usr/lib64/libz.a") #Option 1 #set(ZLIB_LIBRARY "/u/hensley/libz.a") #Option 2 target_link_libraries(${executable_name} ${ZLIB_LIBRARY}) *************************** The link line is completely different depending on which libz I point to. In the Option 1, libz.a is in a standard library location. It appears that cmake identifies this and rather than using "/usr/lib64/libz.a" in the link, it uses "-lz". Here is link.txt: /opt/cray/xt-asyncpe/3.3/bin/cc CMakeFiles/foo.dir/foo.c.o -o foo -Wl,-Bstatic -lz -Wl,-Bdynamic Now, if I use the second option, the resulting link line is: /opt/cray/xt-asyncpe/3.3/bin/cc CMakeFiles/foo.dir/foo.c.o -o foo /u/hensley/libz.a On this platform, I *absolutely must* link statically. But, I'm attempting to ensure this by pointing *always* to static objects. But cmake is getting ahead of me and thwarting my efforts. Now, I just ran across "LINK_SEARCH_END_STATIC" which might allow me to work around this (IF I can figure out how to use that), but it seems counter-intuitive to me that I would have to jump through yet more hoops to tell cmake to do what I've always been telling it to do! Any insight would be appreciated. Also, if LINK_SEARCH_END_STATIC can be used to "fix" this, I could use a simple example. Thanks! | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2010-10-21 12:23 | Jeff Hensley | New Issue | |||
2010-10-21 13:02 | Bill Hoffman | Status | new => assigned | ||
2010-10-21 13:02 | Bill Hoffman | Assigned To | => Brad King | ||
2010-10-26 12:14 | Brad King | Note Added: 0022704 | |||
2010-10-26 12:14 | Brad King | Status | assigned => closed | ||
2010-10-26 12:14 | Brad King | Resolution | open => no change required |
Notes | |||||
|
|||||
|
|