These overrides existed to prevent MSVC errors related to duplicate
compiler warnings. Because we required a version of CMake older
3.15, CMake would add /W3 as a default compiler flag when using
MSVC. We then add /W4 in addition to that. Modern CMake versions
seem to deduplicate these warnings but older versions did not.
The easist fix is to raise the minimum CMake version to 3.15 which
changes the default behavior to no longer add /W3 without being
explicitly specified. See the below link for more information about
this behavior change.
https://cmake.org/cmake/help/latest/policy/CMP0092.html
Ported sfml-pi DRM/KMS backend written by @mickelson
Port co-authored by @substring
Co-authored-by: Andrew Mickelson <andrew.mickelson@gmail.com>
Co-authored-by: Gil Delescluse <frog2wah@gmail.com>
The "main" component is not available everywhere, but passing it to the
find_package(SFML) call via the OPTIONAL_COMPONENTS still fails the call
on platforms like Linux.
This commit enables SFML to be used the same in a cross-platform fashion
without forcing consumers to put custom logic around importing SFML.
Example that works with this commit, but break before:
find_package(SFML REQUIRED graphics OPTIONAL_COMPONENTS main)
target_link_libraries(dummy PRIVATE SFML::graphics)
if(SFML_MAIN_FOUND)
target_link_libraries(dummy PRIVATE SFML::main)
endif()
The SFML target export set includes a number of external targets
which are not owned by the project itself. This includes targets
like Freetype and OpenGL. By specifying a namespace for the export
set, a SFML:: namespace was prepended to all targets. This is not
a problem when using shared libraries but when building and using
static libraries caused a problem where CMake was attempting and
failing to find targets with names like SFML::Freetype or
SFML::OpenGL which did not exist.
Luckily CMake allows you put namespaces in the EXPORT_NAME target
property so now we can just add the SFML:: namespace in the macro
which creates SFML targets and remove the `NAMESPACE SFML::` line
which was adding namespaces to all targets.
This removes the sfml- prefixed targets from the export set. The sfml-
prefixed targets are still available within the build tree but not to
downstream users thus making this an API breaking change when compared
to the 2.x releases. To keep things consistent, usage of the sfml-
targets were replaced with their namespaced counterparts.
This has a number of benefits:
1. It's more idiomatic. Modern CMake libraries are expected to
have namespaced targets.
2. Namespaced targets are less likely to collide with user-defined
targets. No one will accidentally define a SFML:: target.
3. If a namespaced target is not found by CMake, configuration
will immediately stop.
It's not necessary to re-specify cxx_std_17 since any example or test
which depends on a core target (which should be all of them) will pick
up this language requirement that should be a public property of those
targets. If that changes, these examples and tests will possibly fail
to compile and correctly catch the bug that was introduced in the core
library targets.
Unlike with SFML 2.x and earlier the version numbers are updated as soon
as work on the new release starts. This especially helps with version
checks, which until now caused issues with in-development version
matching the previous release.
- On Windows you can use Clang with both MSVC and MinGW
- When using Clang with MSVC all the MSVC conditions should be fulfilled
- When using Clang with MinGW all the MSVC steps should not be run
Windows uses a mechanism known as 'resource files' which provides, among
other things, metadata to a given executable/dll/driver/etc, and add a
layer of polish to a project which it would otherwise lack.