Skip to content

Commit

Permalink
boards/posix: Handle SDL2 compile vars with multiple values
Browse files Browse the repository at this point in the history
When transforming SDL2_LIBRARIES and SDL2_INCLUDE_DIRS into compile
options, each member needs to be preceeded by -l or -I. Use the cmake
list(TRANFORM) operation to prepend the flag to each list element instead
of just prepending the flag to the entire list.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Dec 29, 2023
1 parent aa44166 commit c3ae892
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions boards/posix/common/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ if (CONFIG_NATIVE_APPLICATION)
zephyr_include_directories(${SDL2_INCLUDE_DIRS})
zephyr_compile_options(${SDL2_CFLAGS_OTHER})
else()
target_link_options(native_simulator INTERFACE "-l${SDL2_LIBRARIES}")
target_compile_options(native_simulator INTERFACE "-I${SDL2_INCLUDE_DIRS}" ${SDL2_CFLAGS_OTHER})
list(TRANSFORM SDL2_LIBRARIES PREPEND "-l" OUTPUT_VARIABLE SDL2_LIBRARIES_OPTION)
target_link_options(native_simulator INTERFACE "${SDL2_LIBRARIES_OPTION}")
list(TRANSFORM SDL2_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE SDL2_INCLUDE_DIRS_OPTION)
target_compile_options(native_simulator INTERFACE "${SDL2_INCLUDE_DIRS_OPTION}" ${SDL2_CFLAGS_OTHER})
endif()

zephyr_library_sources(sdl_events.c)
Expand Down

0 comments on commit c3ae892

Please sign in to comment.