FS#57972 - [sdl2] CMake Config not exported properly

Attached to Project: Arch Linux
Opened by Guillaume Racicot (gracicot) - Monday, 26 March 2018, 16:44 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Thursday, 29 March 2018, 19:02 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: SDL2 exports a cmake config file that allows other CMake projects to use SDL2

Right now, a cmake configuration is installed but incomplete. The new files generated by SDL2's CMakeLists.txt are more up to date and reflect the latest changes from SDL2.

When installing SDL2, we should observe the following installed files:

- /usr/lib/cmake/SDL2/SDL2Config.cmake
- /usr/lib/cmake/SDL2/SDL2ConfigVersion.cmake
- /usr/lib/cmake/SDL2/SDL2Targets.cmake
- /usr/lib/cmake/SDL2/SDL2Targets-noconfig.cmake

I attached the cmake config file for a typical SDL2 installation when building it with cmake.

Additional info:
* Version 2.0.8

Steps to reproduce:
Install package
Notice the lack of cmake config
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Thursday, 29 March 2018, 19:02 GMT
Reason for closing:  Fixed
Comment by Frank Secilia (fsecilia) - Thursday, 29 March 2018, 07:15 GMT
  • Field changed: Percent Complete (100% → 0%)
Importing now errors out trying to find /usr/lib/libSDL2.a:

CMake Error at /usr/lib64/cmake/SDL2/SDL2Targets.cmake:97 (message):
The imported target "SDL2::SDL2-static" references the file

"/usr/lib/libSDL2.a"

but this file does not exist. Possible reasons include:

* The file was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and contained

"/usr/lib64/cmake/SDL2/SDL2Targets.cmake"

but not all the files it references.

Call Stack (most recent call first):
/usr/lib64/cmake/SDL2/SDL2Config.cmake:1 (include)
tools/build/cmake/common_deps.cmake:34 (find_package)
CMakeLists.txt:25 (include)


Either SDL2Targets.cmake must be patched to remove this reference, or this package must ship /usr/lib/libSDL2.a.
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 29 March 2018, 12:32 GMT
Try now.
Comment by Frank Secilia (fsecilia) - Thursday, 29 March 2018, 15:02 GMT
That's closer, but there's a typo:

CMake Error at /usr/lib64/cmake/SDL2/SDL2Targets.cmake:97 (message):
The imported target "SDL2::SDL2main" references the file

"/usr/lib/libSDL2main.ain.a"

but this file does not exist. Possible reasons include:

* The file was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and contained

"/usr/lib64/cmake/SDL2/SDL2Targets.cmake"

but not all the files it references.

Call Stack (most recent call first):
/usr/lib64/cmake/SDL2/SDL2Config.cmake:1 (include)
tools/build/cmake/common_deps.cmake:34 (find_package)
CMakeLists.txt:25 (include)


-- Configuring incomplete, errors occurred!
See also "/home/fsecilia/dev/builds/voodoo/gcc/debug/CMakeFiles/CMakeOutput.log".
See also "/home/fsecilia/dev/builds/voodoo/gcc/debug/CMakeFiles/CMakeError.log".

I attached a patch for it, but it's probably easier just to edit the file.
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 29 March 2018, 16:16 GMT
Sorry, please try again.
Comment by Guillaume Racicot (gracicot) - Thursday, 29 March 2018, 16:40 GMT
Worked for me! Thanks for the support.
Comment by Frank Secilia (fsecilia) - Thursday, 29 March 2018, 16:51 GMT
Op, that passes the cmake step and projects compile, but they don't link because SDL2_LIBRARIES is empty.

I've attached a minimal project test whether finding the package, compiling, linking, and running succeed. It has a small readme and script to execute.
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 29 March 2018, 17:04 GMT
Not sure what the problem is there. Can you check what would be the packaging problem with the current set of cmake files installed by the sdl2 package?
Comment by Guillaume Racicot (gracicot) - Thursday, 29 March 2018, 18:12 GMT
liking SDL2 was not a problem for me. I used

find_package(SDL2 REQUIRED)
target_link_libraries(example PUBLIC SDL2::SDL2)

I had to install ibus however. Is this a new dependency? Looking at the `SDL2Targets-noconfig.cmake` It adds `ibus-1.0` as link dependency. Removing the flag or installing ibus bith have worked for me.
Comment by Frank Secilia (fsecilia) - Thursday, 29 March 2018, 18:53 GMT
Op, I was using the older way of building against SDL using the variables for the include path and libs, neither of which are set with the new config. Changing to what gracicot used fixed this for me. False alarm. Everything is working now. Thanks!

Loading...