From 1d624aa5730adcccf846267de76b13285bc65fed Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 16 Feb 2020 00:08:36 -0800 Subject: [PATCH] Further improvements for bug 4128 - CMAKE: Generated target import file contains incorrect include path Mohamed It would be useful to be able to do either `#include "SDL2/SDL.h"` or `#include "SDL.h"`. This patch allows that and adds compatibility with other build systems. It also allows differentiating between SDL1 and SDL2. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f18ec8b61..5794911ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2028,7 +2028,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") # Always build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) -target_include_directories(SDL2main PUBLIC "$" $) +target_include_directories(SDL2main PUBLIC "$" $ $) set(_INSTALL_LIBS "SDL2main") if (NOT ANDROID) set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") @@ -2063,7 +2063,7 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 PUBLIC "$" $) + target_include_directories(SDL2 PUBLIC "$" $ $) if (NOT ANDROID) set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() @@ -2109,7 +2109,7 @@ if(SDL_STATIC) # libraries - do we need to consider this? set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2-static PUBLIC "$" $) + target_include_directories(SDL2-static PUBLIC "$" $ $) if (NOT ANDROID) set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif()