aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/FindSndFile.cmake
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-19 04:00:01 -0700
committerChris Robinson <[email protected]>2020-04-19 04:00:01 -0700
commit9b9a65a0bfe2aec00f6768c217b972598e22a934 (patch)
treef23d13f316336f3e0216690239b6355b7f02e7b2 /cmake/FindSndFile.cmake
parent3902337e01efca5ecda82556c37074e47fc87889 (diff)
Use an import target for libsndfile
Diffstat (limited to 'cmake/FindSndFile.cmake')
-rw-r--r--cmake/FindSndFile.cmake10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmake/FindSndFile.cmake b/cmake/FindSndFile.cmake
index afeec961..b931d3c0 100644
--- a/cmake/FindSndFile.cmake
+++ b/cmake/FindSndFile.cmake
@@ -2,8 +2,8 @@
# Once done this will define
#
# SNDFILE_FOUND - system has SndFile
-# SNDFILE_INCLUDE_DIRS - the SndFile include directory
-# SNDFILE_LIBRARIES - Link these to use SndFile
+# SndFile::SndFile - the SndFile target
+#
find_path(SNDFILE_INCLUDE_DIR NAMES sndfile.h)
@@ -15,8 +15,10 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
if(SNDFILE_FOUND)
- set(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR})
- set(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY})
+ add_library(SndFile::SndFile UNKNOWN IMPORTED)
+ set_target_properties(SndFile::SndFile PROPERTIES
+ IMPORTED_LOCATION ${SNDFILE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${SNDFILE_INCLUDE_DIR})
endif()
# show the SNDFILE_INCLUDE_DIR and SNDFILE_LIBRARY variables only in the advanced view