Use TARGET_INCLUDE_DIRECTORIES instead of INCLUDE_DIRECTORIES for SDL2, fixed MARK_AS...
authorIngo Ruhnke <grumbel@gmail.com>
Sun, 3 Aug 2014 18:42:33 +0000 (20:42 +0200)
committerIngo Ruhnke <grumbel@gmail.com>
Sun, 3 Aug 2014 18:42:33 +0000 (20:42 +0200)
CMakeLists.txt

index 5e82c27..676d2a4 100644 (file)
@@ -68,10 +68,7 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
 
 INCLUDE(FindPkgConfig)
 PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
-INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
-
 PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
-INCLUDE_DIRECTORIES(${SDL2IMAGE_INCLUDE_DIRS})
 SET(HAVE_SDL TRUE)
 
 OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
@@ -342,9 +339,12 @@ ADD_DEPENDENCIES(supertux2 gitversion)
 
 ## Link supertux binary with squirrel and other libraries
 
-TARGET_LINK_LIBRARIES(supertux2 squirrel)
+TARGET_INCLUDE_DIRECTORIES(supertux2 PUBLIC ${SDL2_INCLUDE_DIRS})
+TARGET_INCLUDE_DIRECTORIES(supertux2 PUBLIC ${SDL2IMAGE_INCLUDE_DIRS})
 TARGET_LINK_LIBRARIES(supertux2 ${SDL2_LIBRARIES})
 TARGET_LINK_LIBRARIES(supertux2 ${SDL2IMAGE_LIBRARIES})
+
+TARGET_LINK_LIBRARIES(supertux2 squirrel)
 TARGET_LINK_LIBRARIES(supertux2 ${OPENAL_LIBRARY})
 TARGET_LINK_LIBRARIES(supertux2 ${OGGVORBIS_LIBRARIES})
 TARGET_LINK_LIBRARIES(supertux2 ${PHYSFS_LIBRARY})
@@ -475,14 +475,13 @@ MARK_AS_ADVANCED(
 )
 
 MARK_AS_ADVANCED(
-       SDLMAIN_LIBRARY
-       SDL_INCLUDE_DIR
-       SDL_LIBRARY
+       SDL2_INCLUDE_DIRS
+       SDL2_LIBRARIES
 )
 
 MARK_AS_ADVANCED(
-       SDLIMAGE_INCLUDE_DIR
-       SDLIMAGE_LIBRARY
+       SDL2IMAGE_INCLUDE_DIRS
+       SDL2IMAGE_LIBRARIES
 )
 
 MARK_AS_ADVANCED(