Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cheax

Pages: [1]
1
General / Re: Problem with SFML_DIR in CMake
« on: August 30, 2021, 09:41:12 pm »
never mind I needed to specify NO_DEFAULT_PATH

2
General / Problem with SFML_DIR in CMake
« on: August 30, 2021, 05:44:12 pm »
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?


Pages: [1]