Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
Check if SFML is installed
Print
Pages: [
1
]
Author
Topic: Check if SFML is installed (Read 2320 times)
0 Members and 1 Guest are viewing this topic.
Rhubarb
Newbie
Posts: 12
Check if SFML is installed
«
on:
June 23, 2024, 09:06:21 pm »
Hello, is there any #ifdef to check if libsfml-dev is installed? Thanks.
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11035
Re: Check if SFML is installed
«
Reply #1 on:
June 24, 2024, 08:58:09 am »
Not really.
If you use CMake to build your application, you could search for it with
find_package
, which should find it, if it's installed (whatever you definition of "installed" is).
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Garwin
Jr. Member
Posts: 59
Re: Check if SFML is installed
«
Reply #2 on:
June 24, 2024, 11:13:20 am »
You can use macros not exactly what you ask but still can help you to detect certain header file.
#if __has_include
https://en.cppreference.com/w/cpp/preprocessor/include
eg.:
#if __has_include("SFML/System/Vector2.hpp")
#include <SFML/System/Vector2.hpp>
#define has_sfVector 1
#else if
#define has_sfVector 0
#endif // __has_include("SFML/System/Vector2.hpp")
«
Last Edit: June 27, 2024, 07:44:13 am by Garwin
»
Logged
kojack
Sr. Member
Posts: 343
C++/C# game dev teacher.
Re: Check if SFML is installed
«
Reply #3 on:
June 26, 2024, 08:25:16 pm »
I use __has_include for exactly this. My vector maths class checks for SFML, Box2D and Imgui headers to add casting operators if the required headers are present.
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
Check if SFML is installed