DEADSOFTWARE

Use `find_package` to find SDL dependency
authorAlexey Aleshkov <djmadcat@gmail.com>
Sun, 10 Dec 2017 11:01:04 +0000 (14:01 +0300)
committerAlexey Aleshkov <djmadcat@gmail.com>
Sun, 10 Dec 2017 11:01:04 +0000 (14:01 +0300)
src/CMakeLists.txt

index eb576502cbd1a5f3e7ca5f23568d5534e04b979e..c306571ba5e55d209cc5bcdef9300248ebaf6a15 100644 (file)
@@ -1,26 +1,25 @@
 cmake_minimum_required( VERSION 2.6 )
+
 set( BIN doom2d )
 project( ${BIN} )
+
 set( SOURCE_ROOT ../src )
+
+find_package(SDL REQUIRED)
+find_package(SDL_mixer REQUIRED)
+
 aux_source_directory( ${SOURCE_ROOT} SOURCES )
+
 include_directories( "${SOURCE_ROOT}"
-                       "/usr/include"
-                       "/usr/include/SDL" )
+        "${SDL_INCLUDE_DIR}"
+        "${SDLMIXER_INCLUDE_DIR}" )
+
 set( INSTALL_PATH /usr/local/bin/ )
-set( REQUIRED_LIBRARIES 
-                       SDL
-                       SDL_mixer )
+
 set( CMAKE_CXX_FLAGS "-O2 -Wall -MMD -MP -MF" ) 
+
 add_executable( ${BIN} ${SOURCES} )
 
-target_link_libraries( ${BIN} ${REQUIRED_LIBRARIES} )
+target_link_libraries( ${BIN} "${SDL_LIBRARY}" "${SDLMIXER_LIBRARY}" )
+
 install( TARGETS ${BIN} DESTINATION ${INSTALL_PATH} )