Commit 2021a109272f6c4319ca104a9a9ff0533ccde430

Simon McVittie 2022-05-03T20:37:03

cmake: Defer test subproject until after defining install/uninstall It looks as though something in the test subproject "leaks" into the main build system, causing us to try to install ${builddir}/test/sdl2.pc instead of the correct ${builddir}/sdl2.pc. Moving the tests subproject further down avoids this. Resolves: https://github.com/libsdl-org/SDL/issues/5604 Signed-off-by: Simon McVittie <smcv@collabora.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76978aa..49850fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2965,7 +2965,6 @@ if(SDL_TEST)
   include_directories(AFTER "${SDL2_SOURCE_DIR}/include")
   file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c)
   add_library(SDL2_test STATIC ${TEST_SOURCES})
-  add_subdirectory(test)
 endif()
 
 ##### Installation targets #####
@@ -3091,3 +3090,8 @@ if(NOT SDL2_DISABLE_UNINSTALL)
   endif()
 endif()
 
+##### Tests subproject (must appear after the install/uninstall targets) #####
+
+if(SDL_TEST)
+  add_subdirectory(test)
+endif()