Skip to content

Commit

Permalink
CMake: for Windows builds, name proj DLL just 'proj.dll', except on m…
Browse files Browse the repository at this point in the history
…ingw where it will be 'proj-{soname}.dll'

Fixes OSGeo#4151
  • Loading branch information
rouault committed Jun 5, 2024
1 parent e0e1482 commit e82974f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
28 changes: 0 additions & 28 deletions cmake/ProjUtilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,6 @@ function(print_variable NAME)
message(STATUS "${NAME}${varpadding} = ${${NAME}}")
endfunction()

#
# Generates output name for given target depending on platform and version.
# For instance, on Windows, dynamic link libraries get ABI version suffix
# proj_X_Y.dll.
#

function(proj_target_output_name TARGET_NAME OUTPUT_NAME)
if(NOT DEFINED TARGET_NAME)
message(SEND_ERROR "Error, the variable TARGET_NAME is not defined!")
endif()

if(NOT DEFINED ${PROJECT_NAME}_VERSION)
message(SEND_ERROR
"Error, the variable ${${PROJECT_NAME}_VERSION} is not defined!")
endif()

# On Windows, ABI version is specified using binary file name suffix.
# On Unix, suffix is empty and SOVERSION is used instead.
if(WIN32)
string(LENGTH "${${PROJECT_NAME}_ABI_VERSION}" abilen)
if(abilen GREATER 0)
set(SUFFIX "_${${PROJECT_NAME}_ABI_VERSION}")
endif()
endif()

set(${OUTPUT_NAME} ${TARGET_NAME}${SUFFIX} PARENT_SCOPE)
endfunction()

#
# Configure a pkg-config file proj.pc
# See also ProjInstallPath.cmake
Expand Down
11 changes: 0 additions & 11 deletions cmake/ProjVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,5 @@ macro(proj_version)
${${PROJECT_NAME}_VERSION_MINOR}.\
${${PROJECT_NAME}_VERSION_PATCH}")

# Set ABI version string used to name binary output
# On Windows, ABI version is specified using binary file name suffix.
if(WIN32)
set(${PROJECT_NAME}_ABI_VERSION
"${${PROJECT_NAME}_VERSION_MAJOR}_\
${${PROJECT_NAME}_VERSION_MINOR}")
endif()

print_variable(${PROJECT_NAME}_VERSION)
if(WIN32)
print_variable(${PROJECT_NAME}_ABI_VERSION)
endif()
endmacro()
6 changes: 4 additions & 2 deletions src/lib_proj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ set(ALL_LIBPROJ_SOURCES
set(ALL_LIBPROJ_HEADERS ${HEADERS_LIBPROJ})

# Configuration for the core target "proj"
proj_target_output_name(proj PROJ_CORE_TARGET_OUTPUT_NAME)

add_library(proj
${ALL_LIBPROJ_SOURCES}
Expand Down Expand Up @@ -414,9 +413,12 @@ if(WIN32)
set_target_properties(proj
PROPERTIES
VERSION "${PROJ_VERSION}"
OUTPUT_NAME "${PROJ_CORE_TARGET_OUTPUT_NAME}"
OUTPUT_NAME proj
ARCHIVE_OUTPUT_NAME proj
CLEAN_DIRECT_OUTPUT 1)
if (MINGW AND BUILD_SHARED_LIBS)
set_target_properties(proj PROPERTIES SUFFIX "-${PROJ_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
elseif(BUILD_FRAMEWORKS_AND_BUNDLE)
set_target_properties(proj
PROPERTIES
Expand Down

0 comments on commit e82974f

Please sign in to comment.