Skip to content

Commit

Permalink
Set library base name once in top-level CMakeLists.txt.
Browse files Browse the repository at this point in the history
Will avoid making errors in future versions. Include dirs still are hard-coded, as they partially exist as paths in the source tree.
  • Loading branch information
kblaschke committed Oct 6, 2023
1 parent ce56c3e commit 483b32d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ project(libprojectM
# functions. Adding new function should be okay if documented.
set(PROJECTM_SO_VERSION "4")

# Base filename of all installed libraries. Also used as package name in pkgconfig.
set(PROJECTM_LIBRARY_BASE_OUTPUT_NAME "projectM-${PROJECT_VERSION_MAJOR}")

# The actual (full) library version of projectM
set(PROJECTM_LIB_VERSION "${CMAKE_PROJECT_VERSION}")

Expand Down
8 changes: 4 additions & 4 deletions src/libprojectM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ set_target_properties(projectM PROPERTIES
VERSION "${PROJECTM_LIB_VERSION}"
SOVERSION "${PROJECTM_SO_VERSION}"
FOLDER libprojectM
OUTPUT_NAME projectM-4
OUTPUT_NAME ${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}
)

if(BUILD_SHARED_LIBS)
Expand All @@ -135,7 +135,7 @@ else()
)

set_target_properties(projectM PROPERTIES
OUTPUT_NAME $<IF:$<PLATFORM_ID:Windows>,libprojectM-4,projectM-4>
OUTPUT_NAME $<IF:$<PLATFORM_ID:Windows>,lib${PROJECTM_LIBRARY_BASE_OUTPUT_NAME},${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}>
FOLDER libprojectM
)
endif()
Expand Down Expand Up @@ -251,11 +251,11 @@ if(ENABLE_INSTALL)
endforeach()
endif()

set(PKGCONFIG_PACKAGE_NAME "projectM-4")
set(PKGCONFIG_PACKAGE_NAME "${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}")
set(PKGCONFIG_PACKAGE_DESCRIPTION "projectM Music Visualizer")
set(PKGCONFIG_PACKAGE_REQUIREMENTS_ALL "opengl")

generate_pkg_config_files(projectM projectM-4)
generate_pkg_config_files(projectM ${PROJECTM_LIBRARY_BASE_OUTPUT_NAME})

endif()

Expand Down
12 changes: 6 additions & 6 deletions src/playlist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set_target_properties(projectM_playlist PROPERTIES
SOVERSION "${PROJECTM_SO_VERSION}"
EXPORT_NAME playlist
FOLDER libprojectM
OUTPUT_NAME projectM-4-playlist
OUTPUT_NAME ${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}-playlist
)

target_include_directories(projectM_playlist
Expand Down Expand Up @@ -75,7 +75,7 @@ else()
)

set_target_properties(projectM_playlist PROPERTIES
OUTPUT_NAME $<IF:$<PLATFORM_ID:Windows>,libprojectM-4-playlist,projectM-4-playlist>
OUTPUT_NAME $<IF:$<PLATFORM_ID:Windows>,lib${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}-playlist,${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}-playlist>
FOLDER libprojectM
)
endif()
Expand Down Expand Up @@ -149,12 +149,12 @@ if(ENABLE_INSTALL)
if(UNIX)
include(GeneratePkgConfigFiles)

set(PKGCONFIG_PACKAGE_NAME "projectM-4-playlist")
set(PKGCONFIG_PACKAGE_NAME "${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}-playlist")
set(PKGCONFIG_PACKAGE_DESCRIPTION "projectM Playlist Library")
set(PKGCONFIG_PACKAGE_REQUIREMENTS_RELEASE "projectM-4")
set(PKGCONFIG_PACKAGE_REQUIREMENTS_DEBUG "projectM-4-debug")
set(PKGCONFIG_PACKAGE_REQUIREMENTS_RELEASE "${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}")
set(PKGCONFIG_PACKAGE_REQUIREMENTS_DEBUG "${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}-debug")

generate_pkg_config_files(projectM_playlist projectM-4-playlist)
generate_pkg_config_files(projectM_playlist ${PROJECTM_LIBRARY_BASE_OUTPUT_NAME}-playlist)
endif()

endif()

0 comments on commit 483b32d

Please sign in to comment.