Open J-Vernay opened 6 months ago
The same happens for private include directories.
This can be reproduced with SDL 2.30.3 where "-I..\subprojects\sdl2\src\video\khronos"
is in the final compiler flags but the only public include directories are:
target_include_directories(SDL2-static PUBLIC
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>"
)
(the SDL2 wrap for that version has the same issue)
Describe the bug When importing a CMake target as a dependency, private link options are passed to the executable linking with this dependency.
To Reproduce Extract bug.zip on a Windows machine.
mytest
is a CMake project generating a shared library compiled with /NODEFAULTLIB . Domeson setup build
.Notice that in the generated file
build\subprojects\mytest\meson.build
, the dependency is declared as:(whereas in CMakeLists.txt, there was
target_link_options(mytest PRIVATE /NODEFAULTLIB)
)When doing
meson compile -C build -v
,main
executable is linked with /NODEFAULTLIB .Expected behavior main.exe should not link with /NODEFAULTLIB .
system parameters
Note: this bug occurs with SDL3, where SDL3-shared is linked with /NODEFAULTLIB on Windows.