[CMake] Removing debug and optimized prefixes

Alvaro Aguilera alvaro.aguilera at gmail.com
Thu Aug 15 08:03:38 EDT 2013


Thank you for responding.

I found out that the problem was in the FindProtobuf module shipped with
opensuse.
As a workaround I'm using the following line after find_package(Protobuf):

list(REMOVE_ITEM PROTOBUF_LIBRARIES "debug" "optimized")

Here are the calls to add_library() and target_link_libraries(), just
for the record:

--------------------------
add_library(
    mytarget SHARED
    some-code.cpp
    "${PROTO_SRCS}"
    "${PROTO_HDRS}"
)

target_link_libraries(
    mytarget
    "${PROTOBUF_LIBRARIES}"
    "${Boost_LIBRARIES}"
)


Regards,
Alvaro


On 15.08.2013 13:57, Eric Noulard wrote:
> 2013/8/15 Alvaro Aguilera <alvaro.aguilera at gmail.com>:
>> Hello,
>>
>> I'm using cmake 2.8.11.2 under Linux to compile a small shared library.
>> The problem I have is that the cmake's link command prefixes some of the
>> libraries with "debug" and "optimized":
>>
>> (...) -loptimized /usr/local/lib64/libprotobuf.so -ldebug
>> /usr/local/lib64/libprotobuf.so -ldebug -Wl (...)
>
> Could you sow us the corresponding CMakeLists.txt?
> At least the part containing add_library and target_link_libraries
> statement.
>
> CMake seems to believe that "debug" and "optimized"
> are library names and not keywords from
> the target_link_library.
>
>
>
>> the linker isn't aware of the prefixes and gives and error:
>>
>> /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
>> cannot find -loptimized
>> /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
>> cannot find -ldebug
>>
>> Any idea how to fix this issue?
>>
>> Thanks,
>> Alvaro
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
>



More information about the CMake mailing list