Fix the include path in the installed CMake target import file

Previously the include path was {INSTALL_PREFIX}/include,
it is now {INSTALL_PREFIX}/include/SDL2 to be consistent with
the other build and package configuration systems.

Fixes #4128.
This commit is contained in:
Bastien Bouclet 2018-04-11 06:16:23 +02:00
parent 6b5ed0fd49
commit 9856d96777

View File

@ -1695,7 +1695,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
# Always build SDLmain # Always build SDLmain
add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
target_include_directories(SDL2main PUBLIC $<INSTALL_INTERFACE:include>) target_include_directories(SDL2main PUBLIC $<INSTALL_INTERFACE:include/SDL2>)
set(_INSTALL_LIBS "SDL2main") set(_INSTALL_LIBS "SDL2main")
if (NOT ANDROID) if (NOT ANDROID)
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
@ -1724,7 +1724,7 @@ if(SDL_SHARED)
endif() endif()
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2 PUBLIC $<INSTALL_INTERFACE:include>) target_include_directories(SDL2 PUBLIC $<INSTALL_INTERFACE:include/SDL2>)
if (NOT ANDROID) if (NOT ANDROID)
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
endif() endif()
@ -1750,7 +1750,7 @@ if(SDL_STATIC)
# libraries - do we need to consider this? # libraries - do we need to consider this?
set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2-static PUBLIC $<INSTALL_INTERFACE:include>) target_include_directories(SDL2-static PUBLIC $<INSTALL_INTERFACE:include/SDL2>)
if (NOT ANDROID) if (NOT ANDROID)
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
endif() endif()