[CMake] How can I avoid the addition of Debug/Release to the link path?

Bill Hoffman bill.hoffman at kitware.com
Tue Oct 9 12:36:52 EDT 2007


Sylvain Benner wrote:
>
>> This has to be this way, or the cmake generated projects will not be 
>> able to find
>> libraries in other projects of the same build type.  Can someone 
>> explain the issue
>> with this?   We are using this for VTK and several other larger 
>> projects, and
>> it works fine.
>>
>> -Bill
> Ok I understand but library files are not necessary in 
> "$(CONFIGURATION)" folder, they can be in "$(CONFIGURATION)/subfolder" 
> for instance.
Not if it was built by a CMake project.  It should at least work for 
that case.
>
> I think it should not be hardcoded because the paths where the 
> libraries are can be anything.
The idea was that extra paths should not hurt, in most cases, and that 
for cmake
only projects things should just work with extra stuff.
>
> It should be handled like this I guess:
>
> LINK_DIRECTORIES( my_path_debug, my_path_release, ....)
> LINK_LIBRARIES(DEBUG my_lib_debug OPTIMIZE my_lib_release)
If it is something not being built by cmake, then a full path should be 
used,
and cmake should do the right thing.   LINK_DIRECTORIES should be
used as a last resort.   If the library does not exist at cmake run 
time, because
it will be built by the cmake project, then it should work.  If the library
does exist at configure time, then a full path to the library should be 
used.

>
> The librairies should have different names but this is often the case.
In many cases they do not have different names.   

-Bill



More information about the CMake mailing list