8bitbubsy / ft2-clone

Fasttracker 2 clone for Windows/macOS/Linux
https://16-bits.org
BSD 3-Clause "New" or "Revised" License
712 stars 48 forks source link

CMakeLists.txt change in order to compile in Linux #3

Closed jgascon closed 4 years ago

jgascon commented 4 years ago

Dear developer,

I was trying to compile ft2-clone in Linux (I am using Arch Linux) and I had to replace two lines inside CMakeLists.txt:

The lines that had to be replaced where:

target_link_libraries(ft2-clone
    PRIVATE m asound pthread ${SDL2_LIBRARIES})

And they were replaced by:

target_link_libraries(ft2-clone PRIVATE asound SDL2::SDL2)

Without this change, Linux is unable to build ft2-clone, it does not find SDL2 libraries.

8bitbubsy commented 4 years ago

Since the current CMakefile has worked fine in the distros I have tried, I wonder if the new one will break it for non-Arch systems?

jgascon commented 4 years ago

I agree with you, it is not desirable to break other distros with this change.

Looking for a more compatible solution, I have found this: https://github.com/tsoding/nothing/issues/923

Essentially, the change consists in adding these lines:

if("${SDL2_LIBRARIES}" STREQUAL "")
    message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
    set(SDL2_LIBRARIES "SDL2::SDL2")
endif()

Before the lines:

target_link_libraries(ft2-clone
    PRIVATE m asound pthread ${SDL2_LIBRARIES})

I have tested in Arch Linux and it builds fine, although that is not very elegant, it seems to work.

8bitbubsy commented 4 years ago

It may not be elegant, but nothing in this project is anyway. :) It has been fixed now. Thanks for reporting this!

jgascon commented 4 years ago

Thank you very much Olav! :-)

El mié., 18 mar. 2020 a las 11:36, Olav Sørensen (notifications@github.com) escribió:

It may not be elegant, but nothing in this project is anyway. :) It has been fixed now. Thanks for reporting this!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/8bitbubsy/ft2-clone/issues/3#issuecomment-600546659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGYCUZMPN3RSIGWKC4FBYTRICP2DANCNFSM4LNFTIQA .

-- Jorge.