Grumbel / sdl-jstest

Simple SDL joystick test application for the console
GNU General Public License v3.0
55 stars 31 forks source link

cmake issue building on OS X #5

Closed jmtd closed 8 years ago

jmtd commented 8 years ago

On OS X, I need to apply the following to get things to build

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47e5e1a..0c75d53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ if(WERROR)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
 endif()

+link_directories("/usr/local/lib")
 add_executable(sdl2-jstest sdl2-jstest.c)
 target_link_libraries(sdl2-jstest ${SDL2_LIBRARIES} ${CURSES_LIBRARIES})
 target_include_directories(sdl2-jstest PUBLIC ${SDL2_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR})

I don't really know much cmake-fu, but the above is obviously not suitable for committing. I have sdl2 via brew, and pkg-config outputs the correct arguments for the linker:

$ brew info sdl2
sdl2: stable 2.0.4 (bottled), HEAD
Low-level access to audio, keyboard, mouse, joystick, and graphics
https://www.libsdl.org/
/usr/local/Cellar/sdl2/2.0.3 (75 files, 3.7M)
  Poured from bottle
/usr/local/Cellar/sdl2/2.0.4 (82 files, 3.9M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/sdl2.rb
==> Options
--universal
    Build a universal binary
--HEAD
    Install HEAD version
$ pkg-config --libs sdl2
-L/usr/local/lib -lSDL2

Not sure if the fault is in your CMakeLists.txt file or in whatever package provides the Cmake helpers for SDL2 (perhaps SDL2-via-brew itself?)

jmtd commented 8 years ago

Cool, thanks!