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

Author Topic: Problem configuring csfml2 with cmake  (Read 33160 times)

0 Members and 1 Guest are viewing this topic.

Echtolion

  • Newbie
  • *
  • Posts: 1
    • View Profile
Problem configuring csfml2 with cmake
« on: March 26, 2011, 04:11:37 am »
I followed the tutorial to build SFML without issue(and installed it), however whenever I try to use cmake with csfml project I get the error


Code: [Select]
CMake Error at G:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find SFML (missing: SFML_INCLUDE_DIR SFML_SYSTEM_LIBRARY
  SFML_WINDOW_LIBRARY SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY
  SFML_AUDIO_LIBRARY) (Required is at least version "2")
Call Stack (most recent call first):
  G:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  G:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindSFML.cmake:105 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/SFML/CMakeLists.txt:22 (find_package)


I'm new to SFML so I'm probably missing something relatively obvious  :oops:

I looked all around and searched but couldn't find an answer for this.
On windows 7 64-bit.
This is from the latest SVN revision, BTW.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #1 on: March 26, 2011, 08:57:50 am »
You must create a CMake variable named SFMLDIR and which contains the path to your SFML installation (the directory which contains /include and /lib).

This, and more details, is explained in FindSFML.cmake
Laurent Gomila - SFML developer

computerquip

  • Newbie
  • *
  • Posts: 18
    • View Profile
Problem configuring csfml2 with cmake
« Reply #2 on: April 05, 2011, 02:30:07 pm »
Where would this file be located exactly?

I had to add each library name by hand. Not that big a deal but just saying. :/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #3 on: April 05, 2011, 03:26:26 pm »
Quote
Where would this file be located exactly?

Which file?
Laurent Gomila - SFML developer

computerquip

  • Newbie
  • *
  • Posts: 18
    • View Profile
Problem configuring csfml2 with cmake
« Reply #4 on: April 05, 2011, 03:34:17 pm »
FindSFML.cmake

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #5 on: April 05, 2011, 03:36:56 pm »
It's under SFML/cmake/Modules, and it installs automatically to your CMake installation when you install SFML 2.
Laurent Gomila - SFML developer

computerquip

  • Newbie
  • *
  • Posts: 18
    • View Profile
Problem configuring csfml2 with cmake
« Reply #6 on: April 05, 2011, 03:49:03 pm »
Okay, I'm confused apparently. When you move to build CSFML with Cmake, even if you hand define all of the library variables (despite defining the library directory or SFMLDIR which both didn't work and returned that the libraries weren't found), cmake doesn't generate anything for me. Am I missing something?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #7 on: April 05, 2011, 03:54:44 pm »
I can't guess what you did, tell me what commands you executed, what CMake variables you defined, with what values, tell me how/where SFML 2 is installed, etc. etc..
Laurent Gomila - SFML developer

computerquip

  • Newbie
  • *
  • Posts: 18
    • View Profile
Problem configuring csfml2 with cmake
« Reply #8 on: April 05, 2011, 03:58:46 pm »
Figured it out! Seems that I need to use static libraries, not dynamic which is why it couldn't find the libraries, etc. After building and moving them to SFMLDIR, all works fine.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #9 on: April 05, 2011, 04:10:49 pm »
Yes, sorry I forgot to mention that, CSFML links to SFML release static libraries.
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Problem configuring csfml2 with cmake
« Reply #10 on: May 05, 2011, 08:55:39 pm »
Dont want to make a new thread for basically same kind of problem.
Im trying to use CMake to create Codeblocks files using MinGW, however specifying the compiler as TCC but i get these errors

Quote

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:F:/tcc/c/build/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:F:/tcc/c/build/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!


I have also tried other options but they all still give errors

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #11 on: May 05, 2011, 11:09:38 pm »
The path to the gcc executable must be in the PATH environment variable so that CMake can find it.
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Problem configuring csfml2 with cmake
« Reply #12 on: May 06, 2011, 06:54:06 pm »
Quote from: "Laurent"
The path to the gcc executable must be in the PATH environment variable so that CMake can find it.


Where exactly do i find it?
I have lookes all over the gui and in the cmakelist but cant find anything

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #13 on: May 06, 2011, 07:21:55 pm »
I'm talking about the OS environment variables, which have nothing to do with CMake.

The best way is to add it locally, so that your global PATH is not polluted with your compiler path when you're not using CMake.

It is explained in the tutorial: open a console, and type the following command
Code: [Select]
set PATH=%PATH%;<mingw>/bin
Where <mingw> is the directory where you installed MinGW. Then, from the same console, launch cmake-gui
Code: [Select]
cmake-gui
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Problem configuring csfml2 with cmake
« Reply #14 on: May 07, 2011, 12:45:58 am »
Ahhh that worked great but now i get this error

Quote

CMake Error at src/SFML/CMakeLists.txt:22 (find_package):
  Could not find module FindSFML.cmake or a configuration file for package
  SFML.

  Adjust CMAKE_MODULE_PATH to find FindSFML.cmake or set SFML_DIR to the
  directory containing a CMake configuration file for SFML.  The file will
  have one of the following names:

    SFMLConfig.cmake
    sfml-config.cmake