You are not logged in.

#1 2018-04-03 09:08:33

quaker762
Member
Registered: 2018-04-03
Posts: 5

cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#2 2018-04-03 18:05:16

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#3 2018-04-03 22:44:47

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2018-04-04 06:22:26

quaker762
Member
Registered: 2018-04-03
Posts: 5

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

Lone_Wolf wrote:

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

#5 2018-04-12 21:15:26

r2p2
Member
Registered: 2011-10-15
Posts: 6

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#6 2018-04-12 21:24:38

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#7 2018-04-13 03:49:50

r2p2
Member
Registered: 2011-10-15
Posts: 6

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#8 2018-04-13 03:57:02

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#9 2018-04-13 04:02:24

r2p2
Member
Registered: 2011-10-15
Posts: 6

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#10 2018-04-13 04:17:55

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

*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

#11 2018-04-13 20:15:08

r2p2
Member
Registered: 2011-10-15
Posts: 6

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

#12 2018-04-17 04:35:38

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cmake can no longer find sdl2 2.0.8-6 (x86_64) include directories

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

Board footer

Powered by FluxBB