[CMake] Link directories
Michael Wild
themiwi at gmail.com
Mon Feb 14 09:55:50 EST 2011
On 02/14/2011 03:45 PM, Robert Bielik wrote:
> Eric Noulard skrev 2011-02-14 15:42:
>>> I seem to be missing something, cause I cannot find a target property
>>> for
>>> setting additional library directories (for a MSVC project)
>>
>> Usually you do not specify "additional lib directories" you should
>> specify all libs you need with "target_link_libraries".
>>
>
> Ok, you mean like:
>
> add_library(dsound SHARED IMPORTED)
> set_target_properties(dsound PROPERTIES IMPORTED_LOCATION
> "${DSOUND_LIBRARY}/dsound.lib")
>
> target_link_libraries(MyTarget dsound)
>
> ??
> /Rob
That's the fancy way, an alternative would be
find_library(DSOUND_LIBRARY dsound)
target_link_libraries(MyTarget ${DSOUND_LIBRARY})
Probably you could make the find_library call more robust by appropriate
PATHS options, but I currently don't have a windows available, so I
can't check whether the registry would help.
HTH
Michael
More information about the CMake
mailing list