Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: allow overriding GME_ZLIB and GME_UNRAR options by user #632

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,12 @@ if(SDLMIXER_GME)
set(BUILD_SHARED_LIBS "${SDLMIXER_GME_SHARED}")
set(ENABLE_UBSAN OFF)
set(BUILD_FRAMEWORK OFF)
set(GME_ZLIB OFF)
set(GME_UNRAR OFF)
if(NOT DEFINED GME_ZLIB)
set(GME_ZLIB OFF)
endif()
if(NOT DEFINED GME_UNRAR)
set(GME_UNRAR OFF)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work for you too?

Suggested change
if(NOT DEFINED GME_ZLIB)
set(GME_ZLIB OFF)
endif()
if(NOT DEFINED GME_UNRAR)
set(GME_UNRAR OFF)
endif()
set(GME_ZLIB "OFF" CACHE BOOL "Build GME with zlib support")
set(GME_UNRAR "OFF" CACHE BOOL "Build GME with unrar support")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work for me. I am setting GME_ZLIB from the project CMakeLists.txt before including SDL_mixer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to do the following in your cmake script:

set(GME_ZLIB ON CACHE BOOL "GME with zlib" FORCE)
set(GME_UNRAR ON CACHE BOOL "GME with unrar" FORCE)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it works, but as user just writing:

set(GME_ZLIB ON)

seems like more intuitive way for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one has a better behavior, I think.

Suggested change
if(NOT DEFINED GME_ZLIB)
set(GME_ZLIB OFF)
endif()
if(NOT DEFINED GME_UNRAR)
set(GME_UNRAR OFF)
endif()
option(GME_ZLIB "GME with zlib" OFF)
option(GME_UNRAR "GME with unrar" OFF)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this seems like a better way. Also libgme CMakeLists no longer has GME_UNRAR option.

message(STATUS "Using vendored libgme")
sdl_check_project_in_subfolder(external/libgme libgme SDLMIXER_VENDORED)
add_subdirectory(external/libgme EXCLUDE_FROM_ALL)
Expand Down
Loading