[CMake] Add a .obj file to a library

Anton Deguet anton.deguet at jhu.edu
Tue Mar 13 12:49:04 EST 2007


I tried a couple more things.   Since the paths were compounded I  
assumed this was because I could only add files defined with a  
relative path (wrt the source directory).   So I tried to convert the  
absolute path into a relative path using:

FILE(RELATIVE_PATH
           FILE_IN_RELATIVE_PATH
           ${CMAKE_CURRENT_SOURCE_DIR}
           ${FILE_IN_ABSOLUTE_PATH})

This works only if the source directory and the directory containing  
the .obj file are on the same drive.  In my case, the obj file in on  
C: while my source directory is on N:   and I don't know if one can  
define a relative path between two drives on Windows.

I there a way to tag a source file as defined with absolute path?

Anton


On Mar 9, 2007, at 12:15 PM, Anton Deguet wrote:

> Hello,
>
> I am trying to add a pre-compiled object in a library.  I am  
> generating a "solution" for  Microsoft Visual Studio .net 2003  
> using CMake 2.4.5.   I used FIND_FILE to locate the ".obj" file and  
> then simply add it to the list of source files for my library.   I  
> found a couple of reference on the web related to this problem so I  
> was hopeful.
>
> It doesn't work as is because CMake prepends the current source  
> path to my file name (which already contains a full path).   So I  
> get a message stating that "C:/current-source-path/C:/path-to-my- 
> obj/file.obj" can not be found.   Is there an easy way to tell  
> CMake to not prepend the current source path?
>
> Also, all examples found on the web referred to ".o" files but not  
> ".obj" files.  I am pretty sure that CMake can handle this  
> difference but I just wanted verify.
>
> Thanks,
>
> Anton
>

---
Anton Deguet, Research Engineer, ERC-CISST, Johns Hopkins University
anton.deguet at jhu.edu, 410-516-5261
iChat only: anton.deguet at mac.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070313/c9bc9ca1/attachment.htm


More information about the CMake mailing list