You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you aren't aware, a bit later than modern C++ happened, modern CMake happened. Just like C++ it also kept backwards compatibilty but there are much better ways to do things now. Specifically:
This code currently uses old directory-based flags, which do not work well in modern CMake. As of now, any library should be used like this:
target_link_libraries(my_project PUBLIC SDL2pp)
...and nothing more. In modern CMake this single command (with new keywords: PRIVATE (build requirement) /INTERFACE (usage requirement) / PUBLIC (both)) will forward all transitive requirements of the dependency: include paths, compiler options, linker flags and so on. The requirement for this is that the target is also defined this way:
add_library(SDL2pp ...)
target_sources(SDL2pp PRIVATE ...) # sourcestarget_sources(SDL2pp PUBLIC ...) # headerstarget_include_directories(SDL2pp PUBLIC ...)
target_compile_options(SDL2pp PRIVATE ...)
target_*(SDL2pp PUBLIC/PRIVATE ...) # and so on...
In other words, modern CMake projects do not want variables - they want targets they can link to. This is especially true for libraries that may want to use subrepository approach, which can not work in the old system.
I could make a PR for this but note: this will raise minimum required CMake version.
The text was updated successfully, but these errors were encountered:
If you aren't aware, a bit later than modern C++ happened, modern CMake happened. Just like C++ it also kept backwards compatibilty but there are much better ways to do things now. Specifically:
libSDL2pp/CMakeLists.txt
Lines 203 to 209 in a02d5a8
This code currently uses old directory-based flags, which do not work well in modern CMake. As of now, any library should be used like this:
...and nothing more. In modern CMake this single command (with new keywords:
PRIVATE
(build requirement) /INTERFACE
(usage requirement) /PUBLIC
(both)) will forward all transitive requirements of the dependency: include paths, compiler options, linker flags and so on. The requirement for this is that the target is also defined this way:In other words, modern CMake projects do not want variables - they want targets they can link to. This is especially true for libraries that may want to use subrepository approach, which can not work in the old system.
I could make a PR for this but note: this will raise minimum required CMake version.
The text was updated successfully, but these errors were encountered: