1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +02:00
Dmitry Vedenko 8aca9d02de Add the first Conan-based dependecies
add_conan_lib cmake function is defined, that allows to add a dependency using Conan with two possible system fallbacks:

1. pkg_check_modules is invoked, if `PGK_CONFIG ...` is present
2. find_package is invoked if `FIND_PACKAGE_OPTIONS` is present and `pkg_check_modules` has failed

If `ALWAYS_ALLOW_CONAN_FALLBACK` is present - `obey_system_dependencies` will be ignored for the package

Currently, the following dependencies are retrieved using Conan:

* zlib
* expat
* wxwidgets
* libmp3lame
* libid3tag
* libmad

The last three libraries are included in this commit, as they depend on zlib.
Properly pass **arch** and **os.version** to Conan
2021-05-24 06:53:53 -07:00

40 lines
1.1 KiB
CMake

# ZLib is a very popular library to use.
# Some of the dependecies do not check for the system libraries,
# which can be problematic.
# We need to call find_package once again.
if (${_OPT}use_zlib STREQUAL "system")
message(STATUS "Fixing up ZLib mess...")
find_package(ZLIB REQUIRED)
set_target_properties(ZLIB::ZLIB PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
if(ZLIB_LIBRARY_RELEASE)
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_property(TARGET ZLIB::ZLIB
PROPERTY INTERFACE_LINK_LIBRARIES
"${ZLIB_LIBRARY_RELEASE}"
)
endif()
if(ZLIB_LIBRARY_DEBUG)
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET ZLIB::ZLIB
PROPERTY INTERFACE_LINK_LIBRARIES
"${ZLIB_LIBRARY_DEBUG}"
)
endif()
if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
set_property(TARGET ZLIB::ZLIB
PROPERTY INTERFACE_LINK_LIBRARIES
"${ZLIB_LIBRARY}"
)
endif()
endif()