From 5c0dcd1f24a85798ded45abb97bdd80a9d93a8b6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 22 Jan 2019 13:14:11 -0800 Subject: Fix building makehrtf and sofa-info on Windows --- cmake/FindMySOFA.cmake | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'cmake/FindMySOFA.cmake') diff --git a/cmake/FindMySOFA.cmake b/cmake/FindMySOFA.cmake index dbd7a01b..a1d57446 100644 --- a/cmake/FindMySOFA.cmake +++ b/cmake/FindMySOFA.cmake @@ -39,6 +39,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= +find_package(ZLIB) + find_path(MYSOFA_INCLUDE_DIR NAMES mysofa.h DOC "The MySOFA include directory" ) @@ -47,14 +49,33 @@ find_library(MYSOFA_LIBRARY NAMES mysofa DOC "The MySOFA library" ) +find_library(MYSOFA_M_LIBRARY NAMES m + DOC "The math library for MySOFA" +) + # handle the QUIETLY and REQUIRED arguments and set MYSOFA_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MYSOFA REQUIRED_VARS MYSOFA_LIBRARY MYSOFA_INCLUDE_DIR) +find_package_handle_standard_args(MYSOFA REQUIRED_VARS MYSOFA_LIBRARY MYSOFA_INCLUDE_DIR ZLIB_FOUND) if(MYSOFA_FOUND) - set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARY}) set(MYSOFA_INCLUDE_DIRS ${MYSOFA_INCLUDE_DIR}) + set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARY}) + set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARIES} ZLIB::ZLIB) + if(MYSOFA_M_LIBRARY) + set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARIES} ${MYSOFA_M_LIBRARY}) + endif() + + add_library(MySOFA::MySOFA UNKNOWN IMPORTED) + set_property(TARGET MySOFA::MySOFA PROPERTY + IMPORTED_LOCATION ${MYSOFA_LIBRARY}) + set_target_properties(MySOFA::MySOFA PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${MYSOFA_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) + if(MYSOFA_M_LIBRARY) + set_property(TARGET MySOFA::MySOFA APPEND PROPERTY + INTERFACE_LINK_LIBRARIES ${MYSOFA_M_LIBRARY}) + endif() endif() mark_as_advanced(MYSOFA_INCLUDE_DIR MYSOFA_LIBRARY) -- cgit v1.2.3