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 - plutgamer

Pages: [1]
1
General / Re: How do you use the FindSFML.cmake CMake module?
« on: April 08, 2012, 06:29:36 pm »
Thank you!  :D

2
General / How do you use the FindSFML.cmake CMake module?
« on: April 08, 2012, 05:44:20 pm »
I'm working on a project, so I have to have somekind of building platform.
So I choose CMake.
I found the FindSFML.cmake module here: https://github.com/SFML/SFML/blob/master/cmake/Modules/FindSFML.cmake.
And I found this: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries to use the module.
But the problem is, I don't know how to use the module, I tried it with the standard way listed on the page, but it gave an undefined resource error.

code:
CMakeLists.txt:
Code: [Select]
cmake_minimum_required (VERSION 2.6)
project (hello)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
find_package(SFML REQUIRED)
include_directories(${SFML_INCLUDE_DIR})
set(LIBS ${LIBS} ${SFML_SYSTEM_LIBRARY})
add_executable (hello hello.cxx)
target_link_libraries(hello ${LIBS})
hello.cxx:
Code: [Select]
#include <iostream>
#include <SFML/System.hpp>

int main()
{
    /*sf::Clock Clock;
    while (Clock.GetElapsedTime() < 5.f)
    {
        std::cout << Clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }*/

    return 0;
}
Console output:
Code: [Select]
[stijn@vaio bin]$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Found SFML: /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stijn/devel/cmaketest/bin
[stijn@vaio bin]$ make
Scanning dependencies of target hello
[100%] Building CXX object CMakeFiles/hello.dir/hello.cxx.o
Linking CXX executable hello
CMakeFiles/hello.dir/hello.cxx.o: In function `main':
hello.cxx:(.text+0x10): undefined reference to `sf::Clock::Clock()'
hello.cxx:(.text+0x1e): undefined reference to `sf::Clock::GetElapsedTime() const'
hello.cxx:(.text+0x42): undefined reference to `sf::Sleep(float)'
hello.cxx:(.text+0x4e): undefined reference to `sf::Clock::GetElapsedTime() const'
collect2: ld gaf exit-status 1 terug
make[2]: *** [hello] Fout 1
make[1]: *** [CMakeFiles/hello.dir/all] Fout 2
make: *** [all] Fout 2

Sorry for it being half in dutch, and yes it's a Sony VAIO.
CMake says everything is perfect. But when I use make to actually compile it, it gives the undefined resource error.  :'(

Platform info:
Fedora Linux 16 x64
CMake
GNU Make
And g++

Sorry for being such a noob! :P

Pages: [1]
anything