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 | |
parent | ecafa19bcfc2a4d27183b40066de163cb97dbdbf (diff) |
Fix building makehrtf and sofa-info on Windows
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | cmake/FindMySOFA.cmake | 25 | ||||
-rw-r--r-- | utils/sofa-info.cpp | 2 |
3 files changed, 26 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 16827594..1c14be46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1523,18 +1523,14 @@ IF(ALSOFT_UTILS) endif() add_executable(makehrtf ${MAKEHRTF_SRCS}) target_compile_definitions(makehrtf PRIVATE ${CPP_DEFS}) - target_include_directories(makehrtf PRIVATE ${MYSOFA_INCLUDE_DIRS}) target_compile_options(makehrtf PRIVATE ${C_FLAGS}) - if(HAVE_LIBM) - target_link_libraries(makehrtf PRIVATE ${LINKER_FLAGS} ${MYSOFA_LIBRARIES} m) - endif() + target_link_libraries(makehrtf PRIVATE ${LINKER_FLAGS} MySOFA::MySOFA) set(SOFAINFO_SRCS utils/sofa-info.cpp) add_executable(sofa-info ${SOFAINFO_SRCS}) target_compile_definitions(sofa-info PRIVATE ${CPP_DEFS}) - target_include_directories(sofa-info PRIVATE ${MYSOFA_INCLUDE_DIRS}) target_compile_options(sofa-info PRIVATE ${C_FLAGS}) - target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} ${MYSOFA_LIBRARIES}) + target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} MySOFA::MySOFA) endif() IF(ALSOFT_INSTALL) 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) diff --git a/utils/sofa-info.cpp b/utils/sofa-info.cpp index 51dd8b9e..e31ca654 100644 --- a/utils/sofa-info.cpp +++ b/utils/sofa-info.cpp @@ -366,7 +366,7 @@ static void SofaInfo(const char *filename) mysofa_free(sofa.hrtf); } -int main(const int argc, const char *argv[]) +int main(int argc, char *argv[]) { GET_UNICODE_ARGS(&argc, &argv); |