MantisBT - CMake
View Issue Details
0014276CMakeCMakepublic2013-07-07 21:162016-06-10 14:31
Patrick Mihelich 
Alex Neundorf 
normalminoralways
closedmoved 
Ubuntu Linux12.10
CMake 2.8.9 
 
0014276: cmake --find-package doesn't handle debug/optimized/general keywords
CMake find/config modules may return libraries prefixed with "debug", "optimized" or "general" keywords to link different libraries depending on the build type. These are handled specially by target_link_libraries. The --find-package mode treats them as libraries to link against instead.
With the Ubuntu system install of protobuf:

$ cmake --find-package -DNAME=Protobuf -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=LINK
-rdynamic -loptimized -lprotobuf -ldebug -lprotobuf -ldebug
No tags attached.
child of 0014676closed Alex Neundorf cmake --find-package summary ticket 
Issue History
2013-07-07 21:16Patrick MihelichNew Issue
2013-07-08 09:40Brad KingAssigned To => Alex Neundorf
2013-07-08 09:40Brad KingStatusnew => assigned
2013-07-08 15:25Alex NeundorfNote Added: 0033512
2013-07-08 15:25Alex NeundorfStatusassigned => backlog
2014-01-01 12:21Alex NeundorfRelationship addedchild of 0014676
2014-09-03 17:19Orion E. PoplawskiNote Added: 0036729
2016-06-10 14:29Kitware RobotNote Added: 0042314
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0033512)
Alex Neundorf   
2013-07-08 15:25   
Having seen the feedback of this feature so far, I plan to change it so that it supports only find_package() in Config mode.
This will make things more reliable.
But this won't happen for 2.8.12.
(0036729)
Orion E. Poplawski   
2014-09-03 17:19   
Part of the issue seems to be brain dead searching for a debug library in FindProtobuf.cmake:

   find_library(${name}_LIBRARY
       NAMES ${filename}
       PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release)
   mark_as_advanced(${name}_LIBRARY)

   find_library(${name}_LIBRARY_DEBUG
       NAMES ${filename}
       PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug)
   mark_as_advanced(${name}_LIBRARY_DEBUG)

   if(NOT ${name}_LIBRARY_DEBUG)
      # There is no debug library
      set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY} PARENT_SCOPE)
      set(${name}_LIBRARIES ${${name}_LIBRARY} PARENT_SCOPE)
   else()
      # There IS a debug library
      set(${name}_LIBRARIES
          optimized ${${name}_LIBRARY}
          debug ${${name}_LIBRARY_DEBUG}
          PARENT_SCOPE
      )
   endif()


That seems very VisualStudio ? specific. On linux/unix it simply finds the same library twice.
(0042314)
Kitware Robot   
2016-06-10 14:29   
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.