[Ubuntu 20.04][Cmake] SDL2::SDL2 target was not found
Created by: pavel-rodionov
Describe the bug I'm trying to build OpenXray on Ubuntu 20.04. While SDL2 library is installed on my machine:
$ sudo apt-get install libsdl2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsdl2-dev is already the newest version (2.0.10+dfsg1-3).
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
Cmake fails with:
Target "xrCore" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Desktop (please complete the following information):
- OS: Ubuntu 20.04.6 LTS
- Cmake 3.28.1
- OpenXRay
dev
branch
Additional context
- May be related to #1535
- Build from branch
2188-november-2023-rc1
works fine
Full Cmake logs
$ cmake ..
-- CMAKE_VERSION: 3.28.1
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_VERBOSE_MAKEFILE: FALSE
-- git commit: be53de4e2217b7e52be76d7d371e9d34791a1789
-- git branch: dev
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- CMAKE_BUILD_TYPE: Release
-- MASTER_GOLD: ON
-- STATIC_BUILD: ON
-- CMAKE_UNITY_BUILD: OFF
-- USE_ADDRESS_SANITIZER: OFF
-- USE_LTO: ON
-- Performing Test GOLD_LINKER_AVAILABLE
-- Performing Test GOLD_LINKER_AVAILABLE - Success
-- Performing Test LLD_LINKER_AVAILABLE
-- Performing Test LLD_LINKER_AVAILABLE - Success
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLEW: /usr/include (found version "2.1.0")
-- Found OpenAL: /usr/lib/x86_64-linux-gnu/libopenal.so
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Found Ogg: /usr/lib/x86_64-linux-gnu/libogg.so
-- Found Vorbis: /usr/lib/x86_64-linux-gnu/libvorbis.so
-- Found Theora: /usr/lib/x86_64-linux-gnu/libtheora.so
-- Found LZO: /usr/lib/x86_64-linux-gnu/liblzo2.so
-- Could NOT find mimalloc (missing: mimalloc_DIR)
Using standard memory allocator
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
rm -f luajit libluajit.a libluajit.so host/minilua host/buildvm lj_vm.S lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h host/buildvm_arch.h jit/vmdef.lua *.o host/*.o *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
-- Configuring done (1.6s)
CMake Error at src/xrCore/CMakeLists.txt:444 (target_link_libraries):
Target "xrCore" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done (0.4s)
CMake Generate step failed. Build files cannot be regenerated correctly.