How to compile on Ububtu
Opened this issue · 5 comments
Hi,
I'm trying to compile CSFML under Ubuntu, can anyone help with what i am doing wrong?
git clone https://github.com/SFML/CSFML
cd CSFML
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON ..
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jj/CSFML/build
then I do:
$ make
CMake Error at src/SFML/CMakeLists.txt:24 (find_package):
By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SFML", but
CMake did not find one.
Could not find a package configuration file provided by "SFML" (requested
version 2) with any of the following names:
SFMLConfig.cmake
sfml-config.cmake
Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or set
"SFML_DIR" to a directory containing one of the above files. If "SFML"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/home/jj/CSFML/build/CMakeFiles/CMakeOutput.log".
make: *** [Makefile:252: cmake_check_build_system] Error 1
Thank you in advance for your help!
Try using the graphical cmake and follow this (c++ follows same build steps as csfml).
https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php
If a problem still occurs let me know.
Remember to export the environment variables, this has been a problem with my builds.
The graphic cmake did not do this...
$ cmake -L
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
CMake Error: The source directory "/home/jj/CSFML/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
-- Cache values
BUILD_SHARED_LIBS:BOOL=ON
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CSFML_BUILD_DOC:BOOL=OFF
CSFML_LINK_SFML_STATICALLY:BOOL=OFF
SFML_DIR:PATH=SFML_DIR-NOTFOUND
How is this supposed to be set?
SFML_DIR:PATH=SFML_DIR-NOTFOUND
If you use the command line you'd add it to the cmake call with -DSFML_DIR=/path/to/SFML/...
The situation became a little brighter:
-
sudo apt-get install libsfml-dev
-
git clone https://github.com/SFML/CSFML
-
According to the comments on this issue
BUILD_SHARED_LIBS:BOOL=TRUE
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CSFML_BUILD_DOC:BOOL=FALSE
CSFML_LINK_SFML_STATICALLY:BOOL=FALSE
SFML_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/SFML
SFML_DOC_DIR:PATH=SFML_DOC_DIR-NOTFOUND
We managed to do it, but let me say frankly that it is not exactly written anywhere, best regards.