HackerPoet / MarbleMarcher

A Fractal Physics Game
GNU General Public License v2.0
2.48k stars 168 forks source link

cmake: Use encapsulated + transitive target linking #39

Open eacousineau opened 5 years ago

eacousineau commented 5 years ago

I believe this might be one way to Resolve #6

Without this patch, compilation fails saying either (a) it can't find the SFML libraries or (b) if you have libsfml-dev installed, it finds the (incompatible older) dist library. Doing make VERBOSE=1 indicates that the include dirs weren't propagating, so this worked for my CMake version (3.10.2, from apt).

My steps for compiling on Ubuntu 18.04:

# Prereqs: Mebbe some others needed.
sudo apt install libfreetype6-dev libx11-dev libxrandr-dev libudev-dev libflac-dev libogg-dev libvorbis-dev libopenal-dev

# Build SFML from source, install to local place.
git clone https://github.com/SFML/SFML.git 2.5.1
( set -eux;
  cd SFML
  mkdir build && cd build
  cmake .. -DCMAKE_INSTALL_PREFIX=~./local/opt/sfml/2.5.1
  make -j  X install
)

# Build this project.
git clone https://github.com/HackerPoet/MarbleMarcher
cd MarbleMarcher
( set -eux;
  mkdir build && cd build
  cmake .. -DCMAKE_PREFIX_PATH=~./local/opt/sfml/2.5.1
  make -j X
)

# Enjoy the psychadelics :)
./build/MarbleMarger
# ... and get lost in Hole-in-One :P