diff options
author | Chris Robinson <[email protected]> | 2019-01-22 13:14:11 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-22 13:17:21 -0800 |
commit | 5c0dcd1f24a85798ded45abb97bdd80a9d93a8b6 (patch) | |
tree | 5593a7a95f559c05528601f858b4aaaefdfe9d23 /cmake/FindMySOFA.cmake | |
parent | ecafa19bcfc2a4d27183b40066de163cb97dbdbf (diff) |
Fix building makehrtf and sofa-info on Windows
Diffstat (limited to 'cmake/FindMySOFA.cmake')
-rw-r--r-- | cmake/FindMySOFA.cmake | 25 |
1 files changed, 23 insertions, 2 deletions
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) |