File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ if (WIN32)
1818 ARCHIVE DESTINATION ${DPP_INSTALL_LIBRARY_DIR}
1919 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2020 INCLUDES DESTINATION ${DPP_INSTALL_INCLUDE_DIR}
21- FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR } /dpp/include )
21+ FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR } /dpp/include )
2222 else ()
2323 install (TARGETS dpp
2424 EXPORT ${DPP_EXPORT_NAME}
3636 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBRARY_DIR}
3737 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
3838 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR}
39- FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR } /dpp/include )
39+ FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR } /dpp/include )
4040 else ()
4141 install (TARGETS dpp
4242 EXPORT ${DPP_EXPORT_NAME}
Original file line number Diff line number Diff line change 2828# libmpg123-dev
2929# dpp latest master with -DDPP_CORO=ON installed sytemwide
3030
31- cmake_minimum_required (VERSION 3.16 )
31+ cmake_minimum_required (VERSION 3.28 )
3232project (documentation_tests)
3333
3434string (ASCII 27 Esc)
3535
36- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDPP_CORO -DDPP_MODULES -std=c++20 -pthread -O0 -fPIC -DFMT_HEADER_ONLY -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter -Wno-deprecated-declarations" )
36+ option (DPP_MODULES "Build examples with C++20 modules support" ON )
37+
38+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDPP_CORO -std=c++20 -pthread -O0 -fPIC -DFMT_HEADER_ONLY -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter -Wno-deprecated-declarations" )
3739set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0" )
3840
3941file (GLOB example_list ./*.cpp)
4042foreach (example ${example_list} )
4143 get_filename_component (examplename ${example} NAME )
44+
4245 message (STATUS "Found example '${Esc} [1;34m${examplename}${Esc} [m'" )
4346 add_executable (${examplename} _out ${example} )
4447 target_link_libraries (${examplename} _out dl dpp mpg123 oggz ogg opusfile opus)
4548 include_directories (/usr/include /opus)
49+
50+ target_compile_definitions (${examplename} _out PRIVATE DPP_MODULES)
51+ set_target_properties (${examplename} _out PROPERTIES CXX_SCAN_FOR_MODULES ON )
52+
53+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
54+ target_compile_options (${examplename} _out PRIVATE -fmodules-ts)
55+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
56+ target_compile_options (${examplename} _out PRIVATE -fmodules)
57+ endif ()
4658endforeach (example)
You can’t perform that action at this time.
0 commit comments