Skip to content

Commit 406decc

Browse files
Conan-Kudoslouken
authored andcommitted
cmake: Rewire and simplify project versioning
As we've decided that the emulated SDL version will be the project version for sdl12-compat, unify and simplify the versioning constructs throughout the project so we only have to deal with versioning in one place.
1 parent fede2ff commit 406decc

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

CMakeLists.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
cmake_minimum_required(VERSION 3.0.0)
66
project(sdl12_compat
7-
VERSION 0.0.1
7+
VERSION 1.2.50
88
LANGUAGES C)
99

10-
set(SDL12_COMPAT_VERSION_STR "1.2.50")
11-
1210
option(SDL12TESTS "Enable to build SDL-1.2 test programs" ON)
1311
option(SDL12DEVEL "Enable installing SDL-1.2 development headers" ON)
1412
option(STATICDEVEL "Enable installing static link library" OFF)
@@ -86,26 +84,26 @@ if(APPLE)
8684
)
8785
elseif(UNIX AND NOT ANDROID)
8886
set_target_properties(SDL PROPERTIES
89-
VERSION "${SDL12_COMPAT_VERSION_STR}"
87+
VERSION "${PROJECT_VERSION}"
9088
SOVERSION "0"
9189
OUTPUT_NAME "SDL-1.2")
9290
elseif(WIN32)
9391
# avoid DLL having 'lib' prefix with MinGW
9492
set(CMAKE_SHARED_LIBRARY_PREFIX "")
9593
set_target_properties(SDL PROPERTIES COMPILE_DEFINITIONS "DLL_EXPORT")
9694
set_target_properties(SDL PROPERTIES
97-
VERSION "${SDL12_COMPAT_VERSION_STR}"
95+
VERSION "${PROJECT_VERSION}"
9896
SOVERSION "0"
9997
OUTPUT_NAME "SDL")
10098
elseif(OS2)
10199
set_target_properties(SDL PROPERTIES COMPILE_DEFINITIONS "BUILD_SDL") # for DECLSPEC
102100
set_target_properties(SDL PROPERTIES
103-
VERSION "${SDL12_COMPAT_VERSION_STR}"
101+
VERSION "${PROJECT_VERSION}"
104102
SOVERSION "0"
105103
OUTPUT_NAME "SDL12")
106104
else()
107105
set_target_properties(SDL PROPERTIES
108-
VERSION "${SDL12_COMPAT_VERSION_STR}"
106+
VERSION "${PROJECT_VERSION}"
109107
SOVERSION "0"
110108
OUTPUT_NAME "SDL")
111109
endif()
@@ -239,8 +237,6 @@ install(TARGETS SDL SDLmain
239237
)
240238

241239
if(SDL12DEVEL)
242-
set(SDL_VERSION "${SDL12_COMPAT_VERSION_STR}")
243-
244240
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
245241

246242
if(NOT MSVC)
@@ -303,7 +299,7 @@ if(STATICDEVEL AND SDL12DEVEL)
303299
set_target_properties(SDL-static PROPERTIES COMPILE_DEFINITIONS "_REENTRANT")
304300
target_link_libraries(SDL-static PRIVATE dl)
305301
set_target_properties(SDL-static PROPERTIES
306-
VERSION "${SDL12_COMPAT_VERSION_STR}"
302+
VERSION "${PROJECT_VERSION}"
307303
OUTPUT_NAME "SDL")
308304

309305
install(TARGETS SDL-static

sdl-config.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ while test $# -gt 0; do
4747
echo $exec_prefix
4848
;;
4949
--version)
50-
echo @SDL_VERSION@
50+
echo @PROJECT_VERSION@
5151
;;
5252
--cflags)
5353
echo -I${includedir}/SDL @SDL_CFLAGS@

sdl12_compat.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
88
Name: sdl12_compat
99
Description: An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
1010
Version: @PROJECT_VERSION@
11-
Provides: sdl = @SDL_VERSION@
11+
Provides: sdl = @PROJECT_VERSION@
1212
Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@
1313
@[email protected]: -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@
1414
Cflags: -I${includedir}/SDL @SDL_CFLAGS@

0 commit comments

Comments
 (0)