Skip to content

Commit

Permalink
Update if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbourelly999 committed Sep 22, 2023
1 parent 6991635 commit 72a7345
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmake/Packing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ endif()
get_target_property(target_type ${PROJECT_NAME} TYPE)
if (target_type STREQUAL "SHARED_LIBRARY")
get_target_property(so_version ${PROJECT_NAME} SOVERSION)
# so_version evaluates to false when set to zero despite having a value
# see (https://cmake.org/cmake/help/v3.0/command/if.html). It evaluates to
# so_version-NOTFOUND when no value is present. It is always defined whether
# the property exists or not (see https://cmake.org/cmake/help/latest/command/get_target_property.html)
if((NOT so_version EQUAL 0 ) AND (NOT so_version))
message( FATAL_ERROR "Target property SOVERSION must be defined for shared library packages." )
# Check if so_version is empty or not found to allow for version 0
# which is normally treated the same as so_version-NOTFOUND in a condition.
if ("${so_version}" STREQUAL "" OR "${so_version}" STREQUAL "so_version-NOTFOUND")
message( FATAL_ERROR "Target property SOVERSION must be defined for shared library packages." )
endif()
set (PACKAGE_VERSION ${so_version})
endif()
Expand Down

0 comments on commit 72a7345

Please sign in to comment.