Submitted by Admin on

Interesting stuff with cmake. You can't simply add library named debug to the list!
According to the cmake library documentation there are registered words debug|optimized|general

link_libraries([item1 [item2 [...]]]
               [[debug|optimized|general] <item>] ...)

In my CMakeLists.txt I had

  set(
    MY_LIBRARIES
    patches
    debug
    pad
    modplug
  )
  
  target_link_libraries(${PROJECT_NAME} PUBLIC 
        ${MY_LIBRARIES}
    )

But in ninja build script library debug was missed.

-lpatches  -lmodplug

This could be fixed by creating IMPORTED target for debug library:

find_library(DEBUG_LIBRARY debug PATH ${PS2SDK}/ee/lib/ NO_DEFAULT_PATH)
add_library(debug_lib SHARED IMPORTED)
set_target_properties(debug_lib PROPERTIES IMPORTED_LOCATION ${DEBUG_LIBRARY})

The set command will be look like this

  set(
    MY_LIBRARIES
    patches
    debug_lib
    pad
    modplug
  )

And command for ninja will be in result:

-lpatches /usr/local/ps2dev/ps2sdk/ee/lib/libdebug.a  -lpad  -lmodplug