1
General / Re: How do you use the FindSFML.cmake CMake module?
« on: April 08, 2012, 06:29:36 pm »
Thank you!
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.
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:#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:[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