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

Author Topic: SFML works in XCode, but can't get CMake to work  (Read 1375 times)

0 Members and 1 Guest are viewing this topic.

prewk

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
SFML works in XCode, but can't get CMake to work
« on: January 01, 2015, 04:20:27 pm »
Hi!

I've installed SFML 2.2 on my Mac OS X Yosemite, and can successfully compile and run the XCode template application.

I want to set up a project with CMake instead and used the example files here: https://github.com/SFML/SFML/wiki/Tutorial:-Build-your-SFML-project-with-CMake

These are those files in a little repo:
https://github.com/prewk/sfml-boilerplate

When i run "make" I get the following output (and error):

Quote
$ make
Scanning dependencies of target myproject
[100%] Building CXX object CMakeFiles/myproject.dir/main.cpp.o
Linking CXX executable myproject
ld: framework not found sfml-system
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [myproject] Error 1
make[1]: *** [CMakeFiles/myproject.dir/all] Error 2
make: *** [all] Error 2

It can't seem to find the framework files.

I've put the framework and extlibs dirs into /Library/Framework, the libs into /usr/local/lib, and the includes into /usr/local/include

I might add that I can successfully compile SDL2 without problems, where the files are in /usr/local/lib and /usr/local/include (installed via brew).

Halp!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML works in XCode, but can't get CMake to work
« Reply #1 on: January 02, 2015, 09:35:50 am »
I haven't used CMake for that in such a long time that I don't remember how it works.. but you can maybe try to remove the frameworks (and use only dylibs). Maybe that require a flag in the script? Maybe there's something wrong with the search path too... idk
SFML / OS X developer

prewk

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: SFML works in XCode, but can't get CMake to work
« Reply #2 on: January 02, 2015, 10:36:15 am »
Thanks for trying!

I solved the problem. I ran "brew doctor" to get any clues as to what was wrong with my system, and found out that brew thought my XCode was too old (it isn't).
As a remedy I downloaded the latest Command Line Tools from the Apple Developer website, and after installing them manually like that my problems were solved.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML works in XCode, but can't get CMake to work
« Reply #3 on: January 02, 2015, 11:51:07 am »
Great!

BTW, I'm not sure you're using it, but the brew formula is not perfect and have been reported as such long time ago but the maintainer (not me) didn't care and no fix was provided and everything was sadly forgotten. So if you're using the brew formula, consider installing SFML manually instead.
SFML / OS X developer

prewk

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: SFML works in XCode, but can't get CMake to work
« Reply #4 on: January 02, 2015, 03:11:33 pm »
Yeah I'm actually not using the formula since it is outdated for OS X Yosemite, I've installed everything manually.

I (desperately) tried "brew doctor" since it might give clues about if something's wrong with compiling in the system. And it did. :)