[CMake] Directing cmake to link against shared object with debug postfix (_d)

Olumide 50295 at web.de
Wed Apr 12 07:28:46 EDT 2017


Thanks Robert.

However it appears that the release build is linking against 
ContinuumTransfunctioner_d and Transmogrifier_d.

How can I omit the _d suffix in the release build.

Regards,

- Olumide

On 11/04/2017 19:50, Robert Maynard wrote:
> CMAKE_DEBUG_POSTFIX is only used by CMake when it builds libraries to
> determine what exact file name the executable/library should have.
>
> In your case you will need to do something like:
>
> set(Libraries
>     ContinuumTransfunctioner${CMAKE_DEBUG_POSTFIX}
>     Transmogrifier${CMAKE_DEBUG_POSTFIX}
> )
>
> Another option would to generate proper import targets for your
> libraries, as that would allow you to specify different paths for the
> release and debug components.
>
> On Tue, Apr 11, 2017 at 8:45 AM, Olumide <50295-S0/GAf8tV78 at public.gmane.org> wrote:
>> Dear List,
>>
>> I've got a cmake project that pretty much looks like this:
>>
>> ###############################################################
>>
>> cmake_minimum_required(VERSION 3.0)
>>
>> SET(CMAKE_DEBUG_POSTFIX "_d")
>>
>> include_directories(../TransfunctionerProject)
>> include_directories(../TransmogrifierProject)
>>
>> set(Libraries
>>     ContinuumTransfunctioner
>>     Transmogrifier
>> )
>>
>> set(SourceFiles
>>     Wrapper.cpp
>>     Logger.cpp
>> )
>>
>> add_library(Frobnigator SHARED ${SourceFiles})
>> add_library(FrobnigatorStatic STATIC ${SourceFiles})
>> set_target_properties(FrobnigatorStatic PROPERTIES OUTPUT_NAME Frobnigator)
>> target_link_libraries(Frobnigator ${Libraries})
>>
>> ###############################################################
>>
>> Where ContinuumTransfunctioner and Transmogrifier projects include the debug
>> postfix directive SET(CMAKE_DEBUG_POSTFIX "_d") so that
>> libContinuumTransfunctioner_d.so and libTransmogrifier_d.so both exist.
>>
>> The problem is that the current project appears to be linking against the
>> static library without the _d suffix and complains:
>>
>> /usr/bin/ld: cannot find -lContinuumTransfunctioner
>>
>> How can I direct cmake to link against shared object with debug postfix (_d)
>>
>> Thanks
>>
>> - Olumide
>>
>>
>>
>>
>> --
>>
>> 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://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list