You are not logged in.
Hi,
After upgrading SDL2 to 2.0.8-6 from 2.0.8-1, cmake can no longer find the include directories. The error encountered is:
CMake Error at source/CMakeLists.txt:16 (include_directories):
include_directories given empty-string as include directory.
where the offending file is here
I've confirmed it's the package by running
pacman -U /var/cache/pacman/pkg/sdl2 2.0.8-1-x86_64.pkg.tar.gz
and rerunning cmake, which allows the build files to be created and used.
Cheers,
quaker762
Offline
Did you notice sdl2 2.0.8-2 later are build with cmake rather then ./configure in 2.0.8-1 ?
It seems weird that sdl2 switching to cmake gives problems for other programs that use cmake.
<irony off>
Which program do you get the cmake error from ?
Last edited by Lone_Wolf (2018-04-03 18:05:43)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Offline
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Did you notice sdl2 2.0.8-2 later are build with cmake rather then ./configure in 2.0.8-1 ?
It seems weird that sdl2 switching to cmake gives problems for other programs that use cmake.
<irony off>Which program do you get the cmake error from ?
Haha, I didn't even realise that.
I'm getting the error from SILENT HILL 3: Redux. It's my own project, and it's been fine for the past 18 months, so someone's changed something that's causing an incompatibility..
We're already using ${SDL2_INCLUDE_DIRS}, that guy was trying it without the 'S' in the string.
Cheers,
quaker762
Offline
I am not sure if I have the same issue since the package was updated some hours ago and on the #57790 ticket says it would be closed since it is upstream.
But if I use this Makefile:
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(main VERSION 0.0.1 LANGUAGES CXX)
find_package(SDL2 REQUIRED)
add_executable(main
main.cc
)
To build this program:
int main() { return 0; }
And I call
mkdir build && cd build && cmake ..
Then the only sdl2 related variable cmake sets is SDL2_DIR containing "/usr/lib64/cmake/SDL2"
That was working some weeks ago.
Offline
How do you know it isn't setting it? It would only be visible inside the CMake process, not in CMakeCache.txt
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Are you sure about that? I've seen these variables set in other instances. Nevertheless, I would deduce that they are not set since my (actual) project can't find references to sdl functions and there I've tried to use SDL2_LIBRARY and SDL2_LIBRARIES in target_link_libraries which are empty. And I've added output commands to my example CMakeLists.txt after you made me uncertain. The output is also empty.
Offline
Well, I'm not saying it has to exist, merely that CMakeCache.txt only stores the persistent cache variables which aren't necessarily everything (and in this case are likely expected to be read from the FindFoo.cmake file during the running cmake process). At least if I remember correctly... there's two different types of variables depending on how "persistent" they are.
As for finding the functions, SDL2_LIBRARIES wouldn't even help you if you're still in the "compile a bunch of *.o intermediate objects" stage... did you remember to also include the headers? Are you sure you're using the new variable name for that?
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Uh? They use new variable names?
Thats my actual CMakeLists.txt
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(yagbe VERSION 0.0.1 LANGUAGES CXX)
set(DEBUG_CPU "enable cpu debug output" CACHE BOOL OFF)
find_package(SDL2 REQUIRED)
string (STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
set(SOURCE_FILES
src/main.cc)
add_executable(yagbe
${SOURCE_FILES})
if (DEBUG_CPU)
target_compile_definitions(yagbe PRIVATE -DDEBUG_CPU)
endif()
target_include_directories(yagbe SYSTEM
PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(yagbe
PRIVATE ${SDL2_LIBRARIES})
Offline
*is too sleepy for this*
The bugreport was kinda sorta about that, except (looking again) I guess it actually depends on which sdl version you use.
I don't *think* our packages are doing anything weird, anyway... so I dunno why it wouldn't work. AFAIK the only recent change was cmake anyway... but cmake is weird. What variables do the *.cmake file you're loading with find_package contain, anyway?
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
You may call me stupid. It works if I use the line which is actually listed in the linked ticket:
target_link_libraries(yagbe PUBLIC SDL2::SDL2)
instead of my
target_link_libraries(yagbe PRIVATE ${SDL2_LIBRARIES})
Now I just don't know how and why it works and if this is the new thing in cmake which I did not hear about since we use debian at work where everything is a bit older. But the variable thing was used since ages and it was working fine. Kids these days have to change everything. ^^
Offline
Oh BTW does this work now? https://bugs.archlinux.org/task/58168
Also since SDL2 uses INTERFACE_INCLUDE_DIRECTORIES you should probaably just link the found package instead of variables.
Last edited by eschwartz (2018-04-17 04:36:53)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline