Files
tenacity/cmake-modules/IsStaticLibrary.cmake
Avery King 2fe93ce849 Get more features to build
This commit gets the following features to build:

- MP2 export support
- MP3 support
- Opus support
- WavPack support
- VST 2 support

VST 3 support is disabled for now until I can figure out the VST 3 SDK
situation.

Various new CMake find modules were added, predominantly from Mixxx (as
expected) but also from libsndfile too.

LAME loading remnants were also removed. We always build Tenacity
against LAME. I could've also removed PortMixer code in this commit but
chose not to because I want to save it for a later commit.

Signed-off-by: Avery King <avery98@pm.me>
2025-01-04 14:54:58 -08:00

47 lines
1.4 KiB
CMake

#[=======================================================================[.rst:
IsStaticLibrary
-------------
Macros to set a given variable to true or false whether the library is static.
This does not work on windows, because on windows we link always to a static
lib that loads either the dependent dlls as import library or contains the
functions itself. In this case this module returns FALSE.
Usage:
.. code-block:: cmake
is_static_library(<VAR> target)
Where ``<VAR>`` is set to TRUE if the target is a static library
Example invocation:
.. code-block:: cmake
is_static_library(LIB_IS_STATIC Lib::Lib)
#]=======================================================================]
macro(IS_STATIC_LIBRARY var target)
get_target_property(_target_type ${target} TYPE)
if(${_target_type} STREQUAL "STATIC_LIBRARY")
set(${var} TRUE)
elseif(${_target_type} STREQUAL "UNKNOWN_LIBRARY" AND NOT WIN32)
# Guess from file name. Does not work on windows, see https://gitlab.kitware.com/cmake/cmake/-/issues/17338.
get_target_property(_target_location ${target} LOCATION)
get_filename_component(_target_extension ${_target_location} EXT)
if(${_target_extension} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(${var} TRUE)
else()
set(${var} FALSE)
endif()
unset(_target_location)
unset(_target_extension)
else()
set(${var} FALSE)
endif()
unset(_target_type)
endmacro()