[CMake] ADD_LIBRARY default behavior

Mike Jackson imikejackson at gmail.com
Wed Aug 30 14:11:24 EDT 2006


On 8/30/06 1:51 PM, "Richard Fuchs" <fuchsrich at se-core.net> wrote:

> William A. Hoffman wrote:
>> At 11:06 AM 8/30/2006, Richard Fuchs wrote:
>>   
>>> I want to be able to create my libraries in a different directory instead of
>>> the current_bin_dir
>>> 
>>>     
>> 
>> See :
>> 
>> http://www.cmake.org/Wiki/CMake_Useful_Variables
>> 
>> LIBRARY_OUTPUT_PATH
>> 
>> -Bill
>> 
>>   
> 
> Ah, so simple.
> 
> But looking at the output, it's resulting in
> c++ -o libserialize.so "CMakeFiles/serialize.dir/ln_serialize.o" then a
> mv command
> instead of what I'd expect which would be
> c++ -o my_new_lib_path/libserialize.so
> "CMakeFiles/serialize.dir/ln_serialize.o"
> 
> 
> It's the same as putting a custom command after the add_library to move
> the .so
> 
> But, it works either way.
> 
> Thanks
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

Couple of comments.
  You can do it your way by creating the file, then moving it yourself. This
is fine and maybe not portable to other platforms. OR you can re-use the
convenience method of the LIBRARY_OUTPUT_PATH variable and let the Cmake
team worry about all the cross platform problems of moving the library.
  There is also the underlying issue that IF RPATH is ON, then the proper
path will be encoded in the library using the LIBRARY_OUTPUT_PATH  variable
where as using your method would most likely lead to problems.
  Let the Cmake team worry about this type of stuff while you worry about
algorithm development.
 Just my 2 cents.
-- 
Mike Jackson
imikejackson <at> gmail <dot> com




More information about the CMake mailing list