| Summary: | Set the BUILD_INTERFACE PUBLIC header directory so users don't have to set it in their CMake code | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Steve Robinson <ssrobins> |
| Component: | build | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.8 | ||
| Hardware: | x86 | ||
| OS: | Windows 10 | ||
| Attachments: | Modified SDL2 CMakeLists.txt file | ||
Fixed in SDL 2.0.12, thanks! |
Created attachment 3260 [details] Modified SDL2 CMakeLists.txt file I build my program with CMake and add the SDL2 source subdirectory to build it at the same time. When I add SDL2 to the target_link_libraries of my program target, I get this error: cannot open source file "SDL.h" I can add the SDL2 include directory in my program target include directories, but if I add a PUBLIC target_include_directories directory into the SDL2 CMake code that setting will propagate to any target that uses the library. I made the following modification to the target_include_directories commands in the SDL2 CMakeLists.txt file: target_include_directories(SDL2 PUBLIC $<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) target_include_directories(SDL2-static PUBLIC $<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) The CMakeLists.txt file with these changes and the changes from my other build bugs is attached. Verified this works on Windows, Linux, Mac, iOS, and Android.