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

Olumide 50295 at web.de
Tue Apr 11 08:45:56 EDT 2017


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






More information about the CMake mailing list