@@ -588,7 +588,7 @@ if(NOT MINIAUDIO_NO_EXTRA_NODES)
588
588
589
589
if (MINIAUDIO_BUILD_EXAMPLES )
590
590
add_executable (miniaudio_${name}_node_example extras/nodes/ma_${name}_node/ma_${name}_node_example.c )
591
- target_link_libraries (miniaudio_${name}_node_example PRIVATE miniaudio_common_options )
591
+ target_link_libraries (miniaudio_${name}_node_example PRIVATE miniaudio_example )
592
592
endif ()
593
593
endfunction ()
594
594
@@ -600,12 +600,18 @@ if(NOT MINIAUDIO_NO_EXTRA_NODES)
600
600
endif ()
601
601
602
602
603
- # Interface with common options to simplify the setup of tests and examples. Note that we don't pass
604
- # in COMPILE_DEFINES here because want to allow the tests and examples to define their own defines. If
605
- # we were to use COMPILE_DEFINES here many of the tests and examples would not compile.
606
- add_library (miniaudio_common_options INTERFACE )
607
- target_compile_options (miniaudio_common_options INTERFACE ${COMPILE_OPTIONS} )
608
- target_link_libraries (miniaudio_common_options INTERFACE ${COMMON_LINK_LIBRARIES} )
603
+ # Interface for examples. Examples do not include COMPILE_OPTIONS because when compiling with things
604
+ # like MINIAUDIO_FORCE_C89, etc. it could sometimes result in warnings which would make automated
605
+ # build tools have unnecessarily messy output. Working around these errors would require us modifying
606
+ # the examples in ways where it would negatively affect its readablity.
607
+ add_library (miniaudio_example INTERFACE )
608
+ target_link_libraries (miniaudio_example INTERFACE ${COMMON_LINK_LIBRARIES} )
609
+
610
+ # Interface for tests. This includes our COMPILE_OPTIONS settings because we want tests to check for
611
+ # build errors with MINIAUDIO_FORCE_C89, etc.
612
+ add_library (miniaudio_test INTERFACE )
613
+ target_compile_options (miniaudio_test INTERFACE ${COMPILE_OPTIONS} )
614
+ target_link_libraries (miniaudio_test INTERFACE ${COMMON_LINK_LIBRARIES} )
609
615
610
616
# Tests
611
617
#
@@ -617,7 +623,7 @@ if(MINIAUDIO_BUILD_TESTS)
617
623
618
624
function (add_miniaudio_test name source )
619
625
add_executable (${name} ${TESTS_DIR} /${source} )
620
- target_link_libraries (${name} PRIVATE miniaudio_common_options )
626
+ target_link_libraries (${name} PRIVATE miniaudio_test )
621
627
if (TARGET miniaudio_pipewire )
622
628
target_link_libraries (${name} PRIVATE miniaudio_pipewire )
623
629
target_compile_definitions (${name} PRIVATE MA_TESTS_INCLUDE_PIPEWIRE )
@@ -654,11 +660,10 @@ if (MINIAUDIO_BUILD_EXAMPLES)
654
660
655
661
function (add_miniaudio_example name source )
656
662
add_executable (${name} ${EXAMPLES_DIR} /${source} )
657
- target_link_libraries (${name} PRIVATE miniaudio_common_options )
663
+ target_link_libraries (${name} PRIVATE miniaudio_example )
658
664
endfunction ()
659
665
660
666
add_miniaudio_example (miniaudio_custom_backend custom_backend.c )
661
- target_compile_options (miniaudio_custom_backend PRIVATE -Wno-declaration-after-statement )
662
667
663
668
add_miniaudio_example (miniaudio_custom_decoder_engine custom_decoder_engine.c )
664
669
if (HAS_LIBVORBIS )
0 commit comments