MantisBT - CMake
View Issue Details
0009060CMakeCMakepublic2009-05-22 03:152016-06-10 14:30
cbielow 
Brad King 
normalmajoralways
closedmoved 
CMake-2-6 
 
0009060: using altered library names (CMAKE_DEBUG_POSTFIX, or OUTPUT_NAME) leads to broken link dependencies
Hi,

lets start with code:

[CODE]

## append "d" to debug libs (not executables!)
SET(CMAKE_DEBUG_POSTFIX d);

add_library(myLib ${sources});
target_link_libraries(myLib ${QT_LIBRARIES});

add_executable(myExe myExe.C);

## --> now the trouble starts:

## either:
target_link_libraries(myExe optimized myLib${CMAKE_RELEASE_POSTFIX} debug myLib${CMAKE_DEBUG_POSTFIX})
##--> will break QT dependency of myEXE

## or:
target_link_libraries(myExe myLib);
##--> will generate correct QT dependencies but bad library name (missing postfix) in library list of the VS solution file.

[ENDCODE]

my current workaround is to "manually" add the QT dependency to myExe, but this is bad style.

I tried to set the <CONFIG>_OUTPUT_NAME property, but the issue remained...


greetings
Chris
No tags attached.
Issue History
2009-05-22 03:15cbielowNew Issue
2009-09-14 12:44Bill HoffmanStatusnew => assigned
2009-09-14 12:44Bill HoffmanAssigned To => Brad King
2009-09-14 18:09Brad KingNote Added: 0017495
2012-08-13 10:44Brad KingStatusassigned => backlog
2012-08-13 10:44Brad KingNote Added: 0030560
2016-06-10 14:27Kitware RobotNote Added: 0041561
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0017495)
Brad King   
2009-09-14 18:09   
set(CMAKE_DEBUG_POSTFIX d)
add_library(myLib ${sources})
target_link_libraries(myLib ${QT_LIBRARIES})
add_executable(myExe myExe.C)

# This line is correct:
target_link_libraries(myExe myLib)

# This line is wrong:
# target_link_libraries(myExe
# optimized myLib${CMAKE_RELEASE_POSTFIX}
# debug myLib${CMAKE_DEBUG_POSTFIX})
# CMake prefers its own targets to be named.
# When you name the target with the suffix then CMake
# does not recognize it as a target of which it knows.

What is the actual link line produced for myexe in each configuration?

What versions of CMake have you tried?
(0030560)
Brad King   
2012-08-13 10:44   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041561)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.