Skip to content

Commit

Permalink
cmake: check for empty libsndfile version
Browse files Browse the repository at this point in the history
for some reason the variable `PC_LIBSNDFILE_VERSION` in our AppVeyor build pipeline is defined but empty. On the local mac I used for testing `libsndfile` was not found using `pkg-config` causing the variable to be not defined at all. In the remote version, the log suggests it is not found by `pkg-config` either. But the `cmake` version used in there falls back to a different behavior causing the variable to be defined but empty.

Checking for an empty string will hopefully work for all platforms
  • Loading branch information
theGreatWhiteShark committed Nov 24, 2024
1 parent 4bc8b74 commit 9ff9f3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ set(LIBSNDFILE_VERSION_FLAC_OGG "1.0.17")
set(LIBSNDFILE_VERSION_OPUS "1.0.28")
set(LIBSNDFILE_VERSION_MP3 "1.0.31")

if (DEFINED PC_LIBSNDFILE_VERSION)
if (DEFINED PC_LIBSNDFILE_VERSION AND PC_LIBSNDFILE_VERSION STRGREATER "")
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_FLAC_OGG}" H2CORE_HAVE_FLAC_SUPPORT)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_OPUS}" H2CORE_HAVE_OPUS_SUPPORT)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_MP3}" H2CORE_HAVE_MP3_SUPPORT)
Expand Down

0 comments on commit 9ff9f3a

Please sign in to comment.