So I have a project that uses SFML and it compiles fine when my CMakeLists.txt is like this:
find_package(SFML 2.5.1
COMPONENTS
system window graphics network audio REQUIRED)
target_link_libraries(Spark sfml-graphics sfml-audio)
Since I have SFML installed on my system (Ubuntu). But I'm trying to set it up using SFML_DIR, since I have SFML library included in the project structure in case the user doesnt have it installed on their system or if it's out of date. I tried this:
set(SFML_DIR ${PROJECT_SOURCE_DIR}/libs/SFML/cmake/)
target_include_directories(Spark PRIVATE ${PROJECT_SOURCE_DIR}/libs/SFML/include/)
However it got me an error message like this:
undefined reference to symbol '_ZN2sf6Window9pollEventERNS_5EventE'
I also tried using both find_package() and set(SFML_DIR...) however the package always overwrote the SFML_DIR value. I tested it on another Windows 10 system where after set() and target_include_directories() (but find_package() commented out) still couldnt find 'sfml-graphics'.
How do I guarantee my included version of SFML is being used regardless of what system the project is being compiled on?