[CMake] find_library in Windows(SOLVED)

Vyacheslav Karamov ubuntulist at yandex.ru
Tue Apr 17 08:15:24 EDT 2012


I'm happy. It works!

target_link_libraries(${lib_name}
debug ${do_scoring_debug}
debug ${spinx_debug}
optimized ${do_scoring}
optimized ${spinx}
)

17.04.2012 14:59, Vyacheslav Karamov написал:
> When I specified full library name with extension find_library worked.
> But still have both debug and release versions of library being linked 
> with my target.
>
>
> 17.04.2012 12:13, Vyacheslav Karamov написал:
>> This code doesn't work also:
>>
>> if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
>>
>> find_library(spinx
>> NAME sphinxbase
>> HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release"
>> DOC "SphinX release library"
>> )
>>
>> find_library(spinx_debug
>> NAME sphinxbased
>> PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
>> DOC "SphinX debug library"
>> )
>> endif()
>>
>> 17.04.2012 11:47, Vyacheslav Karamov написал:
>>> Hi All!
>>>
>>> I have a problem with find_library in Windows. It does find static 
>>> library, but not import library.
>>> It's confusing to me.
>>>
>>> if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
>>>
>>> find_library(spinx
>>> NAMES sphinxbase
>>> ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
>>> )
>>>
>>> find_library(spinx_debug
>>> NAMES sphinxbased
>>> ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
>>> )
>>> endif()
>>>
>>> if (NOT spinx)
>>> message(STATUS "SphinX library has not been found")
>>> endif()
>>>
>>> if (NOT spinx_debug)
>>> message(STATUS "Debug version of SphinX library has not been found")
>>> endif()
>>>
>>>
>>> Nor debug neither release versions have been found.
>>> This is strange, because I have
>>> ../../Sphinx/sphinxbase/bin/Debug/sphinxbased.dll
>>> ../../Sphinx/sphinxbase/bin/Debug/sphinxbase.lib
>>> and
>>> ../../Sphinx/sphinxbase/bin/Release/sphinxbase.dll
>>> ../../Sphinx/sphinxbase/bin/Release/sphinxbase.lib
>>>
>>>
>>> I also tried another approach:
>>>
>>> link_directories(
>>> ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
>>> ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
>>> )
>>>
>>> target_link_libraries(${lib_name}
>>> debug ${do_scoring_debug} sphinxbased
>>> )
>>>
>>> target_link_libraries(${lib_name}
>>> optimized ${do_scoring} sphinxbase
>>> )
>>>
>>> but in this case both debug and release versions of sphinxbase are 
>>> linked with my target library.
>>>
>> -- 
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: 
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> -- 
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list